about summary refs log tree commit diff
path: root/pkgs/development/compilers/dtc
diff options
context:
space:
mode:
authorNick Spinale <nick@nickspinale.com>2019-09-11 13:07:31 +0000
committerNick Spinale <nick@nickspinale.com>2019-09-17 23:09:55 +0000
commit35f39ac48ce6ed046b7dcce3ee6e8e9162ac12aa (patch)
tree65f93fa997bb7082990f7052ca61312668ea4de9 /pkgs/development/compilers/dtc
parent101947774c8aea770c650b7d3b78d50c63215742 (diff)
downloadnixlib-35f39ac48ce6ed046b7dcce3ee6e8e9162ac12aa.tar
nixlib-35f39ac48ce6ed046b7dcce3ee6e8e9162ac12aa.tar.gz
nixlib-35f39ac48ce6ed046b7dcce3ee6e8e9162ac12aa.tar.bz2
nixlib-35f39ac48ce6ed046b7dcce3ee6e8e9162ac12aa.tar.lz
nixlib-35f39ac48ce6ed046b7dcce3ee6e8e9162ac12aa.tar.xz
nixlib-35f39ac48ce6ed046b7dcce3ee6e8e9162ac12aa.tar.zst
nixlib-35f39ac48ce6ed046b7dcce3ee6e8e9162ac12aa.zip
dtc: make python bindings optional
dtc's build system does not support cross-compilation of its
swig-generated python bindings.
Diffstat (limited to 'pkgs/development/compilers/dtc')
-rw-r--r--pkgs/development/compilers/dtc/default.nix11
1 files changed, 7 insertions, 4 deletions
diff --git a/pkgs/development/compilers/dtc/default.nix b/pkgs/development/compilers/dtc/default.nix
index ea305cc5c84c..dc628c0d7625 100644
--- a/pkgs/development/compilers/dtc/default.nix
+++ b/pkgs/development/compilers/dtc/default.nix
@@ -1,4 +1,6 @@
-{ stdenv, fetchgit, flex, bison, pkgconfig, python2, swig, which }:
+{ stdenv, lib, fetchgit, flex, bison, pkgconfig, which
+, pythonSupport ? stdenv.buildPlatform == stdenv.hostPlatform, python2, swig
+}:
 
 stdenv.mkDerivation rec {
   pname = "dtc";
@@ -10,16 +12,17 @@ stdenv.mkDerivation rec {
     sha256 = "075gj8bbahfdb8dlif3d2dpzjrkyf3bwbcmx96zpwhlgs0da8jxh";
   };
 
-  nativeBuildInputs = [ flex bison pkgconfig swig which ];
-  buildInputs = [ python2 ];
+  nativeBuildInputs = [ flex bison pkgconfig which ] ++ lib.optionals pythonSupport [ python2 swig ];
+  buildInputs = lib.optionals pythonSupport [ python2 ];
 
   postPatch = ''
     patchShebangs pylibfdt/
   '';
 
+  makeFlags = lib.optionals (!pythonSupport) [ "NO_PYTHON=1" ];
   installFlags = [ "INSTALL=install" "PREFIX=$(out)" "SETUP_PREFIX=$(out)" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Device Tree Compiler";
     homepage = https://git.kernel.org/cgit/utils/dtc/dtc.git;
     license = licenses.gpl2; # dtc itself is GPLv2, libfdt is dual GPL/BSD