Statistics
| Branch: | Tag: | Revision:

orfox / make-release-build @ f02187c1

History | View | Annotate | Download (2.62 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"
56

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

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

    
66
./mach package
67
./mach build-backend -b AndroidEclipse
68

    
69

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

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

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