@@ -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
3+}:
24
35stdenv.mkDerivation rec {
46 pname = "dtc";
@@ -10,16 +12,17 @@ stdenv.mkDerivation rec {
1012 sha256 = "075gj8bbahfdb8dlif3d2dpzjrkyf3bwbcmx96zpwhlgs0da8jxh";
1113 };
1214
13− nativeBuildInputs = [ flex bison pkgconfig swig which ];
14− buildInputs = [ python2 ];
15+ nativeBuildInputs = [ flex bison pkgconfig which ] ++ lib.optionals pythonSupport [ python2 swig ];
16+ buildInputs = lib.optionals pythonSupport [ python2 ];
1517
1618 postPatch = ''
1719 patchShebangs pylibfdt/
1820 '';
1921
22+ makeFlags = lib.optionals (!pythonSupport) [ "NO_PYTHON=1" ];
2023 installFlags = [ "INSTALL=install" "PREFIX=$(out)" "SETUP_PREFIX=$(out)" ];
2124
22− meta = with stdenv.lib; {
25+ meta = with lib; {
2326 description = "Device Tree Compiler";
2427 homepage = https://git.kernel.org/cgit/utils/dtc/dtc.git;
2528 license = licenses.gpl2; # dtc itself is GPLv2, libfdt is dual GPL/BSD