From edaaf5e2b95c1c90528fc9e000079b1ef0e379cc Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Tue, 3 Dec 2024 14:39:11 -0700 Subject: [PATCH 1/9] build universal binary --- .github/workflows/build.yml | 2 +- .github/workflows/test.yml | 2 +- binding.gyp | 13 +++++++++++++ etc/install-zstd.sh | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a3d038b..b329fb2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,7 @@ jobs: host_tests: strategy: matrix: - os: [macos-latest, windows-2019] + os: [macos-latest, windows-2019, macos-13] fail-fast: false runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d4644bb..57413b7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: host_tests: strategy: matrix: - os: [macos-latest, windows-2019] + os: [macos-latest, windows-2019, macos-13] node: [16.20.1, 18.x, 20.x, 22.x] fail-fast: false runs-on: ${{ matrix.os }} diff --git a/binding.gyp b/binding.gyp index b076cb9..3da1b99 100644 --- a/binding.gyp +++ b/binding.gyp @@ -34,6 +34,19 @@ ] }, } + ], + ['OS=="mac"', { + 'xcode_settings': { + "OTHER_CFLAGS": [ + "-arch x86_64", + "-arch arm64" + ], + "OTHER_LDFLAGS": [ + "-arch x86_64", + "-arch arm64" + ] + } + } ] ], 'cflags!': [ '-fno-exceptions' ], diff --git a/etc/install-zstd.sh b/etc/install-zstd.sh index 62a129f..8d23ac6 100644 --- a/etc/install-zstd.sh +++ b/etc/install-zstd.sh @@ -20,7 +20,7 @@ build_zstd() { # CMAKE_RC_FLAGS is a workaround for a bug in 1.5.6 that breaks compilation on windows. # The fix is merged but not yet released. see https://github.com/facebook/zstd/issues/3999 - cmake -DCMAKE_RC_FLAGS="$(pwd)/lib" -DZSTD_MULTITHREAD_SUPPORT=OFF -DZSTD_BUILD_SHARED=OFF . + cmake -DCMAKE_RC_FLAGS="$(pwd)/lib" -DZSTD_MULTITHREAD_SUPPORT=OFF -DZSTD_BUILD_SHARED=OFF -DCMAKE_OSX_ARCHITECTURES=x86_64;arm64 . cmake --build . } From 2ba7b1a162fed7125863642a37c5c9a40326e66d Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Tue, 3 Dec 2024 14:40:06 -0700 Subject: [PATCH 2/9] asdf --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index dc42fda..7bce18a 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,8 @@ "node": ">= 16.20.1" }, "scripts": { - "install": "prebuild-install --runtime napi || node-gyp rebuild", + "install": "prebuild-install --runtime napi || npm run clean-install", + "clean-install": "npm run install-zstd && npm run compile", "compile": "node-gyp rebuild", "test": "mocha test/index.test.js", "install-zstd": "bash etc/install-zstd.sh", From f31913d6bfff37a6f30c80f76d4f70ff16072804 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Tue, 3 Dec 2024 14:49:33 -0700 Subject: [PATCH 3/9] fix lint --- .release-please-manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6e011e8..4a263fa 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { ".": "2.0.0-alpha.1" -} \ No newline at end of file +} From 375f98f93646a91509ad3bcac751e650505df9a4 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Tue, 3 Dec 2024 15:16:49 -0700 Subject: [PATCH 4/9] don't build and test on PRs --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b329fb2..efbbfe7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,4 @@ on: - pull_request: - branches: [main] workflow_dispatch: {} workflow_call: {} From 7fe1874237e048caf61606b55f7c478186b54fb0 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Wed, 4 Dec 2024 09:24:32 -0700 Subject: [PATCH 5/9] errexit --- etc/install-zstd.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/install-zstd.sh b/etc/install-zstd.sh index 8d23ac6..d4a5430 100644 --- a/etc/install-zstd.sh +++ b/etc/install-zstd.sh @@ -1,5 +1,6 @@ #!/bin/sh set -o xtrace +set -o errexit clean_deps() { rm -rf deps From 6d9260fedb3ddcd643c7c1e741aa6768dfb88d0b Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Wed, 4 Dec 2024 09:41:25 -0700 Subject: [PATCH 6/9] fix builds --- etc/install-zstd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/install-zstd.sh b/etc/install-zstd.sh index d4a5430..f29022f 100644 --- a/etc/install-zstd.sh +++ b/etc/install-zstd.sh @@ -21,7 +21,7 @@ build_zstd() { # CMAKE_RC_FLAGS is a workaround for a bug in 1.5.6 that breaks compilation on windows. # The fix is merged but not yet released. see https://github.com/facebook/zstd/issues/3999 - cmake -DCMAKE_RC_FLAGS="$(pwd)/lib" -DZSTD_MULTITHREAD_SUPPORT=OFF -DZSTD_BUILD_SHARED=OFF -DCMAKE_OSX_ARCHITECTURES=x86_64;arm64 . + cmake -DCMAKE_RC_FLAGS="$(pwd)/lib" -DZSTD_MULTITHREAD_SUPPORT=OFF -DZSTD_BUILD_SHARED=OFF -DCMAKE_OSX_ARCHITECTURES='x86_64;arm64' . cmake --build . } From b2df3d4feb20cd44eefab59c6c77cf75a0199ffd Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Wed, 4 Dec 2024 09:44:32 -0700 Subject: [PATCH 7/9] try to fix windows --- etc/install-zstd.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/install-zstd.sh b/etc/install-zstd.sh index f29022f..526dbad 100644 --- a/etc/install-zstd.sh +++ b/etc/install-zstd.sh @@ -7,8 +7,8 @@ clean_deps() { } download_zstd() { - rm -rf deps - mkdir -p deps/zstd + mkdkr deps + mkdir deps/zstd ZSTD_VERSION=$(node -p "require('./package.json')['mongodb:zstd_version']") curl -L "https://github.com/facebook/zstd/releases/download/v$ZSTD_VERSION/zstd-$ZSTD_VERSION.tar.gz" \ From 3ce2014bba3c21e6e37f5772a58d7eda75a043af Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Wed, 4 Dec 2024 09:45:38 -0700 Subject: [PATCH 8/9] mkdir --- etc/install-zstd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/install-zstd.sh b/etc/install-zstd.sh index 526dbad..9f95f6c 100644 --- a/etc/install-zstd.sh +++ b/etc/install-zstd.sh @@ -7,7 +7,7 @@ clean_deps() { } download_zstd() { - mkdkr deps + mkdir deps mkdir deps/zstd ZSTD_VERSION=$(node -p "require('./package.json')['mongodb:zstd_version']") From a32a62f0d86a01bf9b29016baaa30b17967e6541 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Wed, 4 Dec 2024 09:55:27 -0700 Subject: [PATCH 9/9] no errexit --- etc/install-zstd.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/etc/install-zstd.sh b/etc/install-zstd.sh index 9f95f6c..d9ba539 100644 --- a/etc/install-zstd.sh +++ b/etc/install-zstd.sh @@ -1,14 +1,12 @@ #!/bin/sh set -o xtrace -set -o errexit clean_deps() { rm -rf deps } download_zstd() { - mkdir deps - mkdir deps/zstd + mkdir -p deps/zstd ZSTD_VERSION=$(node -p "require('./package.json')['mongodb:zstd_version']") curl -L "https://github.com/facebook/zstd/releases/download/v$ZSTD_VERSION/zstd-$ZSTD_VERSION.tar.gz" \