Skip to content

Commit

Permalink
fix(NODE-6590): add build for x64 macos (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
baileympearson authored Dec 4, 2024
1 parent 5097e88 commit 4972129
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 8 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
on:
pull_request:
branches: [main]
workflow_dispatch: {}
workflow_call: {}

Expand All @@ -10,7 +8,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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.0.0-alpha.1"
}
}
13 changes: 13 additions & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -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' ],
Expand Down
3 changes: 1 addition & 2 deletions etc/install-zstd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ clean_deps() {
}

download_zstd() {
rm -rf deps
mkdir -p deps/zstd
ZSTD_VERSION=$(node -p "require('./package.json')['mongodb:zstd_version']")

Expand All @@ -20,7 +19,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 .
}

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 4972129

Please sign in to comment.