From ba4efc6411df758c28b6f5564a61d00675c6da51 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 8 May 2020 17:29:29 +0300 Subject: [PATCH] Add static build with e2ee --- .gitlab-ci.yml | 37 ++++++++----------------------------- go.mod | 2 +- go.sum | 2 ++ 3 files changed, 11 insertions(+), 30 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 05097b8..0d681d7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,41 +1,20 @@ build: - stage: build - image: debian:bullseye - cache: - paths: - - .cache - before_script: - - apt-get update - - apt-get install -y git libolm-dev golang-go - - mkdir -p .cache - - export GOPATH="$CI_PROJECT_DIR/.cache" - script: - - go build -o gomuks_linux_amd64 - artifacts: - paths: - - gomuks_linux_amd64 - -build_static: stage: build image: golang:alpine cache: paths: - .cache before_script: + - apk add --no-cache git build-base - mkdir -p .cache - export GOPATH="$CI_PROJECT_DIR/.cache" - variables: - CGO_ENABLED: "0" script: - - GOOS=linux GOARCH=amd64 go build -o gomuks_linux_amd64 - - GOOS=linux GOARCH=386 go build -o gomuks_linux_386 - - GOOS=linux GOARCH=arm go build -o gomuks_linux_arm - - GOOS=linux GOARCH=arm64 go build -o gomuks_linux_arm64 - - GOOS=darwin GOARCH=amd64 go build -o gomuks_darwin_amd64 + - git clone https://gitlab.matrix.org/matrix-org/olm.git + - cd olm + - CFLAGS=-static-libgcc CPPFLAGS="-static-libgcc -static-libstdc++" make static + - cp build/libolm.a /usr/lib/ && cp -a include/olm/ /usr/include/ + - cd .. + - go build -ldflags "-linkmode external -extldflags -static" -o gomuks artifacts: paths: - - gomuks_linux_amd64 - - gomuks_linux_386 - - gomuks_linux_arm - - gomuks_linux_arm64 - - gomuks_darwin_amd64 + - gomuks diff --git a/go.mod b/go.mod index acf2930..5691cd4 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( golang.org/x/net v0.0.0-20200505041828-1ed23360d12c gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2 gopkg.in/yaml.v2 v2.2.8 - maunium.net/go/mautrix v0.3.3 + maunium.net/go/mautrix v0.3.4 maunium.net/go/mauview v0.1.1 maunium.net/go/tcell v0.2.0 ) diff --git a/go.sum b/go.sum index d94436a..5a43660 100644 --- a/go.sum +++ b/go.sum @@ -97,6 +97,8 @@ maunium.net/go/mautrix v0.3.2 h1:YLTj8euBTxb118XOryghWpsE/aieFI4lG6jCpCmw5HA= maunium.net/go/mautrix v0.3.2/go.mod h1:SkGZzch8CvU2qKtNpYxtzZ0sQxfVEJ3IsVVLSUBUx9Y= maunium.net/go/mautrix v0.3.3 h1:PV+5oSDaFj3cPTE062O44q/G83x7qfP6gm9kr+BZIgE= maunium.net/go/mautrix v0.3.3/go.mod h1:SkGZzch8CvU2qKtNpYxtzZ0sQxfVEJ3IsVVLSUBUx9Y= +maunium.net/go/mautrix v0.3.4 h1:0X8VPXqG2i1nh/P5J0ZRu8ioed6hwK5SBBEQkUuFb68= +maunium.net/go/mautrix v0.3.4/go.mod h1:SkGZzch8CvU2qKtNpYxtzZ0sQxfVEJ3IsVVLSUBUx9Y= maunium.net/go/mauview v0.1.0 h1:x2WdkKI2zdriJuPAB0CKlwmnHGE7W9xfM5z6RgG+IIg= maunium.net/go/mauview v0.1.0/go.mod h1:og9WbzmWe9SNYNyOFlCv8qa9zMcOvG2nzRJ5vYyud9U= maunium.net/go/mauview v0.1.1 h1:wfTXyPx3LGAGpTskh+UbBv/QItUWnEpaneHmywoYnfY=