diff options
-rw-r--r-- | lib/systems/examples.nix | 3 | ||||
-rw-r--r-- | pkgs/development/mobile/androidenv/androidndk-pkgs.nix | 33 |
2 files changed, 32 insertions, 4 deletions
diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 897ba448b951f..9c43d9b1bbc78 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -31,18 +31,21 @@ rec { armv5te-android-prebuilt = rec { config = "armv5tel-unknown-linux-androideabi"; + sdkVer = "21"; platform = platforms.armv5te-android; useAndroidPrebuilt = true; }; armv7a-android-prebuilt = rec { config = "armv7a-unknown-linux-androideabi"; + sdkVer = "21"; platform = platforms.armv7a-android; useAndroidPrebuilt = true; }; aarch64-android-prebuilt = rec { config = "aarch64-unknown-linux-android"; + sdkVer = "21"; platform = platforms.aarch64-multiplatform; useAndroidPrebuilt = true; }; diff --git a/pkgs/development/mobile/androidenv/androidndk-pkgs.nix b/pkgs/development/mobile/androidenv/androidndk-pkgs.nix index 19fc0dc812d85..f0557390988d1 100644 --- a/pkgs/development/mobile/androidenv/androidndk-pkgs.nix +++ b/pkgs/development/mobile/androidenv/androidndk-pkgs.nix @@ -15,7 +15,12 @@ let "x86_64-unknown-linux-gnu" = { double = "linux-x86_64"; }; - "arm-unknown-linux-androideabi" = { + "armv5tel-unknown-linux-androideabi" = { + arch = "arm"; + triple = "arm-linux-androideabi"; + gccVer = "4.8"; + }; + "armv7a-unknown-linux-androideabi" = { arch = "arm"; triple = "arm-linux-androideabi"; gccVer = "4.8"; @@ -59,9 +64,29 @@ rec { cc = binaries; bintools = binutils; libc = targetAndroidndkPkgs.libraries; - extraBuildCommands = + extraBuildCommands = lib.optionalString targetPlatform.isAarch32 (let + p = targetPlatform.platform.gcc or {}; + float = p.float or (targetPlatform.parsed.abi.float or null); + flags = lib.concatLists [ + (lib.optional (p ? arch) "-march=${p.arch}") + (lib.optional (p ? cpu) "-mcpu=${p.cpu}") + (lib.optional (p ? abi) "-mabi=${p.abi}") + (lib.optional (p ? fpu) "-mfpu=${p.fpu}") + (lib.optional (float != null) "-mfloat=${float}") + (lib.optional (p ? float-abi) "-mfloat-abi=${p.float-abi}") + (lib.optional (p ? mode) "-mmode=${p.mode}") + ]; + in '' + sed -E -i \ + $out/bin/${targetPlatform.config}-cc \ + $out/bin/${targetPlatform.config}-c++ \ + $out/bin/${targetPlatform.config}-gcc \ + $out/bin/${targetPlatform.config}-g++ \ + -e '130i extraBefore+=(-Wl,--fix-cortex-a8)' \ + -e 's|^(extraBefore=)\(\)$|\1(${builtins.toString flags})|' + '') # GCC 4.9 is the first relase with "-fstack-protector" - lib.optionalString (lib.versionOlder targetInfo.gccVer "4.9") '' + + lib.optionalString (lib.versionOlder targetInfo.gccVer "4.9") '' sed -E \ -i $out/nix-support/add-hardening.sh \ -e 's|(-fstack-protector)-strong|\1|g' @@ -76,7 +101,7 @@ rec { libraries = { name = "bionic-prebuilt"; type = "derivation"; - outPath = "${buildAndroidndk}/libexec/${buildAndroidndk.name}/platforms/android-21/arch-${hostInfo.arch}/usr/"; + outPath = "${buildAndroidndk}/libexec/${buildAndroidndk.name}/platforms/android-${hostPlatform.sdkVer}/arch-${hostInfo.arch}/usr/"; drvPath = throw "fake derivation, build ${buildAndroidndk} to use"; }; } |