about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/gd/default.nix
blob: af96d9d06d27b500f754c163dbec3e6587a02f16 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
{ lib
, stdenv
, fetchurl
, fetchpatch
, autoconf
, automake
, pkg-config
, zlib
, libpng
, libjpeg
, libwebp
, libtiff
, withXorg ? true
, libXpm
, libavif
, fontconfig
, freetype
}:

stdenv.mkDerivation rec {
  pname = "gd";
  version = "2.3.3";

  src = fetchurl {
    url = "https://github.com/libgd/libgd/releases/download/${pname}-${version}/libgd-${version}.tar.xz";
    sha256 = "0qas3q9xz3wgw06dm2fj0i189rain6n60z1vyq50d5h7wbn25s1z";
  };

  patches = [
    (fetchpatch { # included in > 2.3.3
      name = "restore-GD_FLIP.patch";
      url = "https://github.com/libgd/libgd/commit/f4bc1f5c26925548662946ed7cfa473c190a104a.diff";
      sha256 = "XRXR3NOkbEub3Nybaco2duQk0n8vxif5mTl2AUacn9w=";
    })
  ];

  hardeningDisable = [ "format" ];

  configureFlags = [
    "--enable-gd-formats"
  ]
    # -pthread gets passed to clang, causing warnings
    ++ lib.optional stdenv.isDarwin "--enable-werror=no";

  nativeBuildInputs = [ autoconf automake pkg-config ];

  buildInputs = [ zlib freetype libpng libjpeg libwebp libtiff libavif ]
    ++ lib.optionals withXorg [ fontconfig libXpm ];

  outputs = [ "bin" "dev" "out" ];

  postFixup = ''
    moveToOutput "bin/gdlib-config" $dev
  '';

  enableParallelBuilding = true;

  doCheck = false; # fails 2 tests

  meta = with lib; {
    homepage = "https://libgd.github.io/";
    description = "A dynamic image creation library";
    license = licenses.free; # some custom license
    platforms = platforms.unix;
    maintainers = with maintainers; [ ];
  };
}