1{
2 lib,
3 stdenv,
4 fetchurl,
5 autoconf,
6 automake,
7 libtool,
8 pkg-config,
9 freetype,
10 SDL,
11 libX11,
12}:
13
14stdenv.mkDerivation rec {
15 pname = "agg";
16 version = "2.5";
17 src = fetchurl {
18 url = "https://www.antigrain.com/agg-${version}.tar.gz";
19 sha256 = "07wii4i824vy9qsvjsgqxppgqmfdxq0xa87i5yk53fijriadq7mb";
20 };
21 nativeBuildInputs = [
22 pkg-config
23 autoconf
24 automake
25 libtool
26 ];
27 buildInputs = [
28 freetype
29 SDL
30 ]
31 ++ lib.optionals stdenv.hostPlatform.isLinux [
32 libX11
33 ];
34
35 postPatch = ''
36 substituteInPlace include/agg_renderer_outline_aa.h \
37 --replace 'line_profile_aa& profile() {' 'const line_profile_aa& profile() {'
38 '';
39
40 # fix build with new automake, from Gentoo ebuild
41 preConfigure = ''
42 sed -i '/^AM_C_PROTOTYPES/d' configure.in
43 sh autogen.sh
44 '';
45
46 configureFlags = [
47 (lib.enableFeature stdenv.hostPlatform.isLinux "platform")
48 (lib.enableFeature (!stdenv.hostPlatform.isDarwin) "sdltest")
49 "--enable-examples=no"
50 ]
51 ++ lib.optionals stdenv.hostPlatform.isLinux [
52 "--x-includes=${lib.getDev libX11}/include"
53 "--x-libraries=${lib.getLib libX11}/lib"
54 ];
55
56 NIX_CFLAGS_COMPILE = [ "-fpermissive" ];
57
58 # libtool --tag=CXX --mode=link g++ -g -O2 libexamples.la ../src/platform/X11/libaggplatformX11.la ../src/libagg.la -o alpha_mask2 alpha_mask2.o
59 # libtool: error: cannot find the library 'libexamples.la'
60 enableParallelBuilding = false;
61
62 meta = {
63 description = "High quality rendering engine for C++";
64
65 longDescription = ''
66 Anti-Grain Geometry (AGG) is an Open Source, free of charge
67 graphic library, written in industrially standard C++. The
68 terms and conditions of use AGG are described on The License
69 page. AGG doesn't depend on any graphic API or technology.
70 Basically, you can think of AGG as of a rendering engine that
71 produces pixel images in memory from some vectorial data. But
72 of course, AGG can do much more than that.
73 '';
74
75 license = lib.licenses.gpl2Plus;
76 homepage = "http://www.antigrain.com/";
77 platforms = lib.platforms.unix;
78 hydraPlatforms = lib.platforms.linux; # build hangs on both Darwin platforms, needs investigation
79 };
80}