You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2022/12/05 22:13:02 UTC
[pulsar-client-node] branch master updated: Supoort prebuild macos-arm64 arch binaries. (#250)
This is an automated email from the ASF dual-hosted git repository.
mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-client-node.git
The following commit(s) were added to refs/heads/master by this push:
new 79cd7ed Supoort prebuild macos-arm64 arch binaries. (#250)
79cd7ed is described below
commit 79cd7ed1ba62dea8891faaa2386eb81687113104
Author: Baodi Shi <wu...@icloud.com>
AuthorDate: Tue Dec 6 06:12:56 2022 +0800
Supoort prebuild macos-arm64 arch binaries. (#250)
* Supoort prebuild macos-arm64 arch binaries.
* Revert upgrade the OpenSSL version.
* Fix code review.
---
.github/workflows/ci-build-release-napi.yml | 17 +++++++++++++----
.github/workflows/ci-pr-validation.yml | 23 ++++++++++++-----------
pkg/mac/build-cpp-deps-lib.sh | 7 ++++---
pkg/mac/build-cpp-lib.sh | 2 +-
4 files changed, 30 insertions(+), 19 deletions(-)
diff --git a/.github/workflows/ci-build-release-napi.yml b/.github/workflows/ci-build-release-napi.yml
index 9d6a2f6..25dc9f9 100644
--- a/.github/workflows/ci-build-release-napi.yml
+++ b/.github/workflows/ci-build-release-napi.yml
@@ -19,8 +19,8 @@ jobs:
fail-fast: false
matrix:
arch:
- - x86_64
-# - arm64
+ - x64
+ - arm64
nodejs:
- 18
steps:
@@ -38,16 +38,24 @@ jobs:
path: pkg/mac/build
key: ${{ runner.os }}-${{ matrix.arch }}-mac-${{ hashFiles('pkg/mac/build-cpp-deps-lib.sh') }}
+ - name: Add arch env vars
+ run: |
+ if [ "${{ matrix.arch }}" = "x64" ]; then
+ echo "ARCH=x86_64" >> $GITHUB_ENV
+ else
+ echo "ARCH=${{ matrix.arch }}" >> $GITHUB_ENV
+ fi
+
- name: Build CPP dependencies lib
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
- export ARCH=${{ matrix.arch }}
+ export ARCH=${{ env.ARCH }}
pkg/mac/build-cpp-deps-lib.sh
- name: Build CPP lib
if: steps.cache-pulsar.outputs.cache-hit != 'true'
run: |
- export ARCH=${{ matrix.arch }}
+ export ARCH=${{ env.ARCH }}
pkg/mac/build-cpp-lib.sh
- name: Build Node binaries lib
@@ -57,6 +65,7 @@ jobs:
npx node-pre-gyp build --target_arch=${{ matrix.arch }}
- name: Test loading Node binaries lib
+ if: matrix.arch == 'x64'
run: |
node pkg/load_test.js
diff --git a/.github/workflows/ci-pr-validation.yml b/.github/workflows/ci-pr-validation.yml
index bd22c20..98e2eda 100644
--- a/.github/workflows/ci-pr-validation.yml
+++ b/.github/workflows/ci-pr-validation.yml
@@ -48,7 +48,8 @@ jobs:
fail-fast: false
matrix:
arch:
- - x86_64
+ - x64
+ - arm64
nodejs:
- 18
steps:
@@ -66,40 +67,40 @@ jobs:
path: pkg/mac/build
key: ${{ runner.os }}-${{ matrix.arch }}-mac-${{ hashFiles('pkg/mac/build-cpp-deps-lib.sh') }}
- - name: Add env vars
- shell: bash
+ - name: Add arch env vars
run: |
- if [ "${{ matrix.target }}" = "x86_64" ]; then
- echo "TARGET=x64" >> $GITHUB_ENV
+ if [ "${{ matrix.arch }}" = "x64" ]; then
+ echo "ARCH=x86_64" >> $GITHUB_ENV
else
- echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV
+ echo "ARCH=${{ matrix.arch }}" >> $GITHUB_ENV
fi
- name: Build CPP dependencies lib
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
- export ARCH=${{ matrix.arch }}
+ export ARCH=${{ env.ARCH }}
pkg/mac/build-cpp-deps-lib.sh
- name: Build CPP lib
if: steps.cache-pulsar.outputs.cache-hit != 'true'
run: |
- export ARCH=${{ matrix.arch }}
+ export ARCH=${{ env.ARCH }}
pkg/mac/build-cpp-lib.sh
- name: Build Node binaries lib
run: |
npm install --ignore-scripts
- npx node-pre-gyp configure --target_arch=${{ env.TARGET }}
- npx node-pre-gyp build --target_arch=${{ env.TARGET }}
+ npx node-pre-gyp configure --target_arch=${{ matrix.arch }}
+ npx node-pre-gyp build --target_arch=${{ matrix.arch }}
- name: Test loading Node binaries lib
+ if: matrix.arch == 'x64'
run: |
node pkg/load_test.js
- name: Package Node binaries lib
run: |
- npx node-pre-gyp package --target_arch=${{ env.TARGET }}
+ npx node-pre-gyp package --target_arch=${{ matrix.arch }}
linux-napi:
name: Build NAPI ${{matrix.image}} - Node ${{matrix.nodejs}} - ${{matrix.cpu.platform}}
diff --git a/pkg/mac/build-cpp-deps-lib.sh b/pkg/mac/build-cpp-deps-lib.sh
index 9226bce..d609202 100755
--- a/pkg/mac/build-cpp-deps-lib.sh
+++ b/pkg/mac/build-cpp-deps-lib.sh
@@ -147,8 +147,8 @@ if [ ! -f snappy-${SNAPPY_VERSION}.done ]; then
curl -O -L https://github.com/google/snappy/archive/refs/tags/${SNAPPY_VERSION}.tar.gz
tar xfz ${SNAPPY_VERSION}.tar.gz
pushd snappy-${SNAPPY_VERSION}
- CXXFLAGS="-fPIC -O3 -arch ${ARCH} -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}" \
- cmake . -DCMAKE_INSTALL_PREFIX=$PREFIX -DSNAPPY_BUILD_TESTS=OFF -DSNAPPY_BUILD_BENCHMARKS=OFF
+ CXXFLAGS="-fPIC -O3 -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}" \
+ cmake . -DCMAKE_OSX_ARCHITECTURES=${ARCH} -DCMAKE_INSTALL_PREFIX=$PREFIX -DSNAPPY_BUILD_TESTS=OFF -DSNAPPY_BUILD_BENCHMARKS=OFF
make -j16
make install
touch .done
@@ -175,7 +175,8 @@ if [ ! -f curl-${CURL_VERSION}.done ]; then
--without-brotli \
--without-secure-transport \
--disable-ipv6 \
- --prefix=$PREFIX
+ --prefix=$PREFIX \
+ --host=$ARCH-apple-darwin
make -j16 install
popd
diff --git a/pkg/mac/build-cpp-lib.sh b/pkg/mac/build-cpp-lib.sh
index ab82927..a0f4289 100755
--- a/pkg/mac/build-cpp-lib.sh
+++ b/pkg/mac/build-cpp-lib.sh
@@ -29,9 +29,9 @@ cd $PULSAR_DIR
curl -O -L "$BASE_URL"/apache-pulsar-client-cpp-${PULSAR_CPP_VERSION}.tar.gz
tar xfz apache-pulsar-client-cpp-${PULSAR_CPP_VERSION}.tar.gz
pushd apache-pulsar-client-cpp-${PULSAR_CPP_VERSION}
- chmod +x ./build-support/merge_archives.sh
rm -f CMakeCache.txt
cmake . \
+ -DCMAKE_OSX_ARCHITECTURES=${ARCH} \
-DCMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} \
-DCMAKE_INSTALL_PREFIX=$PULSAR_PREFIX \
-DCMAKE_BUILD_TYPE=Release \