Skip to content

Commit

Permalink
[minor] Build a universal binary to support Apple M1
Browse files Browse the repository at this point in the history
Fixes #135
  • Loading branch information
lpinca committed Sep 24, 2021
1 parent b40a0f2 commit bedfb2c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:
- 14
- 16
os:
- macOS-latest
- macos-11
- ubuntu-18.04
- windows-latest
exclude:
- arch: x86
os: macOS-latest
os: macos-11
- arch: x86
os: ubuntu-18.04
steps:
Expand All @@ -34,7 +34,13 @@ jobs:
- run: npm install
- run: npm test
- run: npm run prebuild
if: matrix.node == 14 && startsWith(github.ref, 'refs/tags/')
if:
matrix.node == 14 && matrix.os != 'macos-11' && startsWith(github.ref,
'refs/tags/')
- run: npm run prebuild-darwin-x64+arm64
if:
matrix.node == 14 && matrix.os == 'macos-11' && startsWith(github.ref,
'refs/tags/')
- run: npm run prebuild-linux-arm
if:
matrix.node == 14 && matrix.os == 'ubuntu-18.04' &&
Expand All @@ -57,8 +63,8 @@ jobs:
- run: echo ::set-output name=version::$(git describe --tags)
id: get_version
- run:
tar -cvf "${{ steps.get_version.outputs.version }}-darwin-x64.tar" -C
"prebuilds/macOS-latest" .
tar -cvf "${{ steps.get_version.outputs.version
}}-darwin-x64+arm64.tar" -C "prebuilds/macos-11" .
- run:
tar -cvf "${{ steps.get_version.outputs.version }}-linux-arm.tar" -C
"prebuilds/ubuntu-18.04" linux-arm
Expand Down
7 changes: 6 additions & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
{
'target_name': 'bufferutil',
'sources': ['src/bufferutil.c'],
'cflags': ['-std=c99']
'cflags': ['-std=c99'],
'xcode_settings': {
'MACOSX_DEPLOYMENT_TARGET': '10.7',
'OTHER_CFLAGS': ['-arch x86_64', '-arch arm64'],
'OTHER_LDFLAGS': ['-arch x86_64', '-arch arm64']
}
}
]
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"scripts": {
"install": "node-gyp-build",
"prebuild": "prebuildify --napi --strip",
"prebuild-darwin-x64+arm64": "prebuildify --arch x64+arm64 --napi --strip",
"prebuild-linux-arm": "prebuildify-cross -i linux-armv6 -i linux-armv7 -i linux-arm64 --napi --strip",
"test": "mocha"
},
Expand Down

0 comments on commit bedfb2c

Please sign in to comment.