103 lines
2.2 KiB
Nix
103 lines
2.2 KiB
Nix
{ stdenv
|
|
, fetchurl
|
|
, lsb-release
|
|
, pkg-config
|
|
, gtk3
|
|
, im
|
|
, libGLU
|
|
, lua
|
|
, ftgl-tecgraf
|
|
, 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 = [
|
|
gtk3
|
|
libGLU
|
|
lua
|
|
ftgl-tecgraf
|
|
];
|
|
|
|
propagatedBuildInputs = [
|
|
im
|
|
];
|
|
|
|
postPatch = ''
|
|
sed -i 's/\bcdpdf\b//g' src/Makefile
|
|
sed -i 's/\bcdluapdf5\b//g' src/Makefile
|
|
'';
|
|
|
|
makeFlags = [
|
|
"NO_DEPEND=Yes"
|
|
"USE_PKGCONFIG=Yes"
|
|
"USE_LUA_VERSION=52"
|
|
"USE_GTK3=Yes"
|
|
"GTK_DEFAULT=Yes"
|
|
|
|
"FTGL_LIB=${ftgl-tecgraf}/lib"
|
|
"FTGL_INC=${ftgl-tecgraf}/include"
|
|
];
|
|
|
|
NIX_CFLAGS_COMPILE = ''
|
|
-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 -lcdcontextplus -lcdgl -lcdim
|
|
Cflags: -I${placeholder "out"}/include
|
|
Requires: im gtk+-3.0 glu
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/{include,lib/pkgconfig,share/lua/5.2}
|
|
|
|
cp -v lib/Linux*/*.so $out/lib/
|
|
cp -v lib/Linux*/*.a $out/lib/ || true
|
|
cp -vr include/*.h $out/include/
|
|
|
|
cp -v lib/Linux*/Lua*/*.so $out/lib/
|
|
cp -v lib/Linux*/Lua*/*.a $out/lib/ || true
|
|
|
|
ln -fs $out/lib/libcdlua52.so $out/share/lua/5.2/cdlua.so
|
|
ln -fs $out/lib/libcdluacontextplus52.so $out/share/lua/5.2/cdluacontextplus.so
|
|
ln -fs $out/lib/libcdluagl52.so $out/share/lua/5.2/cdluagl.so
|
|
ln -fs $out/lib/libcdluaim52.so $out/share/lua/5.2/cdluaim.so
|
|
|
|
cat > $out/lib/pkgconfig/cd.pc <<EOF
|
|
${pc}
|
|
EOF
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "A vector graphics toolkit with device independent output";
|
|
license = with licenses; [ mit ];
|
|
maintainers = [ eko5z ];
|
|
platforms = with platforms; gnu ++ linux ++ darwin;
|
|
};
|
|
}
|