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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
{
lib,
stdenv,
fetchzip,
fetchFromGitHub,
makeWrapper,
autoPatchelfHook,
patchelfUnstable,
fetchpatch,
libjxl,
brotli,
at-spi2-atk,
cairo,
flite,
fontconfig,
freetype,
glib,
glib-networking,
gst_all_1,
harfbuzz,
harfbuzzFull,
hyphen,
icu74,
lcms,
libavif,
libdrm,
libepoxy,
libevent,
libgcc,
libgcrypt,
libgpg-error,
libjpeg8,
libopus,
libpng,
libsoup_3,
libtasn1,
libvpx,
libwebp,
libwpe,
libwpe-fdo,
libxkbcommon,
libxml2_13,
libxslt,
libgbm,
sqlite,
systemdLibs,
wayland-scanner,
woff2,
zlib,
revision,
system,
throwSystem,
}:
let
download =
(import ./browser-downloads.nix {
name = "webkit";
inherit revision;
}).${system} or throwSystem;
libvpx' = libvpx.overrideAttrs (
finalAttrs: previousAttrs: {
version = "1.12.0";
src = fetchFromGitHub {
owner = "webmproject";
repo = finalAttrs.pname;
rev = "v${finalAttrs.version}";
sha256 = "sha256-9SFFE2GfYYMgxp1dpmL3STTU2ea1R5vFKA1L0pZwIvQ=";
};
}
);
libjxl' = libjxl.overrideAttrs (
finalAttrs: previousAttrs: {
version = "0.8.2";
src = fetchFromGitHub {
owner = "libjxl";
repo = "libjxl";
rev = "v${finalAttrs.version}";
hash = "sha256-I3PGgh0XqRkCFz7lUZ3Q4eU0+0GwaQcVb6t4Pru1kKo=";
fetchSubmodules = true;
};
patches = [
# Add missing <atomic> content to fix gcc compilation for RISCV architecture
# https://github.com/libjxl/libjxl/pull/2211
(fetchpatch {
url = "https://github.com/libjxl/libjxl/commit/22d12d74e7bc56b09cfb1973aa89ec8d714fa3fc.patch";
hash = "sha256-X4fbYTMS+kHfZRbeGzSdBW5jQKw8UN44FEyFRUtw0qo=";
})
];
postPatch = ''
# Fix multiple definition errors by using C++17 instead of C++11
substituteInPlace CMakeLists.txt \
--replace "set(CMAKE_CXX_STANDARD 11)" "set(CMAKE_CXX_STANDARD 17)"
# Fix the build with CMake 4.
# See:
# * <https://github.com/webmproject/sjpeg/commit/9990bdceb22612a62f1492462ef7423f48154072>
# * <https://github.com/webmproject/sjpeg/commit/94e0df6d0f8b44228de5be0ff35efb9f946a13c9>
substituteInPlace third_party/sjpeg/CMakeLists.txt \
--replace-fail \
'cmake_minimum_required(VERSION 2.8.7)' \
'cmake_minimum_required(VERSION 3.5...3.10)'
'';
postInstall = "";
cmakeFlags = [
"-DJPEGXL_FORCE_SYSTEM_BROTLI=ON"
"-DJPEGXL_FORCE_SYSTEM_HWY=ON"
"-DJPEGXL_FORCE_SYSTEM_GTEST=ON"
]
++ lib.optionals stdenv.hostPlatform.isStatic [
"-DJPEGXL_STATIC=ON"
]
++ lib.optionals stdenv.hostPlatform.isAarch32 [
"-DJPEGXL_FORCE_NEON=ON"
];
}
);
webkit-linux = stdenv.mkDerivation {
name = "playwright-webkit";
src = fetchzip {
inherit (download) url stripRoot;
hash =
{
x86_64-linux = "sha256-BVIZxnnfhBvI737ojRZ+yUX8mcbQ6WOlNdYJ9t4R5yY=";
aarch64-linux = "sha256-t9kqUdyOgDXroKp7LWQsaiaRGZVZN3ZdfYLahl5GW2E=";
}
.${system} or throwSystem;
};
nativeBuildInputs = [
autoPatchelfHook
patchelfUnstable
makeWrapper
];
buildInputs = [
at-spi2-atk
cairo
flite
fontconfig.lib
freetype
glib
brotli
libjxl'
gst_all_1.gst-plugins-bad
gst_all_1.gst-plugins-base
gst_all_1.gstreamer
harfbuzz
harfbuzzFull
hyphen
icu74
lcms
libavif
libdrm
libepoxy
libevent
libgcc.lib
libgcrypt
libgpg-error
libjpeg8
libopus
libpng
libsoup_3
libtasn1
libwebp
libwpe
libwpe-fdo
libvpx'
libxml2_13
libxslt
libgbm
sqlite
systemdLibs
wayland-scanner
woff2.lib
libxkbcommon
zlib
];
patchelfFlags = [ "--no-clobber-old-sections" ];
buildPhase = ''
cp -R . $out
# remove unused gtk browser
rm -rf $out/minibrowser-gtk
# remove bundled libs
rm -rf $out/minibrowser-wpe/sys
wrapProgram $out/minibrowser-wpe/bin/MiniBrowser \
--prefix GIO_EXTRA_MODULES ":" "${glib-networking}/lib/gio/modules/" \
--prefix LD_LIBRARY_PATH ":" $out/minibrowser-wpe/lib
'';
};
webkit-darwin = fetchzip {
inherit (download) url stripRoot;
hash =
{
x86_64-darwin = "sha256-NjuRZrYzraE1FrPAmyMcQFAS2zWZXYe8cBQVbSU6zFw=";
aarch64-darwin = "sha256-9g7YHg+TQNmAE07K6jKSSRUJ7IENUQMp2q54Mk2BbaY=";
}
.${system} or throwSystem;
};
in
{
x86_64-linux = webkit-linux;
aarch64-linux = webkit-linux;
x86_64-darwin = webkit-darwin;
aarch64-darwin = webkit-darwin;
}
.${system} or throwSystem
|