Combine macOS builds into universal binary

This commit is contained in:
Tulir Asokan 2021-02-09 15:38:25 +02:00
parent ce4e9bf92a
commit 3a2a11b2b0

View File

@ -47,15 +47,15 @@ macos/amd64:
- amd64 - amd64
before_script: [] before_script: []
script: script:
- go build -o gomuks - mkdir gomuks-macos-amd64
- install_name_tool -change /usr/local/opt/libolm/lib/libolm.3.dylib @rpath/libolm.3 gomuks - go build -o gomuks-macos-amd64/gomuks
- install_name_tool -add_rpath @executable_path gomuks - install_name_tool -change /usr/local/opt/libolm/lib/libolm.3.dylib @rpath/libolm.3.dylib gomuks-macos-amd64/gomuks
- install_name_tool -add_rpath /usr/local/opt/libolm/lib gomuks - install_name_tool -add_rpath @executable_path gomuks-macos-amd64/gomuks
- cp /usr/local/opt/libolm/lib/libolm.3.dylib . - install_name_tool -add_rpath /usr/local/opt/libolm/lib gomuks-macos-amd64/gomuks
- cp /usr/local/opt/libolm/lib/libolm.3.dylib gomuks-macos-amd64/
artifacts: artifacts:
paths: paths:
- gomuks - gomuks-macos-amd64
- libolm.3.dylib
macos/arm64: macos/arm64:
stage: build stage: build
@ -67,16 +67,35 @@ macos/arm64:
- export CPATH=/opt/homebrew/include - export CPATH=/opt/homebrew/include
- export PATH=/opt/homebrew/bin:$PATH - export PATH=/opt/homebrew/bin:$PATH
script: script:
- go build -o gomuks - mkdir gomuks-macos-arm64
- install_name_tool -change /opt/homebrew/opt/libolm/lib/libolm.3.dylib @rpath/libolm.3 gomuks - go build -o gomuks-macos-arm64/gomuks
- install_name_tool -add_rpath @executable_path gomuks - install_name_tool -change /opt/homebrew/opt/libolm/lib/libolm.3.dylib @rpath/libolm.3.dylib gomuks-macos-arm64/gomuks
- install_name_tool -add_rpath /opt/homebrew/opt/libolm/lib gomuks - install_name_tool -add_rpath @executable_path gomuks-macos-arm64/gomuks
- install_name_tool -add_rpath /usr/local/opt/libolm/lib gomuks - install_name_tool -add_rpath /opt/homebrew/opt/libolm/lib gomuks-macos-arm64/gomuks
- cp /opt/homebrew/opt/libolm/lib/libolm.3.dylib . - install_name_tool -add_rpath /usr/local/opt/libolm/lib gomuks-macos-arm64/gomuks
- cp /opt/homebrew/opt/libolm/lib/libolm.3.dylib gomuks-macos-arm64/
artifacts: artifacts:
paths: paths:
- gomuks - gomuks-macos-arm64
macos/universal:
stage: package
dependencies:
- macos/amd64
- macos/arm64
needs:
- macos/amd64
- macos/arm64
variables:
GIT_STRATEGY: none
script:
- lipo -create -output libolm.3.dylib gomuks-macos-arm64/libolm.3.dylib gomuks-macos-amd64/libolm.3.dylib
- lipo -create -output gomuks gomuks-macos-arm64/gomuks gomuks-macos-amd64/gomuks
artifacts:
name: gomuks-macos-universal
paths:
- libolm.3.dylib - libolm.3.dylib
- gomuks
debian: debian:
image: debian image: debian