mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 23:13:19 +00:00
androidndk: Fix usage as crossSystem
This commit is contained in:
parent
c056694d74
commit
832a8ca087
@ -45,7 +45,7 @@ rec {
|
||||
|
||||
aarch64-android-prebuilt = rec {
|
||||
config = "aarch64-unknown-linux-android";
|
||||
sdkVer = "21";
|
||||
sdkVer = "24";
|
||||
platform = platforms.aarch64-multiplatform;
|
||||
useAndroidPrebuilt = true;
|
||||
};
|
||||
|
@ -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
|
||||
'';
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "android-ndk-r${version}";
|
||||
inherit version;
|
||||
|
||||
src = if stdenv.system == "x86_64-linux" then fetchurl {
|
||||
url = "https://dl.google.com/android/repository/${name}-linux-x86_64.zip";
|
||||
|
@ -281,4 +281,19 @@ rec {
|
||||
inherit androidndk;
|
||||
targetAndroidndkPkgs = targetPackages.androidenv.androidndkPkgs;
|
||||
};
|
||||
|
||||
androidndkPkgs_10e = import ./androidndk-pkgs.nix {
|
||||
inherit (buildPackages)
|
||||
makeWrapper;
|
||||
inherit (pkgs)
|
||||
lib hostPlatform targetPlatform
|
||||
runCommand wrapBintoolsWith wrapCCWith;
|
||||
# buildPackages.foo rather than buildPackages.buildPackages.foo would work,
|
||||
# but for splicing messing up on infinite recursion for the variants we
|
||||
# *dont't* use. Using this workaround, but also making a test to ensure
|
||||
# these two really are the same.
|
||||
buildAndroidndk = buildPackages.buildPackages.androidenv.androidndk_10e;
|
||||
androidndk = androidndk_10e;
|
||||
targetAndroidndkPkgs = targetPackages.androidenv.androidndkPkgs_10e;
|
||||
};
|
||||
}
|
||||
|
@ -41,7 +41,9 @@ in lib.init bootStages ++ [
|
||||
targetPlatform = crossSystem;
|
||||
cc = if crossSystem.useiOSPrebuilt or false
|
||||
then buildPackages.darwin.iosSdkPkgs.clang
|
||||
else if crossSystem.useAndroidPrebuilt
|
||||
else if (crossSystem.useAndroidPrebuilt && crossSystem.is32bit)
|
||||
then buildPackages.androidenv.androidndkPkgs_10e.gcc
|
||||
else if (crossSystem.useAndroidPrebuilt && crossSystem.is64bit)
|
||||
then buildPackages.androidenv.androidndkPkgs.gcc
|
||||
else buildPackages.gcc;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user