15 , gobject-introspection
65 , enableGeoLocation ? true
66 , withLibsecret ? true
67 , systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd
71 stdenv.mkDerivation (finalAttrs: {
74 name = "${finalAttrs.pname}-${finalAttrs.version}+abi=${if lib.versionAtLeast gtk3.version "4.0" then "6.0" else "4.${if lib.versions.major libsoup.version == "2" then "0" else "1"}"}";
76 outputs = [ "out" "dev" "devdoc" ];
78 # https://github.com/NixOS/nixpkgs/issues/153528
79 # Can't be linked within a 4GB address space.
80 separateDebugInfo = stdenv.isLinux && !stdenv.is32bit;
83 url = "https://webkitgtk.org/releases/webkitgtk-${finalAttrs.version}.tar.xz";
84 hash = "sha256-VyCqPoYn8bn2MlIYfU3w+CM65x1pexeW6/vlynUL0Rg=";
87 patches = lib.optionals stdenv.isLinux [
89 src = ./fix-bubblewrap-paths.patch;
90 inherit (builtins) storeDir;
91 inherit (addOpenGLRunpath) driverLink;
94 # Hardcode path to WPE backend
95 # https://github.com/NixOS/nixpkgs/issues/110468
97 src = ./fdo-backend-path.patch;
98 wpebackend_fdo = libwpe-fdo;
102 preConfigure = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
103 # Ignore gettext in cmake_prefix_path so that find_program doesn't
104 # pick up the wrong gettext. TODO: Find a better solution for
105 # this, maybe make cmake not look up executables in
107 cmakeFlags+=" -DCMAKE_IGNORE_PATH=${lib.getBin gettext}/bin"
110 nativeBuildInputs = [
114 gobject-introspection
118 perl.pkgs.FileCopyRecursive # used by copy-user-interface-resources.pl
123 glib # for gdbus-codegen
125 ] ++ lib.optionals stdenv.isLinux [
126 wayland # for wayland-scanner
141 mesa # for libEGL headers
163 ]) ++ lib.optionals stdenv.isDarwin [
166 ] ++ lib.optional (stdenv.isDarwin && !stdenv.isAarch64) (
167 # Pull a header that contains a definition of proc_pid_rusage().
168 # (We pick just that one because using the other headers from `sdk` is not
169 # compatible with our C++ standard library. This header is already in
170 # the standard library on aarch64)
171 runCommand "webkitgtk_headers" { } ''
172 install -Dm444 "${lib.getDev apple_sdk.sdk}"/include/libproc.h "$out"/include/libproc.h
174 ) ++ lib.optionals stdenv.isLinux [
180 ] ++ lib.optionals systemdSupport [
182 ] ++ lib.optionals enableGeoLocation [
184 ] ++ lib.optionals withLibsecret [
186 ] ++ lib.optionals (lib.versionAtLeast gtk3.version "4.0") [
191 propagatedBuildInputs = [
197 cmakeBool = x: if x then "ON" else "OFF";
199 "-DENABLE_INTROSPECTION=ON"
201 "-DUSE_LIBHYPHEN=OFF"
202 "-DUSE_SOUP2=${cmakeBool (lib.versions.major libsoup.version == "2")}"
203 "-DUSE_LIBSECRET=${cmakeBool withLibsecret}"
204 ] ++ lib.optionals stdenv.isLinux [
205 # Have to be explicitly specified when cross.
206 # https://github.com/WebKit/WebKit/commit/a84036c6d1d66d723f217a4c29eee76f2039a353
207 "-DBWRAP_EXECUTABLE=${lib.getExe bubblewrap}"
208 "-DDBUS_PROXY_EXECUTABLE=${lib.getExe xdg-dbus-proxy}"
209 ] ++ lib.optionals stdenv.isDarwin [
210 "-DENABLE_GAMEPAD=OFF"
211 "-DENABLE_GTKDOC=OFF"
212 "-DENABLE_MINIBROWSER=OFF"
213 "-DENABLE_QUARTZ_TARGET=ON"
214 "-DENABLE_X11_TARGET=OFF"
215 "-DUSE_APPLE_ICU=OFF"
216 "-DUSE_OPENGL_OR_ES=OFF"
217 ] ++ lib.optionals (lib.versionAtLeast gtk3.version "4.0") [
219 ] ++ lib.optionals (!systemdSupport) [
220 "-DENABLE_JOURNALD_LOG=OFF"
228 # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
229 moveToOutput "share/doc" "$devdoc"
232 requiredSystemFeatures = [ "big-parallel" ];
234 passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
237 description = "Web content rendering engine, GTK port";
238 homepage = "https://webkitgtk.org/";
239 license = licenses.bsd2;
241 "javascriptcoregtk-4.0"
243 "webkit2gtk-web-extension-4.0"
245 platforms = platforms.linux ++ platforms.darwin;
246 maintainers = teams.gnome.members;
247 broken = stdenv.isDarwin;