From 3a2a11b2b092fbbf21475c9dce1acf1608196e9c Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Tue, 9 Feb 2021 15:38:25 +0200 Subject: [PATCH] Combine macOS builds into universal binary --- .gitlab-ci.yml | 47 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index be6e4cf..310070a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,15 +47,15 @@ macos/amd64: - amd64 before_script: [] script: - - go build -o gomuks - - install_name_tool -change /usr/local/opt/libolm/lib/libolm.3.dylib @rpath/libolm.3 gomuks - - install_name_tool -add_rpath @executable_path gomuks - - install_name_tool -add_rpath /usr/local/opt/libolm/lib gomuks - - cp /usr/local/opt/libolm/lib/libolm.3.dylib . + - mkdir gomuks-macos-amd64 + - go build -o gomuks-macos-amd64/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 @executable_path gomuks-macos-amd64/gomuks + - 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: paths: - - gomuks - - libolm.3.dylib + - gomuks-macos-amd64 macos/arm64: stage: build @@ -67,16 +67,35 @@ macos/arm64: - export CPATH=/opt/homebrew/include - export PATH=/opt/homebrew/bin:$PATH script: - - go build -o gomuks - - install_name_tool -change /opt/homebrew/opt/libolm/lib/libolm.3.dylib @rpath/libolm.3 gomuks - - install_name_tool -add_rpath @executable_path gomuks - - install_name_tool -add_rpath /opt/homebrew/opt/libolm/lib gomuks - - install_name_tool -add_rpath /usr/local/opt/libolm/lib gomuks - - cp /opt/homebrew/opt/libolm/lib/libolm.3.dylib . + - mkdir gomuks-macos-arm64 + - go build -o gomuks-macos-arm64/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 @executable_path gomuks-macos-arm64/gomuks + - install_name_tool -add_rpath /opt/homebrew/opt/libolm/lib gomuks-macos-arm64/gomuks + - 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: 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 + - gomuks debian: image: debian