@@ -0,0 +1,61 @@
1+{ stdenv, fetchurl, callPackage, libpng12, imagemagick,
2+ autoreconfHook, glib, pstoedit, pkgconfig, gettext, darwin }:
3+
4+# TODO: Solve that it cannot find pstoedit (as it is unable to find
5+# pstoedit-config)
6+
7+# TODO: Figure out why the resultant binary is somehow linked against
8+# libpng16.so.16 rather than libpng12.
9+
10+stdenv.mkDerivation rec {
11+ name = "autotrace-${version}";
12+ version = "0.31.1";
13+
14+ src = fetchurl {
15+ url = "mirror://sourceforge/autotrace/AutoTrace/0.31.1/${name}.tar.gz";
16+ sha256 = "1xmgja5fv48mdbsa51inf7ksz36nqd6bsaybrk5xgprm6cy946js";
17+ };
18+
19+ # The below commented out part is for an identically-named project
20+ # on GitHub which appears to derive somehow from the Sourceforge
21+ # version, but I have no idea what the lineage is of this project.
22+ # It will build, but it segfaults when I attempt to run -centerline.
23+ # Someone may need this for some reason, so I've left it here.
24+ #
25+ #src = fetchFromGitHub {
26+ # owner = "autotrace";
27+ # repo = "autotrace";
28+ # rev = "b3ac8818d86943102cb4f13734e0b527c42dc45a";
29+ # sha256 = "0z5h2mvxwckk2msi361zk1nc9fdcvxyimyc2hlyqd6h8k3p7zdi4";
30+ #};
31+ #postConfigure = ''
32+ # sed -i -e "s/at_string/gchar */g" *.c
33+ # sed -i -e "s/at_address/gpointer/g" *.c
34+ # sed -i -e "s/at_bitmap_type/struct _at_bitmap/g" *.c
35+ # sed -i -e "s/AT_BITMAP_BITS(bitmap)/AT_BITMAP_BITS(\&bitmap)/g" input-magick.c
36+ #'';
37+
38+ autofig = callPackage ./autofig.nix {};
39+ nativeBuildInputs = [ autoreconfHook glib autofig pkgconfig gettext ];
40+ buildInputs = [ libpng12 imagemagick pstoedit ]
41+ ++ stdenv.lib.optionals stdenv.isDarwin
42+ (with darwin.apple_sdk.frameworks; [ApplicationServices]);
43+
44+ postUnpack = ''
45+ pushd $sourceRoot
46+ autofig autotrace-config.af
47+ popd
48+ '';
49+
50+ # This complains about various m4 files, but it appears to not be an
51+ # actual error.
52+ preConfigure = "glib-gettextize --copy --force";
53+
54+ meta = with stdenv.lib; {
55+ homepage = http://autotrace.sourceforge.net/;
56+ description = "Utility for converting bitmap into vector graphics";
57+ platforms = platforms.unix;
58+ maintainers = with maintainers; [ hodapp ];
59+ license = licenses.gpl2;
60+ };
61+}