summary refs log tree commit diff
path: root/pkgs/development/androidndk-pkgs
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2019-04-09 14:21:54 -0400
committerMatthew Bauer <mjbauer95@gmail.com>2019-04-20 20:05:51 -0400
commitd180cb98503d2dc1e51d8c14b4a567e1ed3e996d (patch)
tree437b88033238e50b895fc19cbc5701527a3b5d43 /pkgs/development/androidndk-pkgs
parent799fa4d4044018f2e3a4f258942ae6d34a8d5c4d (diff)
downloadnixpkgs-d180cb98503d2dc1e51d8c14b4a567e1ed3e996d.tar
nixpkgs-d180cb98503d2dc1e51d8c14b4a567e1ed3e996d.tar.gz
nixpkgs-d180cb98503d2dc1e51d8c14b4a567e1ed3e996d.tar.bz2
nixpkgs-d180cb98503d2dc1e51d8c14b4a567e1ed3e996d.tar.lz
nixpkgs-d180cb98503d2dc1e51d8c14b4a567e1ed3e996d.tar.xz
nixpkgs-d180cb98503d2dc1e51d8c14b4a567e1ed3e996d.tar.zst
nixpkgs-d180cb98503d2dc1e51d8c14b4a567e1ed3e996d.zip
cc-wrapper: make machine configuration configurable
It is useful to make these dynamic and not bake them into gcc. This
means we don’t have to rebuild gcc to change these values. Instead, we
will pass cflags to gcc based on platform values. This was already
done hackily for android gcc (which is multi-target), but not for our
own gccs which are single target.

To accomplish this, we need to add a few things:

- add ‘arch’ to cpu
- add NIX_CFLAGS_COMPILE_BEFORE flag (goes before args)
- set -march everywhere
- set mcpu, mfpu, mmode, and mtune based on targetPlatform.gcc flags

cc-wrapper: only set -march when it is in the cpu type

Some architectures don’t have a good mapping of -march. For instance
POWER architecture doesn’t support the -march flag at all!

https://gcc.gnu.org/onlinedocs/gcc/RS_002f6000-and-PowerPC-Options.html#RS_002f6000-and-PowerPC-Options
Diffstat (limited to 'pkgs/development/androidndk-pkgs')
-rw-r--r--pkgs/development/androidndk-pkgs/androidndk-pkgs.nix21
1 files changed, 1 insertions, 20 deletions
diff --git a/pkgs/development/androidndk-pkgs/androidndk-pkgs.nix b/pkgs/development/androidndk-pkgs/androidndk-pkgs.nix
index b62dc2def7f..cca0f0d4adb 100644
--- a/pkgs/development/androidndk-pkgs/androidndk-pkgs.nix
+++ b/pkgs/development/androidndk-pkgs/androidndk-pkgs.nix
@@ -90,26 +90,7 @@ rec {
       echo "-target ${stdenv.targetPlatform.config}" >> $out/nix-support/cc-cflags
       echo "-resource-dir=$(echo ${androidndk}/libexec/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/${hostInfo.double}/lib*/clang/*)" >> $out/nix-support/cc-cflags
       echo "--gcc-toolchain=${androidndk}/libexec/android-sdk/ndk-bundle/toolchains/${targetInfo.toolchain}-${targetInfo.gccVer}/prebuilt/${hostInfo.double}" >> $out/nix-support/cc-cflags
-    ''
-    + lib.optionalString stdenv.targetPlatform.isAarch32 (let
-        p =  stdenv.targetPlatform.platform.gcc or {}
-          // stdenv.targetPlatform.parsed.abi;
-        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 (p ? float-abi) "-mfloat-abi=${p.float-abi}")
-          (lib.optional (p ? mode) "-mmode=${p.mode}")
-        ];
-      in ''
-        sed -E -i \
-          $out/bin/${stdenv.targetPlatform.config}-cc \
-          $out/bin/${stdenv.targetPlatform.config}-c++ \
-          $out/bin/${stdenv.targetPlatform.config}-clang \
-          $out/bin/${stdenv.targetPlatform.config}-clang++ \
-          -e 's|^(extraBefore=)\((.*)\)$|\1(\2 -Wl,--fix-cortex-a8 ${builtins.toString flags})|'
-      '');
+    '';
   };
 
   # Bionic lib C and other libraries.