depot/third_party/nixpkgs/pkgs/development/compilers/dtc/default.nix
Default email 889482aab3 Project import generated by Copybara.
GitOrigin-RevId: f2537a505d45c31fe5d9c27ea9829b6f4c4e6ac5
2022-06-26 12:26:21 +02:00

55 lines
1.3 KiB
Nix

{ stdenv
, lib
, fetchgit
, fetchpatch
, flex
, bison
, pkg-config
, which
, pythonSupport ? false
, python ? null
, swig
, libyaml
}:
stdenv.mkDerivation rec {
pname = "dtc";
version = "1.6.1";
src = fetchgit {
url = "https://git.kernel.org/pub/scm/utils/dtc/dtc.git";
rev = "refs/tags/v${version}";
sha256 = "sha256-gx9LG3U9etWhPxm7Ox7rOu9X5272qGeHqZtOe68zFs4=";
};
patches = [
# fix python 3.10 compatibility
# based on without requiring the setup.py rework
# https://git.kernel.org/pub/scm/utils/dtc/dtc.git/commit/?id=383e148b70a47ab15f97a19bb999d54f9c3e810f
./python-3.10.patch
];
nativeBuildInputs = [ flex bison pkg-config which ]
++ lib.optionals pythonSupport [ python swig ];
buildInputs = [ libyaml ];
postPatch = ''
patchShebangs pylibfdt/
'';
makeFlags = [ "PYTHON=python" ];
installFlags = [ "INSTALL=install" "PREFIX=$(out)" "SETUP_PREFIX=$(out)" ];
# Checks are broken on aarch64 darwin
# https://github.com/NixOS/nixpkgs/pull/118700#issuecomment-885892436
doCheck = !stdenv.isDarwin;
meta = with lib; {
description = "Device Tree Compiler";
homepage = "https://git.kernel.org/pub/scm/utils/dtc/dtc.git";
license = licenses.gpl2Plus; # dtc itself is GPLv2, libfdt is dual GPL/BSD
maintainers = [ maintainers.dezgeg ];
platforms = platforms.unix;
};
}