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