about summary refs log tree commit diff
path: root/pkgs/development/mobile/androidenv/ndk-bundle/default.nix
diff options
context:
space:
mode:
authornuminit <me@numin.it>2020-11-13 19:18:52 -0700
committerMorgan Jones <me@numin.it>2021-01-03 21:27:23 -0700
commit5b91d4ab65748285ffad3e309bba2e7475c7d3db (patch)
treebd4a91d6bc1a6d7001251d39ce8893de0aeae637 /pkgs/development/mobile/androidenv/ndk-bundle/default.nix
parent80677f372f0089b0a1352134af56e38a7f653358 (diff)
Rework androidenv package generation
androidenv did not previously write license files, which caused certain
gradle-based Android tools to fail. Restructure androidenv's list of
Android packages into a single repo.json file to prevent duplication
and enable us to extract the EULA texts, which we then hash with
builtins.hashString to produce the license files that Android gradle
tools look for.

Remove includeDocs and lldbVersions, as these have been removed
from the Android package repositories.

Improve documentation and examples.
Diffstat (limited to 'pkgs/development/mobile/androidenv/ndk-bundle/default.nix')
-rw-r--r--pkgs/development/mobile/androidenv/ndk-bundle/default.nix32
1 files changed, 17 insertions, 15 deletions
diff --git a/pkgs/development/mobile/androidenv/ndk-bundle/default.nix b/pkgs/development/mobile/androidenv/ndk-bundle/default.nix
index ca305e0398d5d..f74b949a7b3c0 100644
--- a/pkgs/development/mobile/androidenv/ndk-bundle/default.nix
+++ b/pkgs/development/mobile/androidenv/ndk-bundle/default.nix
@@ -9,14 +9,14 @@ let
 in
 deployAndroidPackage {
   inherit package os;
-  buildInputs = [ autoPatchelfHook makeWrapper pkgs.python2 ]
-    ++ lib.optional (os == "linux") [ pkgs.glibc pkgs.stdenv.cc.cc pkgs.ncurses5 pkgs.zlib pkgs.libcxx.out ];
+  nativeBuildInputs = [ autoPatchelfHook makeWrapper ];
+  buildInputs = lib.optional (os == "linux") [ pkgs.glibc pkgs.stdenv.cc.cc pkgs.python2 pkgs.ncurses5 pkgs.zlib pkgs.libcxx.out pkgs.libxml2 ];
   patchInstructions = lib.optionalString (os == "linux") (''
     patchShebangs .
 
   '' + lib.optionalString (builtins.compareVersions (lib.getVersion package) "21" > 0) ''
     patch -p1 \
-      --no-backup-if-mismatch < ${./make_standalone_toolchain.py_18.patch}
+      --no-backup-if-mismatch < ${./make_standalone_toolchain.py_18.patch} || true
     wrapProgram $(pwd)/build/tools/make_standalone_toolchain.py --prefix PATH : "${runtime_paths}"
   '' + ''
 
@@ -24,33 +24,35 @@ deployAndroidPackage {
     rm -rf docs tests
 
     # Patch the executables of the toolchains, but not the libraries -- they are needed for crosscompiling
+    if [ -d $out/libexec/android-sdk/ndk-bundle/toolchains/renderscript/prebuilt/linux-x86_64/lib64 ]; then
+        addAutoPatchelfSearchPath $out/libexec/android-sdk/ndk-bundle/toolchains/renderscript/prebuilt/linux-x86_64/lib64
+    fi
 
-    addAutoPatchelfSearchPath $out/libexec/android-sdk/ndk-bundle/toolchains/renderscript/prebuilt/linux-x86_64/lib64
-    find toolchains -type d -name bin | while read dir
-    do
+    if [ -d $out/libexec/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/lib64 ]; then
+        addAutoPatchelfSearchPath $out/libexec/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/lib64
+    fi
+
+    find toolchains -type d -name bin -or -name lib64 | while read dir; do
         autoPatchelf "$dir"
     done
 
     # fix ineffective PROGDIR / MYNDKDIR determination
-    for i in ndk-build
-    do
-        sed -i -e 's|^PROGDIR=`dirname $0`|PROGDIR=`dirname $(readlink -f $(which $0))`|' $i
+    for progname in ndk-build; do
+        sed -i -e 's|^PROGDIR=`dirname $0`|PROGDIR=`dirname $(readlink -f $(which $0))`|' $progname
     done
 
     # Patch executables
     autoPatchelf prebuilt/linux-x86_64
 
     # wrap
-    for i in ndk-build
-    do
-        wrapProgram "$(pwd)/$i" --prefix PATH : "${runtime_paths}"
+    for progname in ndk-build; do
+        wrapProgram "$(pwd)/$progname" --prefix PATH : "${runtime_paths}"
     done
 
     # make some executables available in PATH
     mkdir -p $out/bin
-    for i in ndk-build
-    do
-        ln -sf ../libexec/android-sdk/ndk-bundle/$i $out/bin/$i
+    for progname in ndk-build; do
+        ln -sf ../libexec/android-sdk/ndk-bundle/$progname $out/bin/$progname
     done
   '');
   noAuditTmpdir = true; # Audit script gets invoked by the build/ component in the path for the make standalone script