forked from mautrix/imessage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
42 lines (40 loc) · 1.92 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
include:
- project: 'mautrix/ci'
file: '/go.yml'
# Don't use the default macOS job in mautrix/ci
build macos arm64:
rules:
- when: never
# TODO use build universal for all bridges? (i.e. move it to mautrix/ci)
build universal:
stage: build
tags:
- macos
- arm64
variables:
MACOSX_DEPLOYMENT_TARGET: "11.0"
before_script:
- export PATH=/opt/homebrew/bin:$PATH
- export MAUTRIX_VERSION=$(cat go.mod | grep 'maunium.net/go/mautrix ' | awk '{ print $2 }')
- export GO_LDFLAGS="-X main.Tag=$CI_COMMIT_TAG -X main.Commit=$CI_COMMIT_SHA -X 'main.BuildTime=`date '+%b %_d %Y, %H:%M:%S'`' -X 'maunium.net/go/mautrix.GoModVersion=$MAUTRIX_VERSION'"
- export CPATH=$(brew --prefix)/include
script:
# Build arm64 binary
- MACOSX_DEPLOYMENT_TARGET=11.0 LIBRARY_PATH=/opt/homebrew/lib go build -ldflags "$GO_LDFLAGS" -o $BINARY_NAME-arm64
- install_name_tool -change /opt/homebrew/opt/libolm/lib/libolm.3.dylib @rpath/libolm.3.dylib $BINARY_NAME-arm64
- install_name_tool -add_rpath @executable_path $BINARY_NAME-arm64
- install_name_tool -add_rpath /opt/homebrew/opt/libolm/lib $BINARY_NAME-arm64
- install_name_tool -add_rpath /usr/local/opt/libolm/lib $BINARY_NAME-arm64
# Build amd64 binary
- MACOSX_DEPLOYMENT_TARGET=10.13 LIBRARY_PATH=/usr/local/lib CGO_ENABLED=1 GOARCH=amd64 go build -ldflags "$GO_LDFLAGS" -o $BINARY_NAME-amd64
- install_name_tool -change /usr/local/opt/libolm/lib/libolm.3.dylib @rpath/libolm.3.dylib $BINARY_NAME-amd64
- install_name_tool -add_rpath @executable_path $BINARY_NAME-amd64
- install_name_tool -add_rpath /usr/local/opt/libolm/lib $BINARY_NAME-amd64
# Create universal libolm and bridge binary
- lipo -create -output libolm.3.dylib /opt/homebrew/opt/libolm/lib/libolm.3.dylib /usr/local/opt/libolm/lib/libolm.3.dylib
- lipo -create -output $BINARY_NAME $BINARY_NAME-arm64 $BINARY_NAME-amd64
artifacts:
paths:
- $BINARY_NAME
- example-config.yaml
- libolm.3.dylib