gphoto2: remove patch already applied upstream (#380232)
[NixPkgs.git] / pkgs / development / web / playwright / webkit.nix
blobdda53162cc597d951f0016b09b4e09b62529b5ca
2   lib,
3   stdenv,
4   fetchzip,
5   fetchFromGitHub,
6   makeWrapper,
7   autoPatchelfHook,
8   patchelfUnstable,
9   fetchpatch,
10   libjxl,
11   brotli,
12   at-spi2-atk,
13   cairo,
14   flite,
15   fontconfig,
16   freetype,
17   glib,
18   glib-networking,
19   gst_all_1,
20   harfbuzz,
21   harfbuzzFull,
22   icu70,
23   lcms,
24   libavif,
25   libdrm,
26   libepoxy,
27   libevent,
28   libgcc,
29   libgcrypt,
30   libgpg-error,
31   libjpeg8,
32   libopus,
33   libpng,
34   libsoup_3,
35   libtasn1,
36   libvpx,
37   libwebp,
38   libwpe,
39   libwpe-fdo,
40   libxkbcommon,
41   libxml2,
42   libxslt,
43   libgbm,
44   sqlite,
45   systemdLibs,
46   wayland-scanner,
47   woff2,
48   zlib,
49   suffix,
50   revision,
51   system,
52   throwSystem,
54 let
55   suffix' =
56     if lib.hasPrefix "linux" suffix then
57       "ubuntu-22.04" + (lib.removePrefix "linux" suffix)
58     else if lib.hasPrefix "mac" suffix then
59       "mac-14" + (lib.removePrefix "mac" suffix)
60     else
61       suffix;
62   libvpx' = libvpx.overrideAttrs (
63     finalAttrs: previousAttrs: {
64       version = "1.12.0";
65       src = fetchFromGitHub {
66         owner = "webmproject";
67         repo = finalAttrs.pname;
68         rev = "v${finalAttrs.version}";
69         sha256 = "sha256-9SFFE2GfYYMgxp1dpmL3STTU2ea1R5vFKA1L0pZwIvQ=";
70       };
71     }
72   );
73   libavif' = libavif.overrideAttrs (
74     finalAttrs: previousAttrs: {
75       version = "0.9.3";
76       src = fetchFromGitHub {
77         owner = "AOMediaCodec";
78         repo = finalAttrs.pname;
79         rev = "v${finalAttrs.version}";
80         hash = "sha256-ME/mkaHhFeHajTbc7zhg9vtf/8XgkgSRu9I/mlQXnds=";
81       };
82       postPatch = "";
83     }
84   );
86   libjxl' = libjxl.overrideAttrs (
87     finalAttrs: previousAttrs: {
88       version = "0.8.2";
89       src = fetchFromGitHub {
90         owner = "libjxl";
91         repo = "libjxl";
92         rev = "v${finalAttrs.version}";
93         hash = "sha256-I3PGgh0XqRkCFz7lUZ3Q4eU0+0GwaQcVb6t4Pru1kKo=";
94         fetchSubmodules = true;
95       };
96       patches = [
97         # Add missing <atomic> content to fix gcc compilation for RISCV architecture
98         # https://github.com/libjxl/libjxl/pull/2211
99         (fetchpatch {
100           url = "https://github.com/libjxl/libjxl/commit/22d12d74e7bc56b09cfb1973aa89ec8d714fa3fc.patch";
101           hash = "sha256-X4fbYTMS+kHfZRbeGzSdBW5jQKw8UN44FEyFRUtw0qo=";
102         })
103       ];
104       postPatch = "";
105       postInstall = "";
107       cmakeFlags =
108         [
109           "-DJPEGXL_FORCE_SYSTEM_BROTLI=ON"
110           "-DJPEGXL_FORCE_SYSTEM_HWY=ON"
111           "-DJPEGXL_FORCE_SYSTEM_GTEST=ON"
112         ]
113         ++ lib.optionals stdenv.hostPlatform.isStatic [
114           "-DJPEGXL_STATIC=ON"
115         ]
116         ++ lib.optionals stdenv.hostPlatform.isAarch32 [
117           "-DJPEGXL_FORCE_NEON=ON"
118         ];
119     }
120   );
121   webkit-linux = stdenv.mkDerivation {
122     name = "playwright-webkit";
123     src = fetchzip {
124       url = "https://playwright.azureedge.net/builds/webkit/${revision}/webkit-${suffix'}.zip";
125       stripRoot = false;
126       hash =
127         {
128           x86_64-linux = "sha256-jw/wQ2Ql7KNpquz5CK+Mo6nPcCbMf8jeSQT64Vt/sLs=";
129           aarch64-linux = "sha256-vKAvl1kMxTE4CsDryseWF5lxf2iYOYkHHXAdPCnfnHk=";
130         }
131         .${system} or throwSystem;
132     };
134     nativeBuildInputs = [
135       autoPatchelfHook
136       patchelfUnstable
137       makeWrapper
138     ];
139     buildInputs = [
140       at-spi2-atk
141       cairo
142       flite
143       fontconfig.lib
144       freetype
145       glib
146       brotli
147       libjxl'
148       gst_all_1.gst-plugins-bad
149       gst_all_1.gst-plugins-base
150       gst_all_1.gstreamer
151       harfbuzz
152       harfbuzzFull
153       icu70
154       lcms
155       libavif'
156       libdrm
157       libepoxy
158       libevent
159       libgcc.lib
160       libgcrypt
161       libgpg-error
162       libjpeg8
163       libopus
164       libpng
165       libsoup_3
166       libtasn1
167       libwebp
168       libwpe
169       libwpe-fdo
170       libvpx'
171       libxml2
172       libxslt
173       libgbm
174       sqlite
175       systemdLibs
176       wayland-scanner
177       woff2.lib
178       libxkbcommon
179       zlib
180     ];
182     patchelfFlags = [ "--no-clobber-old-sections" ];
183     buildPhase = ''
184       cp -R . $out
186       # remove unused gtk browser
187       rm -rf $out/minibrowser-gtk
188       # remove bundled libs
189       rm -rf $out/minibrowser-wpe/sys
191       # TODO: still fails on ubuntu trying to find libEGL_mesa.so.0
192       wrapProgram $out/minibrowser-wpe/bin/MiniBrowser \
193         --prefix GIO_EXTRA_MODULES ":" "${glib-networking}/lib/gio/modules/" \
194         --prefix LD_LIBRARY_PATH ":" $out/minibrowser-wpe/lib
196     '';
197   };
198   webkit-darwin = fetchzip {
199     url = "https://playwright.azureedge.net/builds/webkit/${revision}/webkit-${suffix'}.zip";
200     stripRoot = false;
201     hash =
202       {
203         x86_64-darwin = "sha256-6GpzcA77TthcZEtAC7s3dVpnLk31atw7EPxKUZeC5i4=";
204         aarch64-darwin = "sha256-lDyeehVveciOsm4JZvz7CPphkl/ryRK1rz7DOcEDzYc=";
205       }
206       .${system} or throwSystem;
207   };
210   x86_64-linux = webkit-linux;
211   aarch64-linux = webkit-linux;
212   x86_64-darwin = webkit-darwin;
213   aarch64-darwin = webkit-darwin;
215 .${system} or throwSystem