Merge pull request #95309 from obsidiansystems/mobile-fixes

Support Android 29 in cross-compilation
This commit is contained in:
Matthew Bauer 2020-08-28 14:59:37 -05:00 committed by GitHub
commit d0e52b6b32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 84 additions and 144 deletions

View file

@ -46,7 +46,7 @@ rec {
armv7a-android-prebuilt = {
config = "armv7a-unknown-linux-androideabi";
sdkVer = "24";
sdkVer = "29";
ndkVer = "18b";
platform = platforms.armv7a-android;
useAndroidPrebuilt = true;
@ -54,7 +54,7 @@ rec {
aarch64-android-prebuilt = {
config = "aarch64-unknown-linux-android";
sdkVer = "24";
sdkVer = "29";
ndkVer = "18b";
platform = platforms.aarch64-multiplatform;
useAndroidPrebuilt = true;

View file

@ -30,4 +30,34 @@
androidndk = androidComposition.ndk-bundle;
targetAndroidndkPkgs = targetPackages.androidndkPkgs_18b;
};
"21" =
let
ndkVersion = "21.0.6113669";
buildAndroidComposition = buildPackages.buildPackages.androidenv.composeAndroidPackages {
includeNDK = true;
inherit ndkVersion;
};
androidComposition = androidenv.composeAndroidPackages {
includeNDK = true;
inherit ndkVersion;
};
in
import ./androidndk-pkgs.nix {
inherit (buildPackages)
makeWrapper;
inherit (pkgs)
stdenv
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 = buildAndroidComposition.ndk-bundle;
androidndk = androidComposition.ndk-bundle;
targetAndroidndkPkgs = targetPackages.androidndkPkgs_21;
};
}

View file

@ -62,8 +62,15 @@ let
endif
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
INTEGER_LIBRARY = ${if enableIntegerSimple then "integer-simple" else "integer-gmp"}
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
''
# We only need to build stage1 on most cross-compilation because
# we will be running the compiler on the native system. In some
# situations, like native Musl compilation, we need the compiler
# to actually link to our new Libc. The iOS simulator is a special
# exception because we cant actually run simulators binaries
# ourselves.
+ stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
Stage1Only = ${if (targetPlatform.system == hostPlatform.system && !targetPlatform.isiOS) then "NO" else "YES"}
CrossCompilePrefix = ${targetPrefix}
HADDOCK_DOCS = NO
BUILD_SPHINX_HTML = NO

View file

@ -59,8 +59,15 @@ let
endif
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
INTEGER_LIBRARY = ${if enableIntegerSimple then "integer-simple" else "integer-gmp"}
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
''
# We only need to build stage1 on most cross-compilation because
# we will be running the compiler on the native system. In some
# situations, like native Musl compilation, we need the compiler
# to actually link to our new Libc. The iOS simulator is a special
# exception because we cant actually run simulators binaries
# ourselves.
+ stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
Stage1Only = ${if (targetPlatform.system == hostPlatform.system && !targetPlatform.isiOS) then "NO" else "YES"}
CrossCompilePrefix = ${targetPrefix}
HADDOCK_DOCS = NO
BUILD_SPHINX_HTML = NO

View file

@ -59,8 +59,15 @@ let
endif
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
INTEGER_LIBRARY = ${if enableIntegerSimple then "integer-simple" else "integer-gmp"}
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
''
# We only need to build stage1 on most cross-compilation because
# we will be running the compiler on the native system. In some
# situations, like native Musl compilation, we need the compiler
# to actually link to our new Libc. The iOS simulator is a special
# exception because we cant actually run simulators binaries
# ourselves.
+ stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
Stage1Only = ${if (targetPlatform.system == hostPlatform.system && !targetPlatform.isiOS) then "NO" else "YES"}
CrossCompilePrefix = ${targetPrefix}
HADDOCK_DOCS = NO
BUILD_SPHINX_HTML = NO

View file

@ -62,8 +62,15 @@ let
endif
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
INTEGER_LIBRARY = ${if enableIntegerSimple then "integer-simple" else "integer-gmp"}
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
''
# We only need to build stage1 on most cross-compilation because
# we will be running the compiler on the native system. In some
# situations, like native Musl compilation, we need the compiler
# to actually link to our new Libc. The iOS simulator is a special
# exception because we cant actually run simulators binaries
# ourselves.
+ stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
Stage1Only = ${if (targetPlatform.system == hostPlatform.system && !targetPlatform.isiOS) then "NO" else "YES"}
CrossCompilePrefix = ${targetPrefix}
HADDOCK_DOCS = NO
BUILD_SPHINX_HTML = NO

View file

@ -62,8 +62,15 @@ let
endif
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
INTEGER_LIBRARY = ${if enableIntegerSimple then "integer-simple" else "integer-gmp"}
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
''
# We only need to build stage1 on most cross-compilation because
# we will be running the compiler on the native system. In some
# situations, like native Musl compilation, we need the compiler
# to actually link to our new Libc. The iOS simulator is a special
# exception because we cant actually run simulators binaries
# ourselves.
+ stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
Stage1Only = ${if (targetPlatform.system == hostPlatform.system && !targetPlatform.isiOS) then "NO" else "YES"}
CrossCompilePrefix = ${targetPrefix}
HADDOCK_DOCS = NO
BUILD_SPHINX_HTML = NO

View file

@ -69,7 +69,7 @@ let
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
BIGNUM_BACKEND = ${if enableNativeBignum then "native" else "gmp"}
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
Stage1Only = ${if (targetPlatform.system == hostPlatform.system && !targetPlatform.isiOS) then "NO" else "YES"}
CrossCompilePrefix = ${targetPrefix}
HADDOCK_DOCS = NO
BUILD_SPHINX_HTML = NO

View file

@ -14,7 +14,7 @@
, lldbVersions ? [ ]
, cmakeVersions ? [ ]
, includeNDK ? false
, ndkVersion ? "18.1.5063045"
, ndkVersion ? "21.0.6113669"
, useGoogleAPIs ? false
, useGoogleTVAddOns ? false
, includeExtras ? []

View file

@ -672,70 +672,6 @@
};
"extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-alpha4" = {
name = "extras-m2repository-com-android-support-constraint-constraint-layout-solver-1.0.0-alpha4";
path = "extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.0-alpha4";
revision = "1";
displayName = "com.android.support.constraint:constraint-layout-solver:1.0.0-alpha4";
archives = {
all = fetchurl {
url = "https://dl.google.com/android/repository/com.android.support.constraint-constraint-layout-solver-1.0.0-alpha4.zip";
sha1 = "2aa2aceecc6ba172742d0af0b43f11d03924eeb8";
};
};
};
"extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-alpha4" = {
name = "extras-m2repository-com-android-support-constraint-constraint-layout-solver-1.0.0-alpha4";
path = "extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.0-alpha4";
revision = "1";
displayName = "com.android.support.constraint:constraint-layout-solver:1.0.0-alpha4";
archives = {
all = fetchurl {
url = "https://dl.google.com/android/repository/com.android.support.constraint-constraint-layout-solver-1.0.0-alpha4.zip";
sha1 = "2aa2aceecc6ba172742d0af0b43f11d03924eeb8";
};
};
};
"extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-alpha4" = {
name = "extras-m2repository-com-android-support-constraint-constraint-layout-solver-1.0.0-alpha4";
path = "extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.0-alpha4";
revision = "1";
displayName = "com.android.support.constraint:constraint-layout-solver:1.0.0-alpha4";
archives = {
all = fetchurl {
url = "https://dl.google.com/android/repository/com.android.support.constraint-constraint-layout-solver-1.0.0-alpha4.zip";
sha1 = "2aa2aceecc6ba172742d0af0b43f11d03924eeb8";
};
};
};
"extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-alpha8" = {
name = "extras-m2repository-com-android-support-constraint-constraint-layout-solver-1.0.0-alpha8";
path = "extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.0-alpha8";
revision = "1";
displayName = "Solver for ConstraintLayout 1.0.0-alpha8";
archives = {
all = fetchurl {
url = "https://dl.google.com/android/repository/com.android.support.constraint-constraint-layout-solver-1.0.0-alpha8.zip";
sha1 = "cd13d16a8f0198c1d6040ec8b1d0d4e5bb7feb6a";
};
};
};
"extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-alpha8" = {
name = "extras-m2repository-com-android-support-constraint-constraint-layout-solver-1.0.0-alpha8";
path = "extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.0-alpha8";
@ -896,70 +832,6 @@
};
"extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-alpha4" = {
name = "extras-m2repository-com-android-support-constraint-constraint-layout-1.0.0-alpha4";
path = "extras/m2repository/com/android/support/constraint/constraint-layout/1.0.0-alpha4";
revision = "1";
displayName = "com.android.support.constraint:constraint-layout:1.0.0-alpha4";
archives = {
all = fetchurl {
url = "https://dl.google.com/android/repository/com.android.support.constraint-constraint-layout-1.0.0-alpha4.zip";
sha1 = "645a9be1f0c1177301e71cd0ddccf1dd67c554fe";
};
};
};
"extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-alpha4" = {
name = "extras-m2repository-com-android-support-constraint-constraint-layout-1.0.0-alpha4";
path = "extras/m2repository/com/android/support/constraint/constraint-layout/1.0.0-alpha4";
revision = "1";
displayName = "com.android.support.constraint:constraint-layout:1.0.0-alpha4";
archives = {
all = fetchurl {
url = "https://dl.google.com/android/repository/com.android.support.constraint-constraint-layout-1.0.0-alpha4.zip";
sha1 = "645a9be1f0c1177301e71cd0ddccf1dd67c554fe";
};
};
};
"extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-alpha4" = {
name = "extras-m2repository-com-android-support-constraint-constraint-layout-1.0.0-alpha4";
path = "extras/m2repository/com/android/support/constraint/constraint-layout/1.0.0-alpha4";
revision = "1";
displayName = "com.android.support.constraint:constraint-layout:1.0.0-alpha4";
archives = {
all = fetchurl {
url = "https://dl.google.com/android/repository/com.android.support.constraint-constraint-layout-1.0.0-alpha4.zip";
sha1 = "645a9be1f0c1177301e71cd0ddccf1dd67c554fe";
};
};
};
"extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-alpha8" = {
name = "extras-m2repository-com-android-support-constraint-constraint-layout-1.0.0-alpha8";
path = "extras/m2repository/com/android/support/constraint/constraint-layout/1.0.0-alpha8";
revision = "1";
displayName = "ConstraintLayout for Android 1.0.0-alpha8";
archives = {
all = fetchurl {
url = "https://dl.google.com/android/repository/com.android.support.constraint-constraint-layout-1.0.0-alpha8.zip";
sha1 = "7912ba03b04831f918f523648f118c4ee4da7604";
};
};
};
"extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-alpha8" = {
name = "extras-m2repository-com-android-support-constraint-constraint-layout-1.0.0-alpha8";
path = "extras/m2repository/com/android/support/constraint/constraint-layout/1.0.0-alpha8";

View file

@ -7,12 +7,14 @@ deployAndroidPackage {
inherit package os;
buildInputs = [ autoPatchelfHook makeWrapper pkgs.python2 ]
++ lib.optional (os == "linux") [ pkgs.glibc pkgs.stdenv.cc.cc pkgs.ncurses5 pkgs.zlib pkgs.libcxx.out ];
patchInstructions = lib.optionalString (os == "linux") ''
patchInstructions = lib.optionalString (os == "linux") (''
patchShebangs .
'' + lib.optionalString (builtins.compareVersions (lib.getVersion package) "21" > 0) ''
patch -p1 \
--no-backup-if-mismatch < ${./make_standalone_toolchain.py_18.patch}
wrapProgram $(pwd)/build/tools/make_standalone_toolchain.py --prefix PATH : "${runtime_paths}"
'' + ''
# TODO: allow this stuff
rm -rf docs tests
@ -46,6 +48,6 @@ deployAndroidPackage {
do
ln -sf ../libexec/android-sdk/ndk-bundle/$i $out/bin/$i
done
'';
'');
noAuditTmpdir = true; # Audit script gets invoked by the build/ component in the path for the make standalone script
}

View file

@ -1183,6 +1183,7 @@ in
androidndkPkgs = androidndkPkgs_18b;
androidndkPkgs_18b = (callPackage ../development/androidndk-pkgs {})."18b";
androidndkPkgs_21 = (callPackage ../development/androidndk-pkgs {})."21";
androidsdk_9_0 = androidenv.androidPkgs_9_0.androidsdk;