summary refs log tree commit diff
path: root/pkgs/development/mobile/androidenv/androidndk-pkgs.nix
diff options
context:
space:
mode:
authorBastian Köcher <git@kchr.de>2018-05-17 17:22:27 +0200
committerBastian Köcher <git@kchr.de>2018-05-17 17:22:27 +0200
commit832a8ca087b748db7be7969581e0e10ae1eb486c (patch)
tree017eecd2181fcadb2dcb4af1dea616ad17a6a357 /pkgs/development/mobile/androidenv/androidndk-pkgs.nix
parentc056694d74fe99c6a0657528fac73645680e0df8 (diff)
downloadnixpkgs-832a8ca087b748db7be7969581e0e10ae1eb486c.tar
nixpkgs-832a8ca087b748db7be7969581e0e10ae1eb486c.tar.gz
nixpkgs-832a8ca087b748db7be7969581e0e10ae1eb486c.tar.bz2
nixpkgs-832a8ca087b748db7be7969581e0e10ae1eb486c.tar.lz
nixpkgs-832a8ca087b748db7be7969581e0e10ae1eb486c.tar.xz
nixpkgs-832a8ca087b748db7be7969581e0e10ae1eb486c.tar.zst
nixpkgs-832a8ca087b748db7be7969581e0e10ae1eb486c.zip
androidndk: Fix usage as crossSystem
Diffstat (limited to 'pkgs/development/mobile/androidenv/androidndk-pkgs.nix')
-rw-r--r--pkgs/development/mobile/androidenv/androidndk-pkgs.nix21
1 files changed, 15 insertions, 6 deletions
diff --git a/pkgs/development/mobile/androidenv/androidndk-pkgs.nix b/pkgs/development/mobile/androidenv/androidndk-pkgs.nix
index 663a1f1ee8f..1323466ea86 100644
--- a/pkgs/development/mobile/androidenv/androidndk-pkgs.nix
+++ b/pkgs/development/mobile/androidenv/androidndk-pkgs.nix
@@ -98,10 +98,19 @@ rec {
   # We use androidndk from the previous stage, else we waste time or get cycles
   # cross-compiling packages to wrap incorrectly wrap binaries we don't include
   # anyways.
-  libraries = {
-    name = "bionic-prebuilt";
-    type = "derivation";
-    outPath = "${buildAndroidndk}/libexec/${buildAndroidndk.name}/platforms/android-${hostPlatform.sdkVer}/arch-${hostInfo.arch}/usr/";
-    drvPath = throw "fake derivation, build ${buildAndroidndk} to use";
-  };
+  libraries =
+    let
+      includePath = if buildAndroidndk.version == "10e" then
+          "${buildAndroidndk}/libexec/${buildAndroidndk.name}/platforms/android-${hostPlatform.sdkVer}/arch-${hostInfo.arch}/usr/include/"
+        else
+          "${buildAndroidndk}/libexec/${buildAndroidndk.name}/sysroot/usr/include";
+      libPath = "${buildAndroidndk}/libexec/${buildAndroidndk.name}/platforms/android-${hostPlatform.sdkVer}/arch-${hostInfo.arch}/usr/lib/";
+    in
+    runCommand "bionic-prebuilt" {} ''
+      mkdir -p $out
+      cp -r ${includePath} $out/include
+      chmod +w $out/include
+      ${lib.optionalString (lib.versionOlder buildAndroidndk.version "10e") "ln -s $out/include/${targetInfo.triple}/asm $out/include/asm"}
+      ln -s ${libPath} $out/lib
+    '';
 }