passforios/gopenpgp_build.sh

27 lines
724 B
Bash
Raw Normal View History

2019-06-06 18:07:39 +02:00
#!/bin/bash
2019-08-19 23:40:17 +02:00
set -euox pipefail
2019-06-06 18:07:39 +02:00
2019-08-19 23:40:17 +02:00
export GOPATH="$(pwd)/go"
export PATH="$PATH:$GOPATH/bin"
2019-06-06 18:07:39 +02:00
PACKAGE_PATH="github.com/mssun/gopenpgp"
GOPENPGP_REVISION="gnu-dummy"
OUTPUT_PATH="$GOPATH/dist"
mkdir -p "$GOPATH"
2019-08-19 23:40:17 +02:00
go get -u golang.org/x/mobile/cmd/gomobile || true
2020-04-11 23:23:38 -07:00
gomobile init
go get -u "$PACKAGE_PATH" || true
2019-06-06 18:07:39 +02:00
mkdir -p "$GOPATH/src/github.com/ProtonMail"
ln -s "$GOPATH/src/$PACKAGE_PATH" "$GOPATH/src/github.com/ProtonMail/gopenpgp"
2019-06-06 18:07:39 +02:00
2019-11-08 21:17:53 +01:00
( cd "$GOPATH/src/$PACKAGE_PATH" && git checkout "$GOPENPGP_REVISION" && GO111MODULE=on go mod vendor )
2019-06-06 18:07:39 +02:00
2019-08-19 23:40:17 +02:00
mkdir -p "$OUTPUT_PATH"
2020-04-12 18:24:03 -07:00
"$GOPATH/bin/gomobile" bind -v -ldflags="-s -w" -target ios -o "${OUTPUT_PATH}/Crypto.framework" \
2019-08-19 23:40:17 +02:00
"$PACKAGE_PATH"/{crypto,armor,constants,models,subtle}