androidndk: Add Darwin support

Also switch Linux to using the official sha1 hashes for consistency.
They are gotten from https://developer.android.com/ndk/downloads/.
This commit is contained in:
John Ericson 2018-09-17 22:34:37 -04:00
parent 8da28de0e8
commit 6769437186
5 changed files with 31 additions and 19 deletions

View File

@ -48,7 +48,7 @@ rec {
armv7a-android-prebuilt = rec { armv7a-android-prebuilt = rec {
config = "armv7a-unknown-linux-androideabi"; config = "armv7a-unknown-linux-androideabi";
sdkVer = "24"; sdkVer = "24";
ndkVer = "17"; ndkVer = "17c";
platform = platforms.armv7a-android; platform = platforms.armv7a-android;
useAndroidPrebuilt = true; useAndroidPrebuilt = true;
}; };
@ -56,7 +56,7 @@ rec {
aarch64-android-prebuilt = rec { aarch64-android-prebuilt = rec {
config = "aarch64-unknown-linux-android"; config = "aarch64-unknown-linux-android";
sdkVer = "24"; sdkVer = "24";
ndkVer = "17"; ndkVer = "17c";
platform = platforms.aarch64-multiplatform; platform = platforms.aarch64-multiplatform;
useAndroidPrebuilt = true; useAndroidPrebuilt = true;
}; };

View File

@ -12,6 +12,9 @@ let
# than we do. We don't just use theirs because ours are less ambiguous and # than we do. We don't just use theirs because ours are less ambiguous and
# some builds need that clarity. # some builds need that clarity.
ndkInfoFun = { config, ... }: { ndkInfoFun = { config, ... }: {
"x86_64-apple-darwin" = {
double = "darwin-x86_64";
};
"x86_64-unknown-linux-gnu" = { "x86_64-unknown-linux-gnu" = {
double = "linux-x86_64"; double = "linux-x86_64";
}; };

View File

@ -1,6 +1,6 @@
{ stdenv, fetchurl, zlib, ncurses5, unzip, lib, makeWrapper { stdenv, fetchurl, zlib, ncurses5, unzip, lib, makeWrapper
, coreutils, file, findutils, gawk, gnugrep, gnused, jdk, which , coreutils, file, findutils, gawk, gnugrep, gnused, jdk, which
, platformTools, python3, libcxx, version, sha256 , platformTools, python3, libcxx, version, sha1s
, fullNDK ? false # set to true if you want other parts of the NDK , fullNDK ? false # set to true if you want other parts of the NDK
# that is not used by Nixpkgs like sources, # that is not used by Nixpkgs like sources,
# examples, docs, or LLVM toolchains # examples, docs, or LLVM toolchains
@ -10,10 +10,10 @@ stdenv.mkDerivation rec {
name = "android-ndk-r${version}"; name = "android-ndk-r${version}";
inherit version; inherit version;
src = if stdenv.hostPlatform.system == "x86_64-linux" then fetchurl { src = fetchurl {
url = "https://dl.google.com/android/repository/${name}-linux-x86_64.zip"; url = "https://dl.google.com/android/repository/${name}-${stdenv.hostPlatform.parsed.kernel.name}-${stdenv.hostPlatform.parsed.cpu.name}.zip";
inherit sha256; sha1 = sha1s.${stdenv.hostPlatform.system} or (throw "platform ${stdenv.hostPlatform.system} not supported!");
} else throw "platform ${stdenv.hostPlatform.system} not supported!"; };
phases = "buildPhase"; phases = "buildPhase";
@ -89,7 +89,7 @@ stdenv.mkDerivation rec {
''; '';
meta = { meta = {
platforms = stdenv.lib.platforms.linux; platforms = builtins.attrNames sha1s;
hydraPlatforms = []; hydraPlatforms = [];
license = stdenv.lib.licenses.asl20; license = stdenv.lib.licenses.asl20;
}; };

View File

@ -232,7 +232,10 @@ rec {
coreutils file findutils gawk gnugrep gnused jdk which; coreutils file findutils gawk gnugrep gnused jdk which;
inherit platformTools; inherit platformTools;
version = "10e"; version = "10e";
sha256 = "032j3sgk93bjbkny84i17ph61dhjmsax9ddqng1zbi2p7dgl0pzf"; sha1s = {
x86_64-darwin = "6be8598e4ed3d9dd42998c8cb666f0ee502b1294";
x86_64-linux = "f692681b007071103277f6edc6f91cb5c5494a32";
};
}; };
androidndk_16b = pkgs.callPackage ./androidndk.nix { androidndk_16b = pkgs.callPackage ./androidndk.nix {
@ -243,20 +246,26 @@ rec {
coreutils file findutils gawk gnugrep gnused jdk which; coreutils file findutils gawk gnugrep gnused jdk which;
inherit platformTools; inherit platformTools;
version = "16b"; version = "16b";
sha256 = "00frcnvpcsngv00p6l2vxj4cwi2mwcm9lnjvm3zv4wrp6pss9pmw"; sha1s = {
x86_64-darwin = "e51e615449b98c716cf912057e2682e75d55e2de";
x86_64-linux = "42aa43aae89a50d1c66c3f9fdecd676936da6128";
};
}; };
androidndk_17 = pkgs.callPackage ./androidndk.nix { androidndk_17c = pkgs.callPackage ./androidndk.nix {
inherit (buildPackages) inherit (buildPackages)
unzip makeWrapper; unzip makeWrapper;
inherit (pkgs) inherit (pkgs)
stdenv fetchurl zlib ncurses5 lib python3 libcxx stdenv fetchurl zlib ncurses5 lib python3 libcxx
coreutils file findutils gawk gnugrep gnused jdk which; coreutils file findutils gawk gnugrep gnused jdk which;
inherit platformTools; inherit platformTools;
version = "17"; version = "17c";
sha256 = "1jj3zy958zsidywqd5nwdyrnr72rf9zhippkl8rbqxfy8wxq2gds"; sha1s = {
x86_64-darwin = "f97e3d7711497e3b4faf9e7b3fa0f0da90bb649c";
x86_64-linux = "12cacc70c3fd2f40574015631c00f41fb8a39048";
}; };
androidndk = androidndk_17; };
androidndk = androidndk_17c;
androidndk_r8e = import ./androidndk_r8e.nix { androidndk_r8e = import ./androidndk_r8e.nix {
inherit (buildPackages) inherit (buildPackages)
@ -277,7 +286,7 @@ rec {
inherit androidsdk; inherit androidsdk;
}; };
androidndkPkgs_17 = import ./androidndk-pkgs.nix { androidndkPkgs_17c = import ./androidndk-pkgs.nix {
inherit (buildPackages) inherit (buildPackages)
makeWrapper; makeWrapper;
inherit (pkgs) inherit (pkgs)
@ -287,11 +296,11 @@ rec {
# but for splicing messing up on infinite recursion for the variants we # 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 # *dont't* use. Using this workaround, but also making a test to ensure
# these two really are the same. # these two really are the same.
buildAndroidndk = buildPackages.buildPackages.androidenv.androidndk_17; buildAndroidndk = buildPackages.buildPackages.androidenv.androidndk_17c;
androidndk = androidndk_17; androidndk = androidndk_17c;
targetAndroidndkPkgs = targetPackages.androidenv.androidndkPkgs_17; targetAndroidndkPkgs = targetPackages.androidenv.androidndkPkgs_17c;
}; };
androidndkPkgs = androidndkPkgs_17; androidndkPkgs = androidndkPkgs_17c;
androidndkPkgs_10e = import ./androidndk-pkgs.nix { androidndkPkgs_10e = import ./androidndk-pkgs.nix {
inherit (buildPackages) inherit (buildPackages)