[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser-build/master] Bug 33557: Update Android toolchain for Fenix



commit 983cb3322d6b99521aef714babfcaaadac511eab
Author: Georg Koppen <gk@xxxxxxxxxxxxxx>
Date:   Thu Jun 11 09:25:16 2020 +0000

    Bug 33557: Update Android toolchain for Fenix
    
    Based on a patch by sisbell, thanks!
    
    We add a new project to not interfere with Fennec toolchain
    requirements for now until we stop building Fennec-based Tor Browser
    for Android.
---
 projects/fenix-android-toolchain/build  | 72 +++++++++++++++++++++++++++++++++
 projects/fenix-android-toolchain/config | 70 ++++++++++++++++++++++++++++++++
 2 files changed, 142 insertions(+)

diff --git a/projects/fenix-android-toolchain/build b/projects/fenix-android-toolchain/build
new file mode 100644
index 0000000..1135ed4
--- /dev/null
+++ b/projects/fenix-android-toolchain/build
@@ -0,0 +1,72 @@
+#!/bin/bash
+[% c("var/set_default_env") -%]
+export PROJECT_PATH=/var/tmp/dist/[% project %]
+export SDK_HOME=$PROJECT_PATH/android-sdk-linux
+export NDK_HOME=$PROJECT_PATH/android-ndk
+export GRADLE_HOME=$PROJECT_PATH/gradle
+android_release_dir=android-10
+android_release_dir_old=android-9
+
+# Make directories
+mkdir -p $NDK_HOME $SDK_HOME $GRADLE_HOME
+
+# Compiler Archives
+unzip -qq [% c("input_files_by_name/android_sdk_tools") %] -d $SDK_HOME
+unzip -qq [% c("input_files_by_name/android_ndk_compiler")%] -d $NDK_HOME
+# GeckoView is still using an older Android NDK, bundle it, too.
+unzip -qq [% c("input_files_by_name/android_ndk_compiler_old")%] -d $NDK_HOME
+unzip -qq [% c("input_files_by_name/gradle_bin") %] -d $GRADLE_HOME
+# GeckoView is still using an older Gradle, bundle it, too.
+unzip -qq [% c("input_files_by_name/gradle_bin_old") %] -d $GRADLE_HOME
+# application-services is using a comparatively new Gradle, bundle it, too.
+unzip -qq [% c("input_files_by_name/gradle_bin_new") %] -d $GRADLE_HOME
+
+# NDK Archive
+for version in [% c("var/android_ndk_version") %][% c("var/android_ndk_revision") %] [% c("var/android_ndk_version_old") %]; do
+  cd $NDK_HOME
+  # Adjust cross compilation prefix for armv7a. Unfortunately, the compiler cross
+  # compilation prefix and the one for all the other tools differ. Let's fix that
+  # so we only have to take care of one. See: #33557 (comment 2674649).
+  cd android-ndk-r$version/toolchains/llvm/prebuilt/linux-x86_64/bin
+  for f in `ls arm-linux-androideabi-*`; do
+    ln -s $f ${f//arm-linux-androideabi/armv7a-linux-androideabi}
+  done
+done
+
+# Tool Archives
+cd $SDK_HOME
+unzip -qq $HOME/[% c("input_files_by_name/build_tools") %] -d $SDK_HOME
+mkdir -p build-tools/[% c("version") %]
+mv $android_release_dir/* build-tools/[% c("version") %]
+
+# Fenix has not updated to build-tools 29 yet, bundle therefore build-tools 28,
+# too.
+unzip -qq $HOME/[% c("input_files_by_name/build_tools_old") %] -d $SDK_HOME
+mkdir -p build-tools/[% c("version_old") %]
+mv $android_release_dir_old/* build-tools/[% c("version_old") %]
+
+unzip -qq $HOME/[% c("input_files_by_name/platform") %] -d $SDK_HOME
+mkdir -p platforms/android-[% c("var/android_api_level") %]
+mv $android_release_dir/* platforms/android-[% c("var/android_api_level") %]
+
+# Fenix has not updated to Android 29 yet, bundle therefore Android 28, too.
+unzip -qq $HOME/[% c("input_files_by_name/platform_old") %] -d $SDK_HOME
+mkdir -p platforms/android-[% c("var/android_api_level_old") %]
+mv $android_release_dir_old/* platforms/android-[% c("var/android_api_level_old") %]
+
+unzip -qq $HOME/[% c("input_files_by_name/platform_tools") %] -d $SDK_HOME
+
+# That's a quirk required by GeckoView but let's have it here instead of in the
+# project's build script
+mkdir emulator
+cp tools/emulator emulator/
+
+# Cleanup
+rm -fR $android_release_dir $android_release_dir_old
+
+# Archive dist directory
+cd /var/tmp/dist
+[% c('tar', {
+        tar_src => [ project ],
+        tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
+        }) %]
diff --git a/projects/fenix-android-toolchain/config b/projects/fenix-android-toolchain/config
new file mode 100644
index 0000000..c01ca91
--- /dev/null
+++ b/projects/fenix-android-toolchain/config
@@ -0,0 +1,70 @@
+# vim: filetype=yaml sw=2
+filename: '[% project %]-[% c("version") %]-[% c("version_old") %]-[% c("var/build_id") %].tar.gz'
+version: 29.0.3
+version_old: 28.0.3
+var:
+  container:
+    use_container: 1
+  deps:
+    - unzip
+    - python
+  setup: |
+    mkdir -p /var/tmp/dist
+    tar -C /var/tmp/dist -xf $rootdir/[% c("compiler_tarfile") %]
+    export ANDROID_SDK_HOME=/var/tmp/dist/[% project %]/android-sdk-linux
+    # By default we use the old NDK which is the one GeckoView is using.
+    # However, we can overwrite that per project if needed (e.g.
+    # application-services is currently on a newer NDK).
+    export ANDROID_NDK_HOME=/var/tmp/dist/[% project %]/android-ndk/android-ndk-r[% c("var/android_ndk_version_old") %]
+    export GRADLE_HOME=/var/tmp/dist/[% project %]/gradle
+    export ANDROID_HOME=$ANDROID_SDK_HOME
+    export GRADLE_USER_HOME=$GRADLE_HOME
+    export PATH=$PATH:$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$GRADLE_HOME/gradle-[% c("var/gradle_version") %]/bin
+  google_repo: https://dl.google.com/android/repository
+  android_api_level: 29
+  android_api_level_old: 28
+  android_platform_revision: 04
+  android_ndk_version: 21
+  android_ndk_version_old: 20
+  android_ndk_revision: d
+  gradle_version_new: 6.3
+  gradle_version: 5.6.4
+  gradle_version_old: 5.1.1
+input_files:
+  - project: container-image
+  - URL: '[% c("var/google_repo") %]/build-tools_r[% c("version") %]-linux.zip'
+    name: build_tools
+    sha256sum: 5652d8cd5eaaade0b853bfe0ae6cbfa0706a6f70a0ebb25ca24a6f484ec3d855
+  - URL: '[% c("var/google_repo") %]/build-tools_r[% c("version_old") %]-linux.zip'
+    name: build_tools_old
+    sha256sum: 7954956a40633c88f693d638cbc23f68e9e2499dc7a4b7dfdaf6a3e91387749a
+  - URL: '[% c("var/google_repo") %]/platform-[% c("var/android_api_level") %]_r[% c("var/android_platform_revision") %].zip'
+    name: platform
+    sha256sum: c9eaf2ce4e8fa6f5a8036bd3c95363d003733bf0a1bd349718cadf802db44c69
+  - URL: '[% c("var/google_repo") %]/platform-[% c("var/android_api_level_old") %]_r[% c("var/android_platform_revision") %].zip'
+    name: platform_old
+    sha256sum: 967f8ca99b71d337aa9c7781f9d65dd8110bf5c4746f44304047bf71b20d0ded
+  # ./mach bootstrap is fetching the latest version, so it does not seem to
+  # matter which particular version we are using. Pin to the one fitting best to
+  # SDK version/build-tools version.
+  - URL: '[% c("var/google_repo") %]/platform-tools_r[% c("version") %]-linux.zip'
+    name: platform_tools
+    sha256sum: 49e676ec90bff1f7d7dfe4fb7d0ab78e14fa8fb06a8dccca2ef57a1bc29497a0
+  - URL: '[% c("var/google_repo") %]/sdk-tools-linux-4333796.zip'
+    name: android_sdk_tools
+    sha256sum: 92ffee5a1d98d856634e8b71132e8a95d96c83a63fde1099be3d86df3106def9
+  - URL: '[% c("var/google_repo") %]/android-ndk-r[% c("var/android_ndk_version") %][% c("var/android_ndk_revision") %]-linux-x86_64.zip'
+    name: android_ndk_compiler
+    sha256sum: dd6dc090b6e2580206c64bcee499bc16509a5d017c6952dcd2bed9072af67cbd
+  - URL: '[% c("var/google_repo") %]/android-ndk-r[% c("var/android_ndk_version_old") %]-linux-x86_64.zip'
+    name: android_ndk_compiler_old
+    sha256sum: 57435158f109162f41f2f43d5563d2164e4d5d0364783a9a6fab3ef12cb06ce0
+  - URL: https://services.gradle.org/distributions/gradle-[% c("var/gradle_version_new") %]-bin.zip
+    name: gradle_bin_new
+    sha256sum: 038794feef1f4745c6347107b6726279d1c824f3fc634b60f86ace1e9fbd1768
+  - URL: https://services.gradle.org/distributions/gradle-[% c("var/gradle_version") %]-bin.zip
+    name: gradle_bin
+    sha256sum: 1f3067073041bc44554d0efe5d402a33bc3d3c93cc39ab684f308586d732a80d
+  - URL: https://services.gradle.org/distributions/gradle-[% c("var/gradle_version_old") %]-bin.zip
+    name: gradle_bin_old
+    sha256sum: 4953323605c5d7b89e97d0dc7779e275bccedefcdac090aec123375eae0cc798



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits