forked from guardianproject/Orfox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-release-build
executable file
·100 lines (84 loc) · 2.93 KB
/
make-release-build
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
# bash is required because we need bash's printf to guarantee a cross-platform
# timestamp format.
if [ `dirname $0` != "." ]; then
echo "only run this script like ./`basename $0`"
exit
fi
if [ -z $ANDROID_HOME ]; then
if [ -e ~/.android/bashrc ]; then
. ~/.android/bashrc
else
echo "ANDROID_HOME must be set!"
exit
fi
fi
if [ -z $ANDROID_NDK_HOME ]; then
if which ndk-build 2>&1 /dev/null; then
ANDROID_NDK_HOME=`which ndk-build | sed 's,/ndk-build,,'`
else
echo "ANDROID_NDK_HOME not set and 'ndk-build' not in PATH"
exit
fi
fi
export NDK_BASE=${ANDROID_NDK_HOME}
export SDK_BASE=${ANDROID_SDK_HOME}
set -e
set -x
# standardize timezone to reduce build differences
export TZ=UTC
# run the clock at 5% speed, ant requires a moving clock
TIMESTAMP=`printf '@%(%Y-%m-%d %H:%M:%S)T x0.05' \
$(git log -n1 --format=format:%at)`
git reset --hard
git clean -fdx
git submodule foreach --recursive git reset --hard
git submodule foreach --recursive git clean -fdx
git submodule sync --recursive
git submodule foreach --recursive git submodule sync
git submodule update --init --recursive
# set the mozconfig to be used
export MOZCONFIG=`pwd`"/external/tor-browser/.mozconfig-orfox-release"
cp .mozconfig-orfox-release $MOZCONFIG
cat external/tor-browser/.mozconfig-orfox >> $MOZCONFIG
# Need to add in add-ons before the package step
mkdir -p external/tor-browser/mobile/android/distribution/orfox/assets/distribution/extensions
cp -r external/orfox-addons/*.xpi external/tor-browser/mobile/android/distribution/orfox/assets/distribution/extensions
# switch to gecko dev and build
cd external/tor-browser
./mach configure
./mach build
# set the version, the official Mozilla so far has been too hard to figure out...
export versionName="Fennec-45.5.1esr/TorBrowser-6.5-1/Orfox-1.3-alpha1"
export versionCode="5"
sed -i "s,versionName=\"[^\"]*\",versionName=\"$versionName\"," obj-tbb-arm-linux-androideabi/mobile/android/base/AndroidManifest.xml
sed -i "s,versionCode=\"[^\"]*\",versionCode=\"$versionCode\"," obj-tbb-arm-linux-androideabi/mobile/android/base/AndroidManifest.xml
./mach package
./mach build-backend -b AndroidEclipse
# make sure we're on a signed tag that matches the version name
describe=`git describe --always`
if [ $versionName != $describe ]; then
echo "WARNING: building $describe, which is not the latest release ($versionName)"
else
# make a clearer warning above by putting this here
set +x
echo ""
echo ""
echo "Checking git tag signature for release build:"
git tag -v $versionName
echo ""
echo ""
set -x
fi
built=`ls -1 obj-tbb-*-linux-*/dist/fennec-*.apk`
apk="Orfox-$describe.apk"
cp $built $apk
if which gpg > /dev/null; then
if [ -z "`gpg --list-secret-keys`" ]; then
echo "No GPG secret keys found, not signing APK"
else
gpg --detach-sign $apk
fi
else
echo "gpg not found, not signing APK"
fi