about summary refs log tree commit diff
path: root/pkgs/development/mobile
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2022-06-29 18:24:19 +0900
committerJari Vetoniemi <mailroxas@gmail.com>2022-06-29 18:27:16 +0900
commit5f1923d67e1ecdc2176f017d7d2008aa1c908baf (patch)
tree76d4fecf0ec91e67ea289baae1e8b41d280197a1 /pkgs/development/mobile
parent72f17cca89ec773e5845f5fa1bffcf0b7a4e2094 (diff)
androidenv: fix android cross-compilers
These were completely broken. Even if they managed to output a binary,
it wouldn't actually run on the actual device.
Diffstat (limited to 'pkgs/development/mobile')
-rw-r--r--pkgs/development/mobile/androidenv/ndk-bundle/default.nix11
1 files changed, 10 insertions, 1 deletions
diff --git a/pkgs/development/mobile/androidenv/ndk-bundle/default.nix b/pkgs/development/mobile/androidenv/ndk-bundle/default.nix
index 58cc8f9d57097..28c7ca62b26d7 100644
--- a/pkgs/development/mobile/androidenv/ndk-bundle/default.nix
+++ b/pkgs/development/mobile/androidenv/ndk-bundle/default.nix
@@ -16,7 +16,7 @@ deployAndroidPackage {
   patchInstructions = lib.optionalString (os == "linux") (''
     patchShebangs .
 
-    # Fix the shebangs of the auto-generated scripts.
+    # LEGACY: Fix the shebangs of the auto-generated scripts.
     substituteInPlace ./build/tools/make_standalone_toolchain.py \
       --replace '#!/bin/bash' '#!${pkgs.bash}/bin/bash'
 
@@ -29,6 +29,15 @@ deployAndroidPackage {
     # TODO: allow this stuff
     rm -rf docs tests
 
+    # Ndk now has a prebuilt toolchains inside, the file layout has changed, we do a symlink
+    # to still support the old standalone toolchains builds.
+    if [ -d $out/libexec/android-sdk/ndk ] && [ ! -d $out/libexec/android-sdk/ndk-bundle ]; then
+        ln -sf $out/libexec/android-sdk/ndk/${package.revision} $out/libexec/android-sdk/ndk-bundle
+    else
+        echo "The ndk-bundle layout has changed. The nix expressions have to be updated!"
+        exit 1
+    fi
+
     # 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