forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added DEB packaging for C++ pulsar client lib (apache#1970)
- Loading branch information
Showing
7 changed files
with
225 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
BUILD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
# Build pulsar client library in Centos with tools to | ||
|
||
FROM debian:9 | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y curl g++ make libcurl4-openssl-dev libssl-dev python-dev \ | ||
libxml2-utils git | ||
|
||
# Download and compile boost | ||
RUN curl -O -L https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.gz && \ | ||
tar xvfz boost_1_64_0.tar.gz && \ | ||
cd /boost_1_64_0 && \ | ||
./bootstrap.sh --with-libraries=program_options,filesystem,regex,thread,system,python && \ | ||
./b2 address-model=64 cxxflags=-fPIC link=static threading=multi variant=release install && \ | ||
rm -rf /boost_1_64_0.tar.gz /boost_1_64_0 | ||
|
||
RUN curl -O -L https://github.com/Kitware/CMake/archive/v3.8.2.tar.gz && \ | ||
tar xvfz v3.8.2.tar.gz && \ | ||
cd CMake-3.8.2 && \ | ||
./configure && \ | ||
make && make install && \ | ||
rm -rf /v3.8.2.tar.gz /CMake-3.8.2 | ||
|
||
# Compile JSON CPP | ||
RUN curl -O -L https://github.com/open-source-parsers/jsoncpp/archive/1.8.0.tar.gz && \ | ||
tar xvfz 1.8.0.tar.gz && \ | ||
cd jsoncpp-1.8.0 && \ | ||
cmake . -DCMAKE_POSITION_INDEPENDENT_CODE=ON && \ | ||
make && make install && \ | ||
rm -rf /1.8.0.tar.gz /jsoncpp-1.8.0 | ||
|
||
# Download and copile protoubf | ||
RUN curl -O -L https://github.com/google/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz && \ | ||
tar xvfz protobuf-cpp-3.3.0.tar.gz && \ | ||
cd protobuf-3.3.0/ && \ | ||
CXXFLAGS=-fPIC ./configure && \ | ||
make && make install && ldconfig && \ | ||
rm -rf /protobuf-cpp-3.3.0.tar.gz /protobuf-3.3.0 | ||
|
||
# ZLib | ||
RUN curl -O -L https://github.com/madler/zlib/archive/v1.2.11.tar.gz && \ | ||
tar xvfz v1.2.11.tar.gz && \ | ||
cd zlib-1.2.11 && \ | ||
CFLAGS="-fPIC -O3" ./configure && \ | ||
make && make install && \ | ||
rm -rf /zlib-1.2.11.tar.gz /zlib-1.2.11 | ||
|
||
# LibCurl | ||
RUN curl -O -L https://github.com/curl/curl/releases/download/curl-7_54_0/curl-7.54.0.tar.gz && \ | ||
tar xvfz curl-7.54.0.tar.gz && \ | ||
cd curl-7.54.0 && \ | ||
CFLAGS=-fPIC ./configure && \ | ||
make && make install && \ | ||
rm -rf /curl-7.54.0.tar.gz /curl-7.54.0 | ||
|
||
|
||
RUN apt-get install -y dpkg-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#!/bin/bash | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
set -e -x | ||
|
||
cd /pulsar | ||
SRC_ROOT_DIR=$(git rev-parse --show-toplevel) | ||
cd $SRC_ROOT_DIR/pulsar-client-cpp/pkg/deb | ||
|
||
POM_VERSION=`cat ../../../pom.xml | xmllint --format - | sed "s/xmlns=\".*\"//g" | xmllint --stream --pattern /project/version --debug - | grep -A 2 "matches pattern" | grep text | sed "s/.* [0-9] //g"` | ||
# Sanitize VERSION by removing `-incubating` since it's not legal in DEB | ||
VERSION=`echo $POM_VERSION | awk -F- '{print $1}'` | ||
|
||
ROOT_DIR=apache-pulsar-$POM_VERSION | ||
CPP_DIR=$ROOT_DIR/pulsar-client-cpp | ||
|
||
rm -rf BUILD | ||
mkdir BUILD | ||
cd BUILD | ||
tar xfz $SRC_ROOT_DIR/all/target/apache-pulsar-$POM_VERSION-src.tar.gz | ||
pushd $CPP_DIR | ||
|
||
cmake . -DBUILD_TESTS=OFF -DLINK_STATIC=ON | ||
make pulsarShared pulsarStatic -j 3 | ||
strip lib/libpulsar.* | ||
popd | ||
|
||
DEST_DIR=pulsar-client | ||
mkdir -p $DEST_DIR/DEBIAN | ||
cat <<EOF > $DEST_DIR/DEBIAN/control | ||
Package: pulsar-client | ||
Version: ${VERSION} | ||
Maintainer: Apache Pulsar <[email protected]> | ||
Architecture: amd64 | ||
Description: The Apache Pulsar client contains a C++ and C APIs to interact with Apache Pulsar brokers. | ||
EOF | ||
|
||
DEVEL_DEST_DIR=pulsar-client-dev | ||
mkdir -p $DEVEL_DEST_DIR/DEBIAN | ||
cat <<EOF > $DEVEL_DEST_DIR/DEBIAN/control | ||
Package: pulsar-client-dev | ||
Version: ${VERSION} | ||
Maintainer: Apache Pulsar <[email protected]> | ||
Architecture: amd64 | ||
Description: The Apache Pulsar client contains a C++ and C APIs to interact with Apache Pulsar brokers. | ||
EOF | ||
|
||
mkdir -p $DEST_DIR/usr/lib | ||
mkdir -p $DEVEL_DEST_DIR/usr/lib | ||
mkdir -p $DEVEL_DEST_DIR/usr/include | ||
mkdir -p $DEST_DIR/usr/share/doc/pulsar-client-$VERSION | ||
mkdir -p $DEVEL_DEST_DIR/usr/share/doc/pulsar-client-dev-$VERSION | ||
|
||
cp -ar $CPP_DIR/include/pulsar $DEVEL_DEST_DIR/usr/include/ | ||
cp $CPP_DIR/lib/libpulsar.a $DEVEL_DEST_DIR/usr/lib | ||
cp $CPP_DIR/lib/libpulsar.so.$POM_VERSION $DEST_DIR/usr/lib | ||
pushd $DEST_DIR/usr/lib | ||
ln -s libpulsar.so.$POM_VERSION libpulsar.so | ||
popd | ||
|
||
cp $ROOT_DIR/DISCLAIMER $DEST_DIR/usr/share/doc/pulsar-client-$VERSION | ||
cp $ROOT_DIR/NOTICE $DEST_DIR/usr/share/doc/pulsar-client-$VERSION | ||
cp $CPP_DIR/pkg/licenses/* $DEST_DIR/usr/share/doc/pulsar-client-$VERSION | ||
cp $CPP_DIR/pkg/licenses/LICENSE.txt $DEST_DIR/usr/share/doc/pulsar-client-$VERSION/copyright | ||
cp $CPP_DIR/pkg/licenses/LICENSE.txt $DEST_DIR/DEBIAN/copyright | ||
cp $CPP_DIR/pkg/licenses/LICENSE.txt $DEVEL_DEST_DIR/DEBIAN/copyright | ||
|
||
cp $DEST_DIR/usr/share/doc/pulsar-client-$VERSION/* $DEVEL_DEST_DIR/usr/share/doc/pulsar-client-dev-$VERSION | ||
|
||
|
||
## Build actual debian packages | ||
dpkg-deb --build pulsar-client | ||
dpkg-deb --build pulsar-client-dev | ||
|
||
mkdir DEB | ||
mv *.deb DEB | ||
cd DEB | ||
dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
docker build -t apachepulsar/pulsar-build:debian-9 . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
set -e | ||
|
||
ROOT_DIR=$(git rev-parse --show-toplevel) | ||
|
||
docker pull apachepulsar/pulsar-build:debian-9 | ||
|
||
docker run -it -v $ROOT_DIR:/pulsar apachepulsar/pulsar-build:debian-9 \ | ||
/pulsar/pulsar-client-cpp/pkg/deb/build-deb.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters