Skip to content

Commit

Permalink
fix: build separate arm64 and x64 binaries for macos, and do not both…
Browse files Browse the repository at this point in the history
…er combining them, just distribute 4 packages
  • Loading branch information
CMCDragonkai committed May 17, 2023
1 parent df0b5be commit 3c618b7
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
5 changes: 3 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,16 @@ build:macos:
image: macos-11-xcode-12
variables:
# Produce universal binary
npm_config_arch: "x64+arm64"
RUST_BACKTRACE: "1"
script:
- eval "$(brew shellenv)"
- ./scripts/brew-install.sh
- hash -r
- npm install --ignore-scripts
- export PATH="$(npm root)/.bin:$PATH"
- npm run prebuild --verbose -- --production
# Build x64 and arm64 separately
- npm run prebuild --verbose -- --arch x64 --production
- npm run prebuild --verbose -- --arch arm64 --production
- npm test -- --ci --coverage
- npm run bench
artifacts:
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@
"ip-num": "^1.5.0"
},
"optionalDependencies": {
"@matrixai/quic-darwin-x64": "0.0.1",
"@matrixai/quic-linux-x64": "0.0.1",
"@matrixai/quic-win32-x64": "0.0.1"
"@matrixai/quic-win32-x64": "0.0.1",
"@matrixai/quic-darwin-x64": "0.0.1",
"@matrixai/quic-darwin-arm64": "0.0.1"
},
"devDependencies": {
"@fast-check/jest": "^1.1.0",
Expand Down
12 changes: 10 additions & 2 deletions scripts/brew-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ export HOMEBREW_NO_ANALYTICS=1
brew update
brew install node@18
brew link --overwrite node@18
brew install rust
brew link --overwrite rust
brew install cmake
brew link --overwrite cmake
brew install rustup-init
brew link --overwrite rustup-init

# Brew does not provide specific versions of rust
# However rustup provides specific versions
# Here we provide both toolchains
rustup-init \
--default-toolchain 1.68.2 \
--target x86_64-apple-darwin aarch64-apple-darwin \
-y
4 changes: 0 additions & 4 deletions scripts/prebuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ async function main(argv = process.argv) {
case 'arm64':
targetArch = 'aarch64';
break;
case 'x64+arm64':
case 'arm64+x64':
targetArch = 'universal';
break;
default:
console.error('Unsupported architecture');
process.exitCode = 1;
Expand Down

0 comments on commit 3c618b7

Please sign in to comment.