tinycc: use makePkgconfigItem

This commit is contained in:
Artturin 2022-07-20 06:22:14 +03:00
parent 0b7a3b24d6
commit c6a9d069e9

View File

@ -1,6 +1,8 @@
{ lib
, stdenv
, fetchFromRepoOrCz
, copyPkgconfigItems
, makePkgconfigItem
, perl
, texinfo
, which
@ -17,11 +19,32 @@ stdenv.mkDerivation rec {
};
nativeBuildInputs = [
copyPkgconfigItems
perl
texinfo
which
];
pkgconfigItems = [
(makePkgconfigItem rec {
name = "libtcc";
inherit version;
cflags = [ "-I${variables.includedir}" ];
libs = [
"-L${variables.libdir}"
"-Wl,--rpath ${variables.libdir}"
"-ltcc"
"-ldl"
];
variables = rec {
prefix = "${placeholder "out"}";
includedir = "${prefix}/include";
libdir = "${prefix}/lib";
};
description = "Tiny C compiler backend";
})
];
postPatch = ''
patchShebangs texi2pod.pl
'';
@ -43,17 +66,6 @@ stdenv.mkDerivation rec {
configureFlagsArray+=("--elfinterp=$(< $NIX_CC/nix-support/dynamic-linker)")
'';
postFixup = ''
cat >libtcc.pc <<EOF
Name: libtcc
Description: Tiny C compiler backend
Version: ${version}
Libs: -L$out/lib -Wl,--rpath $out/lib -ltcc -ldl
Cflags: -I$out/include
EOF
install -Dt $out/lib/pkgconfig libtcc.pc -m 444
'';
outputs = [ "out" "info" "man" ];
doCheck = true;