blob: 16635fb39a3eb6893f38fb0698825ceb4e5b035a (
plain)
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
|
# Maintainer: zedspeirs
# Co-Maintainer: 67mustard41
pkgname=opera-gx
pkgver=136.0.6008.76
pkgrel=1
pkgdesc='Opera GX The Gaming Browser'
arch=('x86_64')
url='https://www.opera.com/gx'
license=('LicenseRef-opera')
options=(!strip !zipman)
backup=('etc/opera-gx/default')
provides=('opera-gx-browser')
conflicts=(
'opera-gx-bin'
'opera-gx-stable'
'opera-gx-stable-ffmpeg-codecs'
)
replaces=(
'opera-gx-bin'
'opera-gx-stable'
'opera-gx-stable-ffmpeg-codecs'
)
depends=(
'alsa-lib'
'atk'
'at-spi2-atk'
'at-spi2-core'
'cairo'
'curl'
'dbus'
'expat'
'gcc-libs'
'glib2'
'glibc'
'gnupg'
'gtk3'
'hicolor-icon-theme'
'libcups'
'libnotify'
'libx11'
'libxcb'
'libxcomposite'
'libxdamage'
'libxext'
'libxfixes'
'libxkbcommon'
'libxrandr'
'libxss'
'mesa'
'nspr'
'nss'
'pango'
'systemd-libs'
'ttf-font'
'xdg-utils'
)
optdepends=(
'qt5-base: Qt5 integration'
'qt6-base: Qt6 integration'
'upower: battery save support'
)
_nwjs_ffmpeg_version=0.115.0
_upstream_deb_pkg='opera-gx-stable'
_debfile="${_upstream_deb_pkg}_${pkgver}_amd64.deb"
_deburl="https://get.opera.com/pub/opera_gx/${pkgver}/linux/${_debfile}"
_ffmpeg_zip="${_nwjs_ffmpeg_version}-linux-x64.zip"
source=(
"${_deburl}"
"opera-gx"
"default"
"eula.html"
"terms.html"
"privacy.html"
"nwjs-ffmpeg-${_ffmpeg_zip}::https://github.com/nwjs-ffmpeg-prebuilt/nwjs-ffmpeg-prebuilt/releases/download/${_nwjs_ffmpeg_version}/${_ffmpeg_zip}"
)
noextract=(
"$_debfile"
"nwjs-ffmpeg-${_ffmpeg_zip}"
)
sha256sums=('5fa5fc9c2b0adfa9b0cfac707728fcac8d7657ecdbbed1fe414f7d40576774d0'
'baeb75b7d52f1f75ec46027b05f0df0f4a22d6c47ab5816562f6e183c3af4034'
'99fc0d2822edd14e234d451995db47148125e4580221a292598959421d131231'
'3c48827275d36f2a38a9ac63ce81875211f11022d390d7ada302d26e475271ea'
'd67656e82d68ab88841b3e16a24e60aabd9f242e42b7010f9613282df57d7003'
'cb50dfd6f03cafffbb0565f4cf6d8f943b2709dcdb30acc3d0a52c9c99af3e32'
'589fc1fa3f9905fe336990a2c8e16a9107c1aabdb42031b69eaf812331e5fb4a')
prepare() {
sed \
-e 's|%pkgname%|opera-gx|g' \
-e 's|%operabin%|opera-gx/opera|g' \
-i "$srcdir/opera-gx"
sed \
-e 's|%pkgname%|opera-gx|g' \
-i "$srcdir/default"
}
package() {
cd "$srcdir"
#
# Extract Debian package container.
#
bsdtar -xf "$_debfile"
#
# Debian packages may use xz, zstd, gzip, etc.
# Do not hard-code data.tar.xz.
#
local data_archive
data_archive="$(
find "$srcdir" \
-maxdepth 1 \
-type f \
-name 'data.tar.*' \
-print \
-quit
)"
if [[ -z "$data_archive" ]]; then
echo 'ERROR: data.tar.* not found in Opera GX Debian package'
return 1
fi
echo "Extracting Debian payload: ${data_archive##*/}"
bsdtar -xf "$data_archive" \
--exclude='usr/share/lintian' \
--exclude='usr/share/menu' \
-C "$pkgdir"
#
# Opera's Debian package installs its libraries into a
# Debian multiarch directory such as:
#
# /usr/lib/x86_64-linux-gnu/opera-gx/
#
# Move it to the Arch-style path:
#
# /usr/lib/opera-gx/
#
local libroot="$pkgdir/usr/lib"
local multiarch_dir
local upstream_libdir
multiarch_dir="$(
find "$libroot" \
-mindepth 1 \
-maxdepth 1 \
-type d \
-name '*-linux-gnu' \
-print \
-quit
)"
if [[ -z "$multiarch_dir" ]]; then
echo 'ERROR: multiarch library directory not found under /usr/lib'
return 1
fi
upstream_libdir="$(
find "$multiarch_dir" \
-mindepth 1 \
-maxdepth 1 \
-type d \
\( -name 'opera-gx' -o -name 'opera-gx-stable' \) \
-print \
-quit
)"
if [[ -z "$upstream_libdir" ]]; then
echo 'ERROR: upstream Opera GX payload directory not found'
return 1
fi
rm -rf "$libroot/opera-gx"
mv "$upstream_libdir" "$libroot/opera-gx"
#
# Remove the now-unused Debian multiarch directory.
#
rm -rf "$multiarch_dir"
#
# Install NW.js FFmpeg codec library.
#
bsdtar -xf "nwjs-ffmpeg-${_ffmpeg_zip}"
local ffmpeg_so
ffmpeg_so="$(
find "$srcdir" \
-type f \
-name 'libffmpeg.so' \
-print \
-quit
)"
if [[ -z "$ffmpeg_so" ]]; then
echo "ERROR: libffmpeg.so not found in $_ffmpeg_zip"
return 1
fi
rm -f "$pkgdir/usr/lib/opera-gx/libffmpeg.so"
install -Dm755 "$ffmpeg_so" \
"$pkgdir/usr/lib/opera-gx/libffmpeg.so"
#
# Chromium sandbox requires setuid root when provided by upstream.
#
if [[ -f "$pkgdir/usr/lib/opera-gx/opera_sandbox" ]]; then
chmod 4755 "$pkgdir/usr/lib/opera-gx/opera_sandbox"
fi
#
# Install Opera GX defaults.
#
install -Dm644 "$srcdir/default" \
"$pkgdir/etc/opera-gx/default"
#
# Replace upstream launcher with our Arch launcher.
#
rm -f "$pkgdir/usr/bin/opera-gx"
rm -f "$pkgdir/usr/bin/${_upstream_deb_pkg}"
install -Dm755 "$srcdir/opera-gx" \
"$pkgdir/usr/bin/opera-gx"
#
# Keep upstream executable name as compatibility symlink.
#
ln -sf opera-gx \
"$pkgdir/usr/bin/${_upstream_deb_pkg}"
#
# Fix desktop launcher commands.
#
local desktop_dir="$pkgdir/usr/share/applications"
if [[ -d "$desktop_dir" ]]; then
find "$desktop_dir" \
-maxdepth 1 \
-type f \
-name '*.desktop' \
-print0 |
while IFS= read -r -d '' desktop_file; do
if grep -qi 'opera.*gx' "$desktop_file"; then
sed -i \
-e 's|^Exec=.*|Exec=opera-gx %U|' \
-e 's|^TryExec=.*|TryExec=opera-gx|' \
"$desktop_file"
fi
done
fi
#
# Install upstream copyright/license information when present.
#
local copyright_file
copyright_file="$(
find "$pkgdir/usr/share/doc" \
-type f \
-name copyright \
-print \
-quit 2>/dev/null
)"
if [[ -n "$copyright_file" ]]; then
install -Dm644 "$copyright_file" \
"$pkgdir/usr/share/licenses/$pkgname/copyright"
fi
#
# Additional Opera license documents.
#
install -Dm644 "$srcdir/eula.html" \
"$pkgdir/usr/share/licenses/$pkgname/eula.html"
install -Dm644 "$srcdir/terms.html" \
"$pkgdir/usr/share/licenses/$pkgname/terms.html"
install -Dm644 "$srcdir/privacy.html" \
"$pkgdir/usr/share/licenses/$pkgname/privacy.html"
}
|