NDK 20b

Automated build recipe

See https://gitlab.com/android-rebuilds/auto/tree/master/ndk-20.

Principle of operation

NDK is build out of the standard SDK tree.

Recreate matching build environment

The current reference build environment for this version is Ubuntu 14.04.

Build dependencies

https://android.googlesource.com/platform/ndk/+/master/infra/docker/Dockerfile

apt-get -y install \
  bison build-essential curl dos2unix flex git make pbzip2 python python-pip \
  texinfo uuid-runtime zip
pip install setuptools
# Missing dependency for recompiling Python3
apt-get -y install zlib1g-dev

Preparing build tree

https://android.googlesource.com/platform/ndk/+/master/README.md

# Preparing build tree
# Make 'repo' accessible to the build system later
export PATH=~/bin:$PATH
repo init -u https://android.googlesource.com/platform/manifest -b ndk-r20b
repo sync --current-branch -j4

Fix ΓΈ character support for prebuilts/ndk/platform/sysroot/NOTICE:

cd ndk/ && patch -p1 <<EOF
diff --git a/ndk/checkbuild.py b/ndk/checkbuild.py
index 7e3e12ac..6566d914 100755
--- a/ndk/checkbuild.py
+++ b/ndk/checkbuild.py
@@ -2102,10 +2102,10 @@ def create_notice_file(path, for_group):

     licenses = set()
     for notice_path in notice_files:
-        with open(notice_path) as notice_file:
+        with open(notice_path, encoding='UTF-8') as notice_file:
             licenses.add(notice_file.read())

-    with open(path, 'w') as output_file:
+    with open(path, 'w', encoding='UTF-8') as output_file:
         # Sorting the contents here to try to make things deterministic.
         output_file.write(os.linesep.join(sorted(list(licenses))))

EOF

Build NDK

cd ndk/
python checkbuild.py --no-build-tests
python checkbuild.py --no-build-tests --system windows
python checkbuild.py --no-build-tests --system windows64

Result:

-rw-r--r-- 1 android android 757M Nov 15 16:17 out/dist/android-ndk-0-linux-x86_64.tar.bz2
-rw-r--r-- 1 android android 794M Nov 15 17:15 out/dist/android-ndk-0-windows-x86_64.zip
-rw-r--r-- 1 android android 777M Nov 15 16:46 out/dist/android-ndk-0-windows.zip

TODOs

prebuilts should be rebuilt

build stats

  • 1h15 for 3 linux/win64/win32 (with 30mn in zip -9r)
  • 26GB .repo
  • 63GB wd/