summary refs log tree commit diff
path: root/pkgs/development/libraries/webkitgtk/2.4.nix
blob: 060109072b49bade6b38ab51ee6804e5966cfa3a (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
{ stdenv, fetchurl, fetchpatch, perl, python, ruby, bison, gperf, flex
, pkgconfig, which, gettext, gobject-introspection
, gtk2, gtk3, wayland, libwebp, enchant, sqlite
, libxml2, libsoup, libsecret, libxslt, harfbuzz, xorg
, gst-plugins-base, libobjc
, withGtk2 ? false
, enableIntrospection ? !stdenv.isDarwin
, enableCredentialStorage ? !stdenv.isDarwin
, readline, libedit
}:

assert stdenv.isDarwin -> !enableIntrospection;
assert stdenv.isDarwin -> !enableCredentialStorage;

with stdenv.lib;
stdenv.mkDerivation rec {
  pname = "webkitgtk";
  version = "2.4.11";

  meta = with stdenv.lib; {
    description = "Web content rendering engine, GTK port";
    homepage = http://webkitgtk.org/;
    license = licenses.bsd2;
    platforms = with platforms; linux ++ darwin;
    maintainers = [];
    knownVulnerabilities = [
      "WSA-2016-0004"
      "WSA-2016-0005"
      "WSA-2016-0006"
      "WSA-2017-0001"
      "WSA-2017-0002"
    ];
  };

  src = fetchurl {
    url = "https://webkitgtk.org/releases/${pname}-${version}.tar.xz";
    sha256 = "1xsvnvyvlywwyf6m9ainpsg87jkxjmd37q6zgz9cxb7v3c2ym2jq";
  };

  CC = "cc";

  prePatch = ''
    patchShebangs Tools/gtk
  '';
  patches = [
    ./webcore-svg-libxml-cflags.patch
    (fetchpatch {
      url = https://raw.githubusercontent.com/gentoo/gentoo/7c5457e265bd40c156a8fe6b2ff94a4e34bcea8e/net-libs/webkit-gtk/files/webkit-gtk-2.4.9-gcc-6.patch;
      sha256 = "0ll93dr5vxd40wvly1jaw41lvw86krac0jc6k6cacrps4i5ql5j0";
    })
  ] ++ optionals stdenv.isDarwin [
    ./configure.patch
    ./quartz-webcore.patch
    ./libc++.patch
    ./plugin-none.patch
  ] ++ optionals stdenv.hostPlatform.isMusl [
    ./fix-execinfo.patch
  ];

  configureFlags = with stdenv.lib; [
    "--disable-geolocation"
    "--disable-jit"
    # needed for parallel building
    "--enable-dependency-tracking"
    (optionalString enableIntrospection "--enable-introspection")
  ] ++ optional withGtk2 [
    "--with-gtk=2.0"
  ] ++ optionals (withGtk2 || stdenv.isDarwin) [
    "--disable-webkit2"
  ] ++ optionals stdenv.isDarwin [
    "--disable-x11-target"
    "--enable-quartz-target"
    "--disable-web-audio"
    "CFLAGS=-DJSC_OBJC_API_ENABLED=0"
    "CXXFLAGS=-DJSC_OBJC_API_ENABLED=0"
  ] ++ optionals (!enableCredentialStorage) [
    "--disable-credential-storage"
  ];

  NIX_CFLAGS_COMPILE = [
    "-DU_NOEXCEPT="
    "-Wno-expansion-to-defined"
  ];

  dontAddDisableDepTrack = true;

  nativeBuildInputs = [
    perl python ruby bison gperf flex
    pkgconfig which gettext gobject-introspection
  ];

  buildInputs = [
    gtk2 libwebp enchant
    libxml2 libxslt
    gst-plugins-base sqlite xorg.libXt xorg.libXdamage
  ] ++ optionals enableCredentialStorage [
    libsecret
  ] ++ (if stdenv.isDarwin then [
    readline libedit libobjc
  ] else [
    wayland
  ]);

  propagatedBuildInputs = [
    libsoup harfbuzz/*icu in *.la*/
    (if withGtk2 then gtk2 else gtk3)
  ];

  enableParallelBuilding = true;

}