orfox / make-release-build @ c301999f
History | View | Annotate | Download (2.88 KB)
1 |
#!/bin/bash |
---|---|
2 |
# bash is required because we need bash's printf to guarantee a cross-platform |
3 |
# timestamp format. |
4 |
|
5 |
if [ `dirname $0` != "." ]; then |
6 |
echo "only run this script like ./`basename $0`" |
7 |
exit |
8 |
fi |
9 |
|
10 |
if [ -z $ANDROID_HOME ]; then |
11 |
if [ -e ~/.android/bashrc ]; then |
12 |
. ~/.android/bashrc |
13 |
else |
14 |
echo "ANDROID_HOME must be set!" |
15 |
exit |
16 |
fi |
17 |
fi |
18 |
|
19 |
if [ -z $ANDROID_NDK_HOME ]; then |
20 |
if which ndk-build 2>&1 /dev/null; then |
21 |
ANDROID_NDK_HOME=`which ndk-build | sed 's,/ndk-build,,'` |
22 |
else |
23 |
echo "ANDROID_NDK_HOME not set and 'ndk-build' not in PATH" |
24 |
exit |
25 |
fi |
26 |
fi |
27 |
|
28 |
export NDK_BASE=${ANDROID_NDK_HOME} |
29 |
export SDK_BASE=${ANDROID_SDK_HOME} |
30 |
|
31 |
set -e |
32 |
set -x |
33 |
|
34 |
# standardize timezone to reduce build differences |
35 |
export TZ=UTC |
36 |
# run the clock at 5% speed, ant requires a moving clock |
37 |
TIMESTAMP=`printf '@%(%Y-%m-%d %H:%M:%S)T x0.05' \ |
38 |
$(git log -n1 --format=format:%at)` |
39 |
|
40 |
git reset --hard |
41 |
git clean -fdx |
42 |
git submodule foreach --recursive git reset --hard |
43 |
git submodule foreach --recursive git clean -fdx |
44 |
git submodule sync --recursive |
45 |
git submodule foreach --recursive git submodule sync |
46 |
git submodule update --init --recursive |
47 |
|
48 |
# set the mozconfig to be used |
49 |
export MOZCONFIG=`pwd`"/external/tor-browser/.mozconfig-orfox-release" |
50 |
cp .mozconfig-orfox-release $MOZCONFIG |
51 |
cat external/tor-browser/.mozconfig-orfox >> $MOZCONFIG |
52 |
|
53 |
# Need to add in add-ons before the package step |
54 |
cp -r external/orfox-addons/*.xpi external/tor-browser/mobile/android/orfox/distribution/assets/distribution/extensions/ |
55 |
|
56 |
# switch to gecko dev and build |
57 |
cd external/tor-browser |
58 |
./mach configure |
59 |
./mach build |
60 |
|
61 |
# set the version, the official Mozilla so far has been too hard to figure out... |
62 |
|
63 |
#52.2.0esr-7.0-1 STABLE! |
64 |
export versionName="Fennec-52.2.0esr/TorBrowser-7.0-1/Orfox-1.4-RC-2" |
65 |
export versionCode="9" |
66 |
sed -i "s,versionName=\"[^\"]*\",versionName=\"$versionName\"," obj-tbb-arm-linux-androideabi/mobile/android/base/AndroidManifest.xml |
67 |
sed -i "s,versionCode=\"[^\"]*\",versionCode=\"$versionCode\"," obj-tbb-arm-linux-androideabi/mobile/android/base/AndroidManifest.xml |
68 |
|
69 |
./mach package |
70 |
./mach build-backend -b AndroidEclipse |
71 |
|
72 |
# make sure we're on a signed tag that matches the version name |
73 |
describe=`git describe --always` |
74 |
if [ $versionName != $describe ]; then |
75 |
echo "WARNING: building $describe, which is not the latest release ($versionName)" |
76 |
else |
77 |
# make a clearer warning above by putting this here |
78 |
set +x |
79 |
echo "" |
80 |
echo "" |
81 |
echo "Checking git tag signature for release build:" |
82 |
git tag -v $versionName |
83 |
echo "" |
84 |
echo "" |
85 |
set -x |
86 |
fi |
87 |
|
88 |
built=`ls -1 obj-tbb-*-linux-*/dist/fennec-*-unsigned-unaligned.apk` |
89 |
apk="Orfox-$describe.apk" |
90 |
cp $built $apk |
91 |
|
92 |
if which gpg > /dev/null; then |
93 |
if [ -z "`gpg --list-secret-keys`" ]; then |
94 |
echo "No GPG secret keys found, not signing APK" |
95 |
else |
96 |
gpg --detach-sign $apk |
97 |
fi |
98 |
else |
99 |
echo "gpg not found, not signing APK" |
100 |
fi |