Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions l/libprotobuf/build_info.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
{
"maintainer": "ramnathnayak-ibm",
"maintainer": "tejasBadjateIBM",
"package_name": "libprotobuf",
"github_url": "https://github.com/protocolbuffers/protobuf",
"version": "v4.25.3",
"version": "v6.31.1",
"default_branch": "main",
"package_dir": "l/libprotobuf",
"build_script": "libprotobuf_ubi_9.3.sh",
"build_script": "libprotobuf_ubi_10.2.sh",
"docker_build": false,
"validate_build_script": true,
"use_non_root_user": false,
"wheel_build": true,
"required_versions": {"Releases": ["*"], "Tags": ["v4.25.3", "v4.25.8"]},
"required_versions": {"Releases": ["*"], "Tags": ["v4.25.3", "v4.25.8", "v6.31.1"]},
"auditwheel_exclude": [
"libabsl_*"
],
"v6.31.1": {
"build_script": "libprotobuf_ubi_10.2.sh"
},
"*": {
"build_script": "libprotobuf_ubi_9.3.sh"
}
Expand Down
110 changes: 110 additions & 0 deletions l/libprotobuf/libprotobuf_ubi_10.2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#!/bin/bash -e
# -----------------------------------------------------------------------------
#
# Package : libprotobuf
# Version : v6.31.1
# Source repo : https://github.com/protocolbuffers/protobuf
# Tested on : UBI:10.2
# Language : Python
# Ci-Check : True
# Script License : Apache License, Version 2 or later
# Maintainer : tejasBadjateIBM <Tejas.Badjate@ibm.com>
#
# Disclaimer: This script has been tested in root mode on given
# ========== platform using the mentioned version of the package.
# It may not work as expected with newer versions of the
# package and/or distribution. In such case, please
# contact "Maintainer" of this script.
#
# ----------------------------------------------------------------------------

PACKAGE_NAME=libprotobuf
PACKAGE_VERSION=${1:-v6.31.1}
PACKAGE_URL=https://github.com/protocolbuffers/protobuf
PACKAGE_DIR="protobuf"
WORK_DIR=$(pwd)

yum install -y make libtool cmake git wget xz zlib-devel openssl-devel bzip2-devel libffi-devel libevent-devel patch python3.14 python3.14-devel python3.14-pip ninja-build

yum install gcc-toolset-15 gcc-toolset-15-gcc gcc-toolset-15-gcc-c++ -y

# ---------------------------------------------------------------------------
# Activate GCC Toolset 15 (SCL removed in UBI 10 — use PATH export)
# ---------------------------------------------------------------------------
if [[ -f /opt/rh/gcc-toolset-15/enable ]]; then
source /opt/rh/gcc-toolset-15/enable
elif [[ -d /opt/rh/gcc-toolset-15/root/usr/bin ]]; then
export PATH="/opt/rh/gcc-toolset-15/root/usr/bin:$PATH"
export LD_LIBRARY_PATH="/opt/rh/gcc-toolset-15/root/usr/lib64:$LD_LIBRARY_PATH"
else
echo "ERROR: gcc-toolset-15 not found"
exit 1
fi

export PATH="/opt/rh/gcc-toolset-15/root/usr/bin:$PATH"
export LD_LIBRARY_PATH="/opt/rh/gcc-toolset-15/root/usr/lib64:${LD_LIBRARY_PATH:-}"

export CC="/opt/rh/gcc-toolset-15/root/usr/bin/gcc"
export CXX="/opt/rh/gcc-toolset-15/root/usr/bin/g++"

PYTHON_VERSION=$(python --version 2>&1 | cut -d ' ' -f 2 | cut -d '.' -f 1,2)
export SITE_PACKAGE_PATH="/lib/python${PYTHON_VERSION}/site-packages"

python3.14 -m pip install --upgrade cmake pip setuptools wheel ninja packaging


echo "------------ libprotobuf installing-------------------"

#Build libprotobuf
git clone $PACKAGE_URL
cd $PACKAGE_DIR
git checkout $PACKAGE_VERSION

wget https://raw.githubusercontent.com/ppc64le/build-scripts/refs/heads/master/l/libprotobuf/libprotobuf-ubi10.2-6.31.1.patch
patch -p1 < libprotobuf-ubi10.2-6.31.1.patch

LIBPROTO_DIR=$(pwd)
mkdir -p $LIBPROTO_DIR/local/libprotobuf
LIBPROTO_INSTALL=$LIBPROTO_DIR/local/libprotobuf

git submodule update --init --recursive
rm -rf ./third_party/googletest | true


mkdir build
cd build

#Building and testing is performed through the same command
if ! (cmake -G "Ninja" \
${CMAKE_ARGS} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_C_COMPILER=$C_COMPILER \
-DCMAKE_CXX_COMPILER=$CXX_COMPILER \
-DCMAKE_INSTALL_PREFIX=$LIBPROTO_INSTALL \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_BUILD_SHARED_LIBS=ON \
-Dprotobuf_ABSL_PROVIDER="module" \
-Dprotobuf_JSONCPP_PROVIDER="package" \
-Dprotobuf_USE_EXTERNAL_GTEST=OFF \
..) ; then
echo "------------------$PACKAGE_NAME:install_&_test_both_fails---------------------"
echo "$PACKAGE_URL $PACKAGE_NAME"
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | GitHub | Fail | Install_success_but_test_Fails"
exit 2
else
echo "------------------$PACKAGE_NAME:install_&_test_both_success-------------------------"
echo "$PACKAGE_URL $PACKAGE_NAME"
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | GitHub | Pass | Both_Install_and_Test_Success"
fi

cmake --build . --verbose
cmake --install .

cd ..
wget https://raw.githubusercontent.com/ppc64le/build-scripts/refs/heads/master/l/libprotobuf/pyproject.toml
sed -i "s/{PACKAGE_VERSION}/$PACKAGE_VERSION/g" pyproject.toml

python3.14 -m pip wheel -w $WORK_DIR -vv --no-build-isolation --no-deps .

exit 0
Loading