1414# See the License for the specific language governing permissions and
1515# limitations under the License.
1616#
17- # Build client-cpp for glibc 2.17 baseline (manylinux2014 or CentOS 7 + devtoolset-8).
17+ # Build client-cpp for glibc 2.17 baseline (manylinux2014 x86_64/aarch64, or CentOS 7 fallback).
18+ # Set PACKAGE_CLASSIFIER (e.g. linux-x86_64-glibc217 / linux-aarch64-glibc217).
1819set -euxo pipefail
1920
21+ MACHINE=$( uname -m)
22+ case " ${MACHINE} " in
23+ x86_64)
24+ CMAKE_PKG_ARCH=linux-x86_64
25+ JDK_API_ARCH=linux/x64
26+ ;;
27+ aarch64)
28+ CMAKE_PKG_ARCH=linux-aarch64
29+ JDK_API_ARCH=linux/aarch64
30+ ;;
31+ * )
32+ echo " Unsupported architecture: ${MACHINE} " >&2
33+ exit 1
34+ ;;
35+ esac
36+
37+ if [[ -z " ${PACKAGE_CLASSIFIER:- } " ]]; then
38+ if [[ " ${MACHINE} " == " x86_64" ]]; then
39+ PACKAGE_CLASSIFIER=linux-x86_64-glibc217
40+ else
41+ PACKAGE_CLASSIFIER=linux-aarch64-glibc217
42+ fi
43+ fi
44+
2045run_maven_build () {
2146 gcc --version
2247 cmake --version
2348 java -version
2449 cd " ${GITHUB_WORKSPACE:? GITHUB_WORKSPACE is not set} "
2550 ./mvnw clean package -P with-cpp -pl iotdb-client/client-cpp -am -DskipTests \
2651 -Dspotless.skip=true \
27- -Dclient.cpp.package.classifier=linux-x86_64-glibc217
52+ -Dclient.cpp.package.classifier=" ${PACKAGE_CLASSIFIER} "
2853}
2954
3055# CentOS 7 EOL: redirect yum repos to vault.centos.org (see CentOS wiki / SIG SCLo).
@@ -82,7 +107,7 @@ install_centos7_devtoolset8() {
82107}
83108
84109if [[ -x /opt/rh/devtoolset-10/root/usr/bin/gcc ]]; then
85- # manylinux2014_x86_64 ships devtoolset-10 on PATH for glibc 2.17-compatible builds.
110+ # manylinux2014 images ship devtoolset-10 on PATH for glibc 2.17-compatible builds.
86111 yum install -y wget tar which git patch unzip bzip2 || true
87112else
88113 install_centos7_devtoolset8
91116CMAKE_VERSION=3.28.4
92117CMAKE_DIR=/opt/cmake-${CMAKE_VERSION}
93118if [[ ! -x " ${CMAKE_DIR} /bin/cmake" ]]; then
94- wget -q " https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION} /cmake-${CMAKE_VERSION} -linux-x86_64 .tar.gz" \
119+ wget -q " https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION} /cmake-${CMAKE_VERSION} -${CMAKE_PKG_ARCH} .tar.gz" \
95120 -O /tmp/cmake.tar.gz
96121 rm -rf " ${CMAKE_DIR} "
97122 mkdir -p /opt
98123 tar xf /tmp/cmake.tar.gz -C /opt
99- mv " /opt/cmake-${CMAKE_VERSION} -linux-x86_64 " " ${CMAKE_DIR} "
124+ mv " /opt/cmake-${CMAKE_VERSION} -${CMAKE_PKG_ARCH} " " ${CMAKE_DIR} "
100125fi
101126
102127JAVA_HOME=/opt/jdk-17
103128if [[ ! -x " ${JAVA_HOME} /bin/java" ]]; then
104129 wget -qL -O /tmp/jdk17.tar.gz \
105- " https://api.adoptium.net/v3/binary/latest/17/ga/linux/x64 /jdk/hotspot/normal/eclipse?project=jdk"
130+ " https://api.adoptium.net/v3/binary/latest/17/ga/${JDK_API_ARCH} /jdk/hotspot/normal/eclipse?project=jdk"
106131 rm -rf /opt/jdk-17*
107132 mkdir -p /opt
108133 tar xf /tmp/jdk17.tar.gz -C /opt
@@ -117,16 +142,16 @@ export JAVA_HOME
117142if [[ -x /opt/rh/devtoolset-10/root/usr/bin/gcc ]]; then
118143 run_maven_build
119144else
120- scl enable devtoolset-8 -- bash -c '
145+ scl enable devtoolset-8 -- bash -c "
121146 set -euxo pipefail
122147 gcc --version
123148 cmake --version
124149 java -version
125- cd " ${GITHUB_WORKSPACE:?GITHUB_WORKSPACE is not set}"
150+ cd \"\ $ {GITHUB_WORKSPACE:?GITHUB_WORKSPACE is not set}\ "
126151 ./mvnw clean package -P with-cpp -pl iotdb-client/client-cpp -am -DskipTests \
127152 -Dspotless.skip=true \
128- -Dclient.cpp.package.classifier=linux-x86_64-glibc217
129- '
153+ -Dclient.cpp.package.classifier=${PACKAGE_CLASSIFIER}
154+ "
130155fi
131156
132157SO=" iotdb-client/client-cpp/target/install/lib/libiotdb_session.so"
0 commit comments