-
Notifications
You must be signed in to change notification settings - Fork 1
/
abrowser_build_apk
executable file
·150 lines (119 loc) · 3.74 KB
/
abrowser_build_apk
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/bin/bash
#
# Copyright (C) 2018, 2019 Yaroslav Pronin <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Build steps
#
# 1. Read comments in this script and change it
# for the selected build target (ARM, ARM64, x86, x86_64).
# 2. Run script, source tarball will be downloaded and
# unpacked automatically.
# 3. Follow the steps of the build system; choose
# "3. GeckoView/Abrowser for Android Artifact Mode" when prompted.
# 4. Generated APK will be located in BUILD_DIR/obj-droid/dist.
BASE_URL="http:https://archive.trisquel.info/trisquel/pool/main/f/firefox/"
TAR_NAME="firefox_67.0+build2-0ubuntu0.16.04.1+8.0trisquel62.tar.gz"
BUILD_DIR=build
# For `make`
CPU_CORES=6
# Notes:
# For new build on computer, run in terminal:
# rustup target add ARCH
# For x86/x86_64 target please install r17 manually from
# https://developer.android.com/ndk/downloads/
# and copy it to .mozbuild
# Uncomment for ARM build
ARCH=arm-linux-androideabi
NDK_VER="r15c"
# Uncomment for ARM64 build
#ARCH=aarch64-linux-android
#NDK_VER="r15c"
# Uncomment for x86 build
#ARCH=i686-linux-android
#NDK_VER="r17c"
# Uncomment for x86_64 build
#ARCH=x86_64-linux-android
#NDK_VER="r17c"
# For building
OBJ_DIR=objdir-droid
#==============================================================#
if [ ! -d $BUILD_DIR ]; then
mkdir $BUILD_DIR
wget "$BASE_URL$TAR_NAME" && \
tar zxf $TAR_NAME -C $BUILD_DIR --strip-components 1 && \
rm $TAR_NAME
cd $BUILD_DIR
# Patches
for p in debian/patches/*
do
patch -Np1 -i $p
done
for p in ../patches/*
do
patch -Np1 -i $p
done
# Fix branding
# (temporarily before applying patch
# https://devel.trisquel.info/trisquel/package-helpers/merge_requests/213)
cp -a ../patches/branding/res/* mobile/android/branding/official/res/
# End fix branding
cd ..
fi
cd $BUILD_DIR
# Remove previous build
if [ -d $OBJ_DIR ]; then
rm -rf $OBJ_DIR
fi
./mach bootstrap
# Mozconfig
cat > mozconfig <<END
# Build Firefox for Android:
export MOZ_INSTALL_TRACKING=
export MOZ_NATIVE_DEVICES=
ac_add_options --enable-application=mobile/android
ac_add_options --target=$ARCH
# With the following Android SDK and NDK:
ac_add_options --with-android-sdk="$HOME/.mozbuild/android-sdk-linux"
ac_add_options --with-android-ndk="$HOME/.mozbuild/android-ndk-$NDK_VER"
# Write build artifacts to:
mk_add_options MOZ_OBJDIR="./$OBJ_DIR"
# Build options
ac_add_options --enable-official-branding
ac_add_options --with-distribution-id=org.gnu
#ac_add_options --disable-eme
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --disable-updater
ac_add_options --disable-crashreporter
ac_add_options --without-google-play-services
# Use ccache
ac_add_options --with-ccache
mk_add_options MOZ_MAKE_FLAGS=-j$(($CPU_CORES + 1))
END
if [ $ARCH != "aarch64-linux-android" ]; then
cat <<END >> mozconfig
# Remove for ARM64
ac_add_options --disable-elf-hack
END
fi
if [[ $NDK_VER == *"r17"* ]]; then
cat <<END >> mozconfig
# For NDK r17
export LDFLAGS="-Wno-error=tautological-constant-compare"
END
fi
./mach build && ./mach package