@@ -1,4 +1,6 @@
1−{ stdenv, fetchgit, flex, bison, pkgconfig, python2, swig, which }:
1+{ stdenv, lib, fetchgit, flex, bison, pkgconfig, which
2+, pythonSupport ? stdenv.buildPlatform == stdenv.hostPlatform, python2, swig
3stdenv.mkDerivation rec {
5stdenv.mkDerivation rec {
4 pname = "dtc";
6 pname = "dtc";
@@ -10,16 +12,17 @@ stdenv.mkDerivation rec {
10 sha256 = "075gj8bbahfdb8dlif3d2dpzjrkyf3bwbcmx96zpwhlgs0da8jxh";
12 sha256 = "075gj8bbahfdb8dlif3d2dpzjrkyf3bwbcmx96zpwhlgs0da8jxh";
13− nativeBuildInputs = [ flex bison pkgconfig swig which ];
15+ nativeBuildInputs = [ flex bison pkgconfig which ] ++ lib.optionals pythonSupport [ python2 swig ];
14− buildInputs = [ python2 ];
16+ buildInputs = lib.optionals pythonSupport [ python2 ];
16 postPatch = ''
18 postPatch = ''
17 patchShebangs pylibfdt/
19 patchShebangs pylibfdt/
22+ makeFlags = lib.optionals (!pythonSupport) [ "NO_PYTHON=1" ];
20 installFlags = [ "INSTALL=install" "PREFIX=$(out)" "SETUP_PREFIX=$(out)" ];
23 installFlags = [ "INSTALL=install" "PREFIX=$(out)" "SETUP_PREFIX=$(out)" ];
22− meta = with stdenv.lib; {
25+ meta = with lib; {
23 description = "Device Tree Compiler";
26 description = "Device Tree Compiler";
24 homepage = https://git.kernel.org/cgit/utils/dtc/dtc.git;
27 homepage = https://git.kernel.org/cgit/utils/dtc/dtc.git;
25 license = licenses.gpl2; # dtc itself is GPLv2, libfdt is dual GPL/BSD
28 license = licenses.gpl2; # dtc itself is GPLv2, libfdt is dual GPL/BSD