124 lines
2.8 KiB
Nix
124 lines
2.8 KiB
Nix
{ builtins
|
|
, stdenv
|
|
, fetchurl
|
|
, lsb-release
|
|
, pkg-config
|
|
, gtk2
|
|
, gtk3
|
|
, im
|
|
, libGL
|
|
, libGLU
|
|
, lua
|
|
, ftgl-tecgraf
|
|
, lib
|
|
, withGTK3 ? false
|
|
}:
|
|
|
|
let
|
|
makePc = import ./make-pc.nix { inherit lib builtins; };
|
|
in 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 = [
|
|
(if withGTK3 then gtk3 else gtk2)
|
|
libGL
|
|
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"
|
|
"GTK_DEFAULT=Yes"
|
|
|
|
"FTGL_LIB=${ftgl-tecgraf}/lib"
|
|
"FTGL_INC=${ftgl-tecgraf}/include"
|
|
] ++ (if withGTK3 then [ "USE_GTK3=Yes" ] else [ "USE_GTK2=Yes" ]);
|
|
|
|
NIX_CFLAGS_COMPILE = ''
|
|
-Wno-incompatible-pointer-types
|
|
'';
|
|
|
|
cdPc = builtins.toFile "cd.pc" (makePc
|
|
"cd"
|
|
"A vector graphics toolkit with device independent output"
|
|
version
|
|
(if withGTK3 then "gdk-3.0 pango" else "gdk-2.0 pango")
|
|
);
|
|
|
|
cdcontextplusPc = builtins.toFile "cdcontextplus.pc" (makePc
|
|
"cdcontextplus"
|
|
"A vector graphics toolkit with device independent output (dynamic driver loader)"
|
|
version
|
|
"pangocairo cairo"
|
|
);
|
|
|
|
cdglPc = builtins.toFile "cdgl.pc" (makePc
|
|
"cdgl"
|
|
"A vector graphics toolkit with device independent output (OpenGL driver)"
|
|
version
|
|
"gl"
|
|
);
|
|
|
|
cdimPc = builtins.toFile "cdim.pc" (makePc
|
|
"cdim"
|
|
"A vector graphics toolkit with device independent output (IM support)"
|
|
version
|
|
"im"
|
|
);
|
|
|
|
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
|
|
|
|
cp -v ${cdPc} $out/lib/pkgconfig/cd.pc
|
|
cp -v ${cdcontextplusPc} $out/lib/pkgconfig/cdcontextplus.pc
|
|
cp -v ${cdglPc} $out/lib/pkgconfig/cdgl.pc
|
|
cp -v ${cdimPc} $out/lib/pkgconfig/cdim.pc
|
|
|
|
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;
|
|
};
|
|
}
|