Files
IUP_Nix/cd.nix
T
2026-03-07 15:25:26 +01:00

91 lines
1.8 KiB
Nix

{ stdenv
, fetchurl
, lsb-release
, pkg-config
, gtk2
, im
, libGLU
, ftgl
, lua51Packages
, lib
}:
stdenv.mkDerivation rec {
pname = "cd";
version = "5.14";
src = fetchurl {
url = "mirror://sourceforge/canvasdraw/${version}/Docs%20and%20Sources/${pname}-${version}_Sources.tar.gz";
sha256 = "sha256-xE7cBBExyaakKTPIeaZE1r2CjWCyikuFWpzeYV/Fr08=";
};
nativeBuildInputs = [
lsb-release
pkg-config
];
buildInputs = [
gtk2
libGLU
ftgl
lua51Packages.lua
];
propagatedBuildInputs = [
im
];
postPatch = ''
patchShebangs .
sed -i 's/\bcdpdf\b//g' src/Makefile
sed -i 's/\bcdluapdf5\b//g' src/Makefile
'';
makeFlags = [ "NO_DEPEND=Yes" "USE_PKGCONFIG=Yes" ];
NIX_CFLAGS_COMPILE = ''
-Wno-implicit-function-declaration
-Wno-incompatible-pointer-types
'';
pc = ''
prefix=${placeholder "out"}
exec_prefix=${placeholder "out"}
libdir=${placeholder "out"}/lib
includedir=${placeholder "out"}/include
Name: CD
Description: A vector graphics toolkit with device independent output
Version: ${version}
Libs: -L${placeholder "out"}/lib -lcd
Cflags: -I${placeholder "out"}/include
Requires: im gtk+-2.0 glu ftgl
'';
installPhase = ''
runHook preInstall
mkdir -p $out/{include,lib/pkgconfig}
cp -vr include/* $out/include/
cp -v lib/Linux*/*.so $out/lib/
cp -v lib/Linux*/*.a $out/lib/ || true
cp -v lib/Linux*/Lua*/*.so $out/lib/
cp -v lib/Linux*/Lua*/*.a $out/lib/ || true
cat > $out/lib/pkgconfig/cd.pc <<EOF
${pc}
EOF
runHook postInstall
'';
meta = with lib; {
description = "A vector graphics toolkit with device independent output";
license = licenses.mit;
maintainers = [ eko5z ];
platforms = with platforms; gnu ++ linux ++ darwin;
};
}