1{
2 stdenv,
3 fetchurl,
4 pkg-config,
5 lib,
6 zlib,
7 ghostscript,
8 imagemagick,
9 plotutils,
10 gd,
11 libjpeg,
12 libwebp,
13 libiconv,
14 makeWrapper,
15}:
16
17stdenv.mkDerivation rec {
18 pname = "pstoedit";
19 version = "4.02";
20
21 src = fetchurl {
22 url = "mirror://sourceforge/pstoedit/pstoedit-${version}.tar.gz";
23 hash = "sha256-VYi0MtLGsq2YKLRJFepYE/+aOjMSpB+g3kw43ayd9y8=";
24 };
25
26 postPatch = ''
27 # don't use gnu-isms like link.h on macos
28 substituteInPlace src/pstoedit.cpp --replace-fail '#ifndef _MSC_VER' '#if !defined(_MSC_VER) && !defined(__APPLE__)'
29 '';
30
31 outputs = [
32 "out"
33 "dev"
34 ];
35 nativeBuildInputs = [
36 makeWrapper
37 pkg-config
38 ];
39 buildInputs = [
40 zlib
41 ghostscript
42 imagemagick
43 plotutils
44 gd
45 libjpeg
46 libwebp
47 ]
48 ++ lib.optionals stdenv.hostPlatform.isDarwin [
49 libiconv
50 ];
51
52 postInstall = ''
53 wrapProgram $out/bin/pstoedit \
54 --prefix PATH : ${lib.makeBinPath [ ghostscript ]}
55 '';
56
57 meta = with lib; {
58 description = "Translates PostScript and PDF graphics into other vector formats";
59 homepage = "https://sourceforge.net/projects/pstoedit/";
60 license = licenses.gpl2Plus;
61 maintainers = [ maintainers.marcweber ];
62 platforms = platforms.unix;
63 mainProgram = "pstoedit";
64 };
65}