Statistics
| Branch: | Tag: | Revision:

orfox / make-release-build @ 250982e6

History | View | Annotate | Download (2.74 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}-r8e
29
if [ ! -e $NDK_BASE ]; then
30
    echo "Mozilla requires the use of Android NDK r8e only"
31
    echo "This script expects it at $NDK_BASE"
32
    exit 1
33
fi
34

    
35
set -e
36
set -x
37

    
38
# standardize timezone to reduce build differences
39
export TZ=UTC
40
# run the clock at 5% speed, ant requires a moving clock
41
TIMESTAMP=`printf '@%(%Y-%m-%d %H:%M:%S)T x0.05' \
42
    $(git log -n1 --format=format:%at)`
43

    
44

    
45
git reset --hard
46
git clean -fdx
47
git submodule foreach --recursive git reset --hard
48
git submodule foreach --recursive git clean -fdx
49
git submodule sync --recursive
50
git submodule foreach --recursive git submodule sync
51
git submodule update --init --recursive
52

    
53
# set the mozconfig to be used
54
cd $WORKSPACE
55
export MOZCONFIG="$WORKSPACE/external/tor-browser/.mozconfig-orfox-release"
56
cp $WORKSPACE/.mozconfig-orfox-release $MOZCONFIG
57
cat $WORKSPACE/external/tor-browser/.mozconfig-orfox >> $MOZCONFIG
58

    
59
# switch to gecko dev and build
60
cd external/tor-browser
61
./mach configure
62
./mach build
63

    
64
# Need to add in add-ons before the package step
65
mkdir -p obj-tbb-arm-linux-androideabi/dist/bin/distribution/extensions/
66
cp -r $WORKSPACE/external/orfox-addons/* obj-tbb-arm-linux-androideabi/dist/bin/distribution/extensions/
67

    
68
./mach package
69
./mach build-backend -b AndroidEclipse
70

    
71

    
72
# make sure we're on a signed tag that matches the version name
73
versionName=`sed -n 's,.*versionName="\([^"]*\)".*,\1,p' obj-tbb-arm-linux-androideabi/mobile/android/base/AndroidManifest.xml`
74
describe=`git describe --always`
75
if [ $versionName != $describe ]; then
76
    echo "WARNING: building $describe, which is not the latest release ($versionName)"
77
else
78
    # make a clearer warning above by putting this here
79
    set +x
80
    echo ""
81
    echo ""
82
    echo "Checking git tag signature for release build:"
83
    git tag -v $versionName
84
    echo ""
85
    echo ""
86
    set -x
87
fi
88

    
89
built=`ls -1 obj-tbb-*-linux-*/dist/fennec-*.apk`
90
apk="Orfox-$describe.apk"
91
cp $built $apk
92

    
93
if which gpg > /dev/null; then
94
    if [ -z "`gpg --list-secret-keys`" ]; then
95
        echo "No GPG secret keys found, not signing APK"
96
else
97
        gpg --detach-sign $apk
98
    fi
99
else
100
    echo "gpg not found, not signing APK"
101
fi