-
Notifications
You must be signed in to change notification settings - Fork 16
/
make-aar
executable file
·75 lines (64 loc) · 1.93 KB
/
make-aar
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
#
# Copyright (c) 2021 RethinkDNS and its authors.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
set -eux
# refs:
# github.com/Stremio/vlc-android-sdk/blob/d8ab13e/prepare-aar
# gitlab.com/fdroid/fdroiddata/-/blob/81c14003f/metadata/com.tailscale.ipn.yml
# gitlab.com/fdroid/fdroiddata/-/blob/d6c5315a/metadata/org.calyxinstitute.vpn.yml
# defaults; can be overridden for ex by jitpack.yml
PACK="${PACK:-aar}"
# final out
FOUT="${FOUT:-firestack.aar}"
FOUTDBG="${FOUTDBG:-firestack-debug.aar}"
# build out
BOUT="${BOUT:-build/intra/tun2socks.aar}"
BOUTDBG="${BOUTDBG:-build/intra/tun2socks-debug.aar}"
# artifact classifier
CLASSFULL="${CLASSFULL:-full}" # unused
CLASSDBG="${CLASSDBG:-debug}"
# artifact bytecode sources
SOURCES="${SOURCES:-build/intra/tun2socks-sources.jar}"
ARG1="${1:-go}"
ARG2="${2:-debug}"
# debug
printenv
ls -ltr $ANDROID_HOME/**
if [ "$ARG1" = "go" ]; then
# download from go.dev/dl
curl -Lso go.tar.gz https://go.dev/dl/go1.23.2.linux-amd64.tar.gz
echo "542d3c1705f1c6a1c5a80d5dc62e2e45171af291e755d591c5e6531ef63b454e go.tar.gz" | sha256sum -c -
# HOME=/home/jitpack
# PWD=/home/jitpack/build
# setup go, /opt isn't writeable
export GOPATH="$HOME/golang"
mkdir -p $GOPATH
# golang in pwd confuses "go mod", as firestack source is in the same dir
tar -C $GOPATH -xzf go.tar.gz
export GO_LANG="$GOPATH/go/bin"
export GO_COMPILED="$GOPATH/bin"
export PATH="$GO_LANG:$GO_COMPILED:$PATH"
fi
# go debug
go version
go env
# checkout tagged branch?
# git checkout -b "$VERSION"
# gomobile aar
if [ "$ARG2" = "debug" ]; then
# default: with debug builds
make clean && make intra && make intradebug
# rename
mv ./"$BOUT" ./"$FOUT"
mv ./"$BOUTDBG" ./"$FOUTDBG"
else
make clean && make intra
# rename
mv ./"$BOUT" ./"$FOUT"
fi
# ls cwd
ls -ltr