librewolf: 132.0.1 -> 132.0.1-1 (#355483)
[NixPkgs.git] / pkgs / by-name / td / tdnf / package.nix
blob315b53a8fe2fab1bbc28d49d1e7ec94876223b08
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , fetchpatch2
5 , cmake
6 , curl
7 , gpgme
8 , libsolv
9 , libxml2
10 , pkg-config
11 , python3
12 , rpm
13 , sqlite
16 stdenv.mkDerivation (finalAttrs: {
17   pname = "tdnf";
18   version = "3.5.9";
20   src = fetchFromGitHub {
21     owner = "vmware";
22     repo = "tdnf";
23     rev = "v${finalAttrs.version}";
24     hash = "sha256-p9g+b7Fqq8V6QSaikEQMMHWqBf4UtRA9a/VtH+s5JUM=";
25   };
27   patches = [
28     # Support for rpm >= 4.19
29     (fetchpatch2 {
30       url = "https://patch-diff.githubusercontent.com/raw/vmware/tdnf/pull/410.patch";
31       hash = "sha256-p/ix5O1J/lj2fw7qJokT+wPN4ROoulnVqByfxgFvuEo=";
32     })
33   ];
35   nativeBuildInputs = [
36     cmake
37     pkg-config
38     python3
39   ];
41   buildInputs = [
42     curl.dev
43     gpgme.dev
44     libsolv
45     libxml2.dev
46     sqlite.dev
47   ];
49   propagatedBuildInputs = [
50     rpm
51   ];
53   cmakeFlags = [
54     "-DCMAKE_INSTALL_PREFIX=$out"
55     "-DCMAKE_INSTALL_FULL_SYSCONDIR=$out/etc"
56     "-DCMAKE_INSTALL_SYSCONFDIR=$out/etc"
57     "-DSYSTEMD_DIR=$out/lib/systemd/system"
58   ];
60   # error: format not a string literal and no format arguments [-Werror=format-security]
61   hardeningDisable = [ "format" ];
63   postPatch = ''
64     substituteInPlace CMakeLists.txt \
65       --replace-fail 'SYSCONFDIR /etc' 'SYSCONFDIR $out/etc' \
66       --replace-fail '/etc/motdgen.d' '$out/etc/motdgen.d'
67     substituteInPlace client/tdnf.pc.in \
68       --replace-fail 'libdir=''${prefix}/@CMAKE_INSTALL_LIBDIR@' 'libdir=@CMAKE_INSTALL_FULL_LIBDIR@'
69     substituteInPlace tools/cli/lib/tdnf-cli-libs.pc.in \
70       --replace-fail 'libdir=''${prefix}/@CMAKE_INSTALL_LIBDIR@' 'libdir=@CMAKE_INSTALL_FULL_LIBDIR@'
71   '';
73   # remove binaries used for testing from the final output
74   postInstall = "rm $out/bin/*test";
76   meta = {
77     description = "Tiny Dandified Yum";
78     homepage = "https://github.com/vmware/tdnf";
79     changelog = "https://github.com/vmware/tdnf/releases/tag/v${finalAttrs.version}";
80     license = with lib.licenses; [ gpl2 lgpl21 ];
81     maintainers = [ lib.maintainers.malt3 ];
82     mainProgram = "tdnf";
83     # rpm only supports linux
84     platforms = lib.platforms.linux;
85   };