about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authors1341 <s1341@github.com>2021-05-06 07:15:34 +0300
committerJohn Ericson <John.Ericson@Obsidian.Systems>2021-05-11 15:39:08 +0000
commit1e1d29c2af646b21c04f7a27614317a19ee01bc5 (patch)
treec9aae224cdc64de857abe26dcba02ecf1456af1c /pkgs/build-support
parent680b33fe37d4b6fd0bd8fe596ed438c88bfb3637 (diff)
downloadnixlib-1e1d29c2af646b21c04f7a27614317a19ee01bc5.tar
nixlib-1e1d29c2af646b21c04f7a27614317a19ee01bc5.tar.gz
nixlib-1e1d29c2af646b21c04f7a27614317a19ee01bc5.tar.bz2
nixlib-1e1d29c2af646b21c04f7a27614317a19ee01bc5.tar.lz
nixlib-1e1d29c2af646b21c04f7a27614317a19ee01bc5.tar.xz
nixlib-1e1d29c2af646b21c04f7a27614317a19ee01bc5.tar.zst
nixlib-1e1d29c2af646b21c04f7a27614317a19ee01bc5.zip
treewide: Support aarch64-android using minimal prebuilt components
This PR adds a new aarch64 android toolchain, which leverages the
existing crossSystem infrastructure and LLVM builders to generate a
working toolchain with minimal prebuilt components.

The only thing that is prebuilt is the bionic libc. This is because it
is practically impossible to compile bionic outside of an AOSP tree. I
tried and failed, braver souls may prevail. For now I just grab the
relevant binaries from https://android.googlesource.com/.

I also grab the msm kernel sources from there to generate headers. I've
included a minor patch to the existing kernel-headers derivation in
order to expose an internal function.

Everything else, from binutils up, is using stock code. Many thanks to
@Ericson2314 for his help on this, and for building such a powerful
system in the first place!

One motivation for this is to be able to build a toolchain which will
work on an aarch64 linux machine. To my knowledge, there is no existing
toolchain for an aarch64-linux builder and an aarch64-android target.
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/cc-wrapper/default.nix4
1 files changed, 4 insertions, 0 deletions
diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix
index 36a98a180b3e..be5c3bca235a 100644
--- a/pkgs/build-support/cc-wrapper/default.nix
+++ b/pkgs/build-support/cc-wrapper/default.nix
@@ -491,6 +491,10 @@ stdenv.mkDerivation {
         echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/cc-cflags
     ''
 
+    + optionalString targetPlatform.isAndroid ''
+      echo "-D__ANDROID_API__=${targetPlatform.sdkVer}" >> $out/nix-support/cc-cflags
+    ''
+
     # There are a few tools (to name one libstdcxx5) which do not work
     # well with multi line flags, so make the flags single line again
     + ''