nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv, fetchgit, fetchpatch, flex, bison, pkgconfig, python2, swig, which }:
2
3stdenv.mkDerivation rec {
4 pname = "dtc";
5 version = "1.4.7";
6
7 src = fetchgit {
8 url = "https://git.kernel.org/pub/scm/utils/dtc/dtc.git";
9 rev = "refs/tags/v${version}";
10 sha256 = "0l787g1wmd4d6izsp91m5r2qms2h2jg2hhzllfi9qkbnplyz21wn";
11 };
12
13 nativeBuildInputs = [ flex bison pkgconfig swig which ];
14 buildInputs = [ python2 ];
15
16 patches = [
17 # Fix setup.py
18 (fetchpatch {
19 url = "https://github.com/dezgeg/dtc/commit/d94a745148ba5c9198143ccc0f7d877fe498ab73.patch";
20 sha256 = "0hpryx04j1swvmjisrfhvss08zzz4nxz9iv72lp4jdgg6vg0argl";
21 })
22 ];
23 postPatch = ''
24 patchShebangs pylibfdt/
25 '';
26
27 installFlags = [ "INSTALL=install" "PREFIX=$(out)" "SETUP_PREFIX=$(out)" ];
28
29 meta = with stdenv.lib; {
30 description = "Device Tree Compiler";
31 homepage = https://git.kernel.org/cgit/utils/dtc/dtc.git;
32 license = licenses.gpl2; # dtc itself is GPLv2, libfdt is dual GPL/BSD
33 maintainers = [ maintainers.dezgeg ];
34 platforms = platforms.unix;
35 };
36}