[tbb-commits] [tor-browser-build/master] Bug 27210: Add support for x86 on Android

boklm at torproject.org boklm at torproject.org
Tue Mar 5 20:48:19 UTC 2019


commit f4b5f7b3b38679456d97b71904b0c59d4e4600d9
Author: Georg Koppen <gk at torproject.org>
Date:   Fri Feb 8 10:49:13 2019 +0000

    Bug 27210: Add support for x86 on Android
---
 Makefile                               | 15 +++++++++++
 projects/android-toolchain/build       | 10 +++++--
 projects/firefox/config                |  2 +-
 projects/firefox/mozconfig-android-x86 | 48 ++++++++++++++++++++++++++++++++++
 projects/orbot/build                   |  7 ++++-
 projects/orbot/config                  |  2 +-
 projects/release/build                 |  3 +++
 projects/release/config                | 11 ++++++++
 projects/rust/build                    |  5 +++-
 projects/rust/config                   | 12 ++++++---
 projects/tor-browser/config            |  2 +-
 rbm.conf                               | 15 ++++++++++-
 12 files changed, 121 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index 8ec5d0c..d419422 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,9 @@ release: submodule-update
 release-android-armv7: submodule-update
 	$(rbm) build release --target release --target torbrowser-android-armv7
 
+release-android-x86: submodule-update
+	$(rbm) build release --target release --target torbrowser-android-x86
+
 release-linux-x86_64: submodule-update
 	$(rbm) build release --target release --target torbrowser-linux-x86_64
 
@@ -32,6 +35,9 @@ alpha: submodule-update
 alpha-android-armv7: submodule-update
 	$(rbm) build release --target alpha --target torbrowser-android-armv7
 
+alpha-android-x86: submodule-update
+	$(rbm) build release --target alpha --target torbrowser-android-x86
+
 alpha-linux-x86_64: submodule-update
 	$(rbm) build release --target alpha --target torbrowser-linux-x86_64
 
@@ -56,6 +62,9 @@ nightly: submodule-update
 nightly-android-armv7: submodule-update
 	$(rbm) build release --target nightly --target torbrowser-android-armv7
 
+nightly-android-x86: submodule-update
+	$(rbm) build release --target nightly --target torbrowser-android-x86
+
 nightly-linux-x86_64: submodule-update
 	$(rbm) build release --target nightly --target torbrowser-linux-x86_64
 
@@ -80,6 +89,9 @@ alpha_nightly: submodule-update
 alpha_nightly-android-armv7: submodule-update
 	$(rbm) build release --target alpha_nightly --target torbrowser-android-armv7
 
+alpha_nightly-android-x86: submodule-update
+	$(rbm) build release --target alpha_nightly --target torbrowser-android-x86
+
 alpha_nightly-linux-x86_64: submodule-update
 	$(rbm) build release --target alpha_nightly --target torbrowser-linux-x86_64
 
@@ -101,6 +113,9 @@ testbuild: submodule-update
 testbuild-android-armv7: submodule-update
 	$(rbm) build release --target testbuild --target torbrowser-android-armv7
 
+testbuild-android-x86: submodule-update
+	$(rbm) build release --target testbuild --target torbrowser-android-x86
+
 testbuild-linux-x86_64: submodule-update
 	$(rbm) build release --target testbuild --target torbrowser-linux-x86_64
 
