Skip to content

Commit

Permalink
Fix protobuf installer with package absl.
Browse files Browse the repository at this point in the history
Signed-off-by: owent <[email protected]>
  • Loading branch information
owent committed May 27, 2023
1 parent c94e488 commit 0dc7575
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions ci/install_protobuf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,21 @@ set -e
# when calling this script
#

CPP_PROTOBUF_BUILD_OPTIONS=(
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON"
"-Dprotobuf_BUILD_TESTS=OFF"
"-Dprotobuf_BUILD_EXAMPLES=OFF"
"-Dprotobuf_MODULE_COMPATIBLE=ON"
)

if [[ ${PROTOBUF_VERSION/.*/} -ge 22 ]]; then
CPP_PROTOBUF_BUILD_OPTIONS=(${CPP_PROTOBUF_BUILD_OPTIONS[@]} "-Dprotobuf_MODULE_COMPATIBLE=ON")
fi

if [[ ${PROTOBUF_VERSION/.*/} -ge 22 ]]; then
export CPP_PROTOBUF_VERSION="${PROTOBUF_VERSION}"
CPP_PROTOBUF_PACKAGE_NAME="protobuf-${CPP_PROTOBUF_VERSION}"
CPP_PROTOBUF_BUILD_OPTIONS=(${CPP_PROTOBUF_BUILD_OPTIONS[@]} "-Dprotobuf_ABSL_PROVIDER=package")
else
export CPP_PROTOBUF_VERSION="3.${PROTOBUF_VERSION}"
CPP_PROTOBUF_PACKAGE_NAME="protobuf-cpp-${CPP_PROTOBUF_VERSION}"
Expand All @@ -42,7 +54,14 @@ fi
cd /
wget https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/${CPP_PROTOBUF_PACKAGE_NAME}.tar.gz
tar zxf ${CPP_PROTOBUF_PACKAGE_NAME}.tar.gz --no-same-owner
cd protobuf-${CPP_PROTOBUF_VERSION}
./configure
make -j $(nproc) && make install

mkdir protobuf-${CPP_PROTOBUF_VERSION}/build && pushd protobuf-${CPP_PROTOBUF_VERSION}/build
if [ -e "../CMakeLists.txt" ]; then
cmake .. ${CPP_PROTOBUF_BUILD_OPTIONS[@]}
else
cmake ../cmake ${CPP_PROTOBUF_BUILD_OPTIONS[@]}
fi
cmake --build . -j $(nproc)
cmake --install .
popd
ldconfig

0 comments on commit 0dc7575

Please sign in to comment.