diff options
author | Matthew Bauer <mjbauer95@gmail.com> | 2018-10-16 21:50:37 -0500 |
---|---|---|
committer | Matthew Bauer <mjbauer95@gmail.com> | 2018-10-16 21:50:37 -0500 |
commit | b3041b44552f50109760e7fa41a16636e4b4d5c0 (patch) | |
tree | 3b3a0d579ef4ba7556365bcf6959e5026e868830 /pkgs/stdenv | |
parent | 0e0894c37d398c9c0fe8bf52815c7cef127ac583 (diff) | |
download | nixlib-b3041b44552f50109760e7fa41a16636e4b4d5c0.tar nixlib-b3041b44552f50109760e7fa41a16636e4b4d5c0.tar.gz nixlib-b3041b44552f50109760e7fa41a16636e4b4d5c0.tar.bz2 nixlib-b3041b44552f50109760e7fa41a16636e4b4d5c0.tar.lz nixlib-b3041b44552f50109760e7fa41a16636e4b4d5c0.tar.xz nixlib-b3041b44552f50109760e7fa41a16636e4b4d5c0.tar.zst nixlib-b3041b44552f50109760e7fa41a16636e4b4d5c0.zip |
make-derivation: set CMAKE_SYSTEM_* when cross compiling
Uses uname data to find what to set these variables: - CMAKE_SYSTEM_NAME - CMAKE_SYSTEM_PROCESSOR - CMAKE_SYSTEM_VERSION - CMAKE_HOST_SYSTEM_NAME - CMAKE_HOST_SYSTEM_PROCESSOR - CMAKE_HOST_SYSTEM_VERSION
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r-- | pkgs/stdenv/generic/make-derivation.nix | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 2db40fc43e36..e06faed30a1e 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -41,6 +41,7 @@ rec { # Configure Phase , configureFlags ? [] + , cmakeFlags ? [] , # Target is not included by default because most programs don't care. # Including it then would cause needless mass rebuilds. # @@ -225,6 +226,17 @@ rec { inherit doCheck doInstallCheck; inherit outputs; + } // lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) { + cmakeFlags = + (/**/ if lib.isString cmakeFlags then [cmakeFlags] + else if cmakeFlags == null then [] + else cmakeFlags) + ++ lib.optional (stdenv.hostPlatform.uname.system != null) "-DCMAKE_SYSTEM_NAME=${stdenv.hostPlatform.uname.system}" + ++ lib.optional (stdenv.hostPlatform.uname.processor != null) "-DCMAKE_SYSTEM_PROCESSOR=${stdenv.hostPlatform.uname.processor}" + ++ lib.optional (stdenv.hostPlatform.uname.release != null) "-DCMAKE_SYSTEM_VERSION=${stdenv.hostPlatform.release}" + ++ lib.optional (stdenv.buildPlatform.uname.system != null) "-DCMAKE_HOST_SYSTEM_NAME=${stdenv.buildPlatform.uname.system}" + ++ lib.optional (stdenv.buildPlatform.uname.processor != null) "-DCMAKE_HOST_SYSTEM_PROCESSOR=${stdenv.buildPlatform.uname.processor}" + ++ lib.optional (stdenv.buildPlatform.uname.release != null) "-DCMAKE_HOST_SYSTEM_VERSION=${stdenv.buildPlatform.uname.release}"; } // lib.optionalAttrs (attrs.enableParallelBuilding or false) { enableParallelChecking = attrs.enableParallelChecking or true; } // lib.optionalAttrs (hardeningDisable != [] || hardeningEnable != []) { |