diff --git a/projects/android-toolchain/build b/projects/android-toolchain/build
index a9d3139..ff899d2 100644
--- a/projects/android-toolchain/build
+++ b/projects/android-toolchain/build
@@ -17,8 +17,14 @@ unzip -qq [% c("input_files_by_name/gradle_bin") %] -d $GRADLE_HOME
 cd $NDK_HOME
 mv android-ndk-r15c/* .
 rm -fR android-ndk-r15c
-# API 16 is the minimum we currently support for Tor Browser on Android
-./build/tools/make_standalone_toolchain.py --api 16 --arch arm --install-dir=./arm
+
+# The architectures we support
+archs="arm x86"
+for arch in $archs; do
+  # API 16 is the minimum we currently support for Tor Browser on Android for
+  # 32bit.
+  ./build/tools/make_standalone_toolchain.py --api 16 --arch $arch --install-dir=./$arch
+done
 
 # Tool Archives
 cd $SDK_HOME
diff --git a/projects/firefox/config b/projects/firefox/config
index 68f2326..4d68969 100644
--- a/projects/firefox/config
+++ b/projects/firefox/config
@@ -41,7 +41,7 @@ targets:
       torbrowser_update_channel: default
       branding_directory: browser/branding/nightly
 
-  android-armv7:
+  android:
     var:
       arch_deps:
         - openjdk-8-jdk
diff --git a/projects/firefox/mozconfig-android-x86 b/projects/firefox/mozconfig-android-x86
new file mode 100644
index 0000000..1fe0b93
--- /dev/null
+++ b/projects/firefox/mozconfig-android-x86
@@ -0,0 +1,48 @@
+mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-i386-linux-android
+mk_add_options MOZ_APP_DISPLAYNAME="Tor Browser"
+export MOZILLA_OFFICIAL=1
+
+ac_add_options --enable-optimize
+ac_add_options --enable-official-branding
+
+ac_add_options --enable-application=mobile/android
+ac_add_options --target=i386-linux-android
+ac_add_options --with-android-ndk=/var/tmp/dist/android-toolchain/android-ndk
+ac_add_options --with-android-sdk=/var/tmp/dist/android-toolchain/android-sdk-linux
+ac_add_options --with-gradle=/var/tmp/dist/android-toolchain/gradle/gradle-4.1/bin/gradle
+ac_add_options --with-android-version=16
+ac_add_options --with-branding=mobile/android/branding/torbrowser
+
+# Android NDK does not contain llvm-config so set clang path in options
+ac_add_options --with-libclang-path=/var/tmp/dist/android-toolchain/android-ndk/x86/lib64
+ac_add_options --with-clang-path=/var/tmp/dist/android-toolchain/android-ndk/x86/bin/clang
+
+ac_add_options --with-android-distribution-directory=@TOPSRCDIR@/mobile/android/torbrowser
+ac_add_options --with-l10n-base=/var/tmp/dist/locales
+
+if [ -z "${TB_BUILD_WITH_UPDATER}" ]; then
+# Because Google Play will likely be the primary distribution medium,
+# we disable updating and rely on Google Play by default. The
+# Developer Policy explicitly prohibits in-app updating:
+#    An app distributed via Google Play may not modify, replace, or
+#    update itself using any method other than Google Plays update
+#    mechanism.
+# https://play.google.com/about/privacy-security-deception/malicious-behavior/
+
+    ac_add_options --disable-tor-browser-update
+    ac_add_options --disable-signmar
+    ac_add_options --disable-verify-mar
+fi
+
+ac_add_options --enable-strip
+ac_add_options --disable-tests
+ac_add_options --disable-debug
+ac_add_options --disable-rust-debug
+ac_add_options --disable-maintenance-service
+ac_add_options --disable-crashreporter
+ac_add_options --disable-webrtc
+
+ac_add_options --without-google-play-services
+
+# Let's make sure no preference is enabling either Adobe's or Google's CDM.
+ac_add_options --disable-eme
diff --git a/projects/orbot/build b/projects/orbot/build
index 4e222a9..22667b5 100644
--- a/projects/orbot/build
+++ b/projects/orbot/build
@@ -23,7 +23,12 @@ done
 # Build OrbotService Native Libraries
 pushd /var/tmp/build/[% project %]-[% c('version') %]/orbotservice/src/main
 /var/tmp/dist/android-toolchain/android-ndk/ndk-build
-mv libs/armeabi-v7a/pdnsd libs/armeabi-v7a/pdnsd.so
+[% IF c("var/android-armv7") %]
+  arch=armeabi-v7a
+[% ELSE %]
+  arch=x86
+[% END %]
+mv libs/$arch/pdnsd libs/$arch/pdnsd.so
 popd
 
 # Build Android Libraries and Apps
diff --git a/projects/orbot/config b/projects/orbot/config
index 1bedbdb..5ad5bfc 100644
--- a/projects/orbot/config
+++ b/projects/orbot/config
@@ -24,7 +24,7 @@ var:
   gradle_dependencies_version: 1
 
 targets:
-  android-armv7:
+  android:
     var:
       arch_deps:
         - openjdk-8-jdk
diff --git a/projects/release/build b/projects/release/build
index cf190a6..ca7b26d 100644
--- a/projects/release/build
+++ b/projects/release/build
@@ -7,6 +7,9 @@ mkdir -p "$destdir"
 [% IF c("var/torbrowser-android-armv7") -%]
   mv [% c('input_files_by_name/android-armv7') %]/* "$destdir"/
 [% END -%]
+[% IF c("var/torbrowser-android-x86") -%]
+  mv [% c('input_files_by_name/android-x86') %]/* "$destdir"/
+[% END -%]
 [% IF c("var/torbrowser-windows-i686") -%]
   mv [% c('input_files_by_name/windows-i686') %]/* "$destdir"/
   mv [% c('input_files_by_name/windows-expert-bundle') %]/* "$destdir"/
diff --git a/projects/release/config b/projects/release/config
index 65e297d..1a742ac 100644
--- a/projects/release/config
+++ b/projects/release/config
@@ -15,9 +15,13 @@ targets:
     - torbrowser-windows-x86_64
     - torbrowser-osx-x86_64
     - torbrowser-android-armv7
+    - torbrowser-android-x86
   torbrowser-android-armv7:
     var:
       torbrowser-android-armv7: 1
+  torbrowser-android-x86:
+    var:
+      torbrowser-android-x86: 1
   torbrowser-linux-x86_64:
     var:
       torbrowser-linux-x86_64: 1
@@ -91,6 +95,13 @@ input_files:
      - '[% c("var/build_target") %]'
      - torbrowser-android-armv7
 
+ - name: android-x86
+   project: tor-browser
+   enable: '[% c("var/torbrowser-android-x86") %]'
+   target:
+     - '[% c("var/build_target") %]'
+     - torbrowser-android-x86
+
  - name: linux-x86_64
    project: tor-browser
    enable: '[% c("var/torbrowser-linux-x86_64") %]'
diff --git a/projects/rust/build b/projects/rust/build
index 3c1d130..0df84a1 100644
--- a/projects/rust/build
+++ b/projects/rust/build
@@ -67,8 +67,11 @@ cd /var/tmp/build/rustc-[% c('version') %]-src
 [% END %]
 
 [% IF c("var/android") %]
-  patch -p1 < $rootdir/0001-Make-sure-dl_iterate_phdr-is-undefined-on-Android.patch
   patch -p1 < $rootdir/replace_pagesize_in_mmap.patch
+  # The additional Rust patch is not necessary for x86.
+  [% IF c("var/android-armv7") %]
+    patch -p1 < $rootdir/0001-Make-sure-dl_iterate_phdr-is-undefined-on-Android.patch
+  [% END %]
 [% END %]
 
 mkdir build
diff --git a/projects/rust/config b/projects/rust/config
index 48912ab..3d78ad3 100644
--- a/projects/rust/config
+++ b/projects/rust/config
@@ -15,15 +15,21 @@ var:
     use_container: 1
 
 targets:
-  android-armv7:
+  android:
     var:
       rust_arch: x86_64
       arch_deps:
         - libssl-dev
         - pkg-config
         - zlib1g-dev
+  android-armv7:
+    var:
       configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --target=armv7-linux-androideabi --set=target.armv7-linux-androideabi.cc=$ANDROID_NDK_HOME/arm/bin/arm-linux-androideabi-gcc
 
+  android-x86:
+    var:
+      configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --target=i686-linux-android --set=target.i686-linux-android.cc=$ANDROID_NDK_HOME/x86/bin/i686-linux-android-gcc
+
   linux:
     var:
       arch_deps:
@@ -92,7 +98,7 @@ input_files:
     enable: '[% c("var/windows-i686") && !c("input_file_var/unwind_128") %]'
   - filename: unwind_128.patch
     enable: '[% c("input_file_var/unwind_128") %]'
-  - filename: 0001-Make-sure-dl_iterate_phdr-is-undefined-on-Android.patch
-    enable: '[% c("var/android") %]'
   - filename: replace_pagesize_in_mmap.patch
     enable: '[% c("var/android") %]'
+  - filename: 0001-Make-sure-dl_iterate_phdr-is-undefined-on-Android.patch
+    enable: '[% c("var/android-armv7") %]'
diff --git a/projects/tor-browser/config b/projects/tor-browser/config
index c4f25ff..9b26bc8 100644
--- a/projects/tor-browser/config
+++ b/projects/tor-browser/config
@@ -41,7 +41,7 @@ targets:
   windows-x86_64:
     var:
       mar_osname: win64
-  android-armv7:
+  android:
     build: '[% INCLUDE build.android %]'
     var:
       arch_deps:
diff --git a/rbm.conf b/rbm.conf
index 03c105e..1b82e60 100644
--- a/rbm.conf
+++ b/rbm.conf
@@ -159,11 +159,23 @@ targets:
 
   torbrowser-android-armv7:
     - android-armv7
+    - android
   android-armv7:
     arch: armv7
     var:
-      android: 1
+      android-armv7: 1
       osname: android-armv7
+  torbrowser-android-x86:
+    - android-x86
+    - android
+  android-x86:
+    arch: x86
+    var:
+      android-x86: 1
+      osname: android-x86
+  android:
+    var:
+      android: 1
       compiler: android-toolchain
       snowflake: 0
       fteproxy: 0
@@ -178,6 +190,7 @@ targets:
         - libtool
         - zip
         - unzip
+
   torbrowser-linux-x86_64:
     - linux-x86_64
     - linux





More information about the tbb-commits mailing list