-
Notifications
You must be signed in to change notification settings - Fork 17
/
snapcraft.yaml
618 lines (597 loc) · 22 KB
/
snapcraft.yaml
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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
# Copyright (C) 2021 Canonical Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
name: firefox
version: "133.0-2"
summary: Mozilla Firefox web browser
description: Firefox is a powerful, extensible web browser with support for modern web application technologies.
confinement: strict
grade: stable
base: core22
source-code: https://github.com/canonical/firefox-snap
assumes:
- snapd2.54 # for mount-control
compression: lzo
apps:
firefox:
command: firefox.launcher
desktop: firefox.desktop
extensions: [gnome]
environment:
# See below and also the 'snap/hooks/post-refresh' file for
# more details about our hunspell setup.
DICPATH: "$SNAP_COMMON/snap-hunspell"
GTK_USE_PORTAL: 1
HOME: "$SNAP_USER_COMMON"
PIPEWIRE_CONFIG_NAME: "$SNAP/usr/share/pipewire/pipewire.conf"
PIPEWIRE_MODULE_DIR: "$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/pipewire-0.3"
SPA_PLUGIN_DIR: "$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/spa-0.2"
SPEECHD_ADDRESS: "unix_socket:/run/user/$SNAP_UID/speech-dispatcher/speechd.sock"
slots:
- dbus-daemon
- mpris
plugs:
- alsa
- audio-playback
- audio-record
- avahi-observe
- browser-sandbox
- camera
- cups-control
- gsettings
- hardware-observe
- home
- host-hunspell
- host-usr-share-hunspell
- joystick
- login-session-observe
- network
- network-observe
- opengl
- pcscd
- removable-media
- screen-inhibit-control
- system-packages-doc
- u2f-devices
- unity7
- upower-observe
geckodriver:
command: usr/lib/firefox/geckodriver
extensions: [gnome]
plugs:
- network-bind
# + all the plugs required by firefox, so that when geckodriver
# executes firefox it inherits the correct set of permissions
- audio-playback
- audio-record
- avahi-observe
- browser-sandbox
- camera
- cups-control
- gsettings
- hardware-observe
- home
- host-hunspell
- host-usr-share-hunspell
- joystick
- login-session-observe
- network
- network-observe
- opengl
- pcscd
- removable-media
- screen-inhibit-control
- system-packages-doc
- u2f-devices
- unity7
- upower-observe
slots:
- dbus-daemon
- mpris
plugs:
browser-sandbox:
interface: browser-support
allow-sandbox: true
dot-mozilla-firefox:
interface: personal-files
read: [$HOME/.mozilla/firefox]
etc-firefox:
interface: system-files
read: [/etc/firefox]
host-hunspell:
interface: mount-control
mount:
- what: /usr/share/hunspell
where: $SNAP_COMMON/host-hunspell
persistent: true
options: [ro, bind, noatime, noexec]
host-usr-share-hunspell:
interface: system-files
read:
- /var/lib/snapd/hostfs/usr/share/hunspell
layout:
/usr/share/libdrm:
bind: $SNAP/gnome-platform/usr/share/libdrm
/usr/share/alsa:
bind: $SNAP/usr/share/alsa
/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/opensc-pkcs11.so:
bind-file: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/opensc-pkcs11.so
parts:
rust:
plugin: nil
build-packages:
- wget
override-pull: |
# Do not use rustup to work around https://forum.snapcraft.io/t/armhf-builds-on-launchpad-timing-out/31008
REQUIRED_RUST_VERSION=1.76.0
ROOT=https://static.rust-lang.org/dist/rust-$REQUIRED_RUST_VERSION
if [ $CRAFT_TARGET_ARCH = "amd64" ]; then
BINARIES_SUFFIX=x86_64-unknown-linux-gnu
elif [ $CRAFT_TARGET_ARCH = "armhf" ]; then
BINARIES_SUFFIX=armv7-unknown-linux-gnueabihf
elif [ $CRAFT_TARGET_ARCH = "arm64" ]; then
BINARIES_SUFFIX=aarch64-unknown-linux-gnu
fi
wget -O - $ROOT-$BINARIES_SUFFIX.tar.gz | tar -x -z --strip-components=1
./install.sh --prefix=/usr --destdir=$CRAFT_STAGE
override-prime: ''
cbindgen:
plugin: nil
after:
- rust
override-build: |
craftctl default
cargo install cbindgen
override-prime: ''
clang:
plugin: nil
build-packages:
- binutils-dev
- cmake
- libtinfo5
- make
- wget
build-environment:
- LLVM_RELEASE: "16.0.4"
override-pull: |
ROOT=https://github.com/llvm/llvm-project/releases/download/llvmorg-$LLVM_RELEASE
# Download the binaries
BINARIES_BASENAME=clang+llvm-$LLVM_RELEASE
if [ $CRAFT_TARGET_ARCH = "amd64" ]; then
BINARIES_SUFFIX=x86_64-linux-gnu-ubuntu-22.04.tar.xz
elif [ $CRAFT_TARGET_ARCH = "armhf" ]; then
BINARIES_SUFFIX=armv7a-linux-gnueabihf.tar.xz
elif [ $CRAFT_TARGET_ARCH = "arm64" ]; then
BINARIES_SUFFIX=aarch64-linux-gnu.tar.xz
fi
wget -O - $ROOT/$BINARIES_BASENAME-$BINARIES_SUFFIX | tar -x --xz
# And cmake-$LLVM_RELEASE.src needed on LLVM >= 15.0.0
wget -O - $ROOT/cmake-$LLVM_RELEASE.src.tar.xz | tar -x --xz
mv cmake-$LLVM_RELEASE.src cmake
if [ $CRAFT_TARGET_ARCH = "amd64" ]; then
# And the sources to build LLVMgold.so, which isn't distributed in a binary form
wget -O - $ROOT/llvm-$LLVM_RELEASE.src.tar.xz | tar -x --xz
fi
override-build: |
craftctl default
if [ $CRAFT_TARGET_ARCH = "amd64" ]; then
cd llvm-$LLVM_RELEASE.src
mkdir build
cd build
cmake -DLLVM_BINUTILS_INCDIR=/usr/include -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_INCLUDE_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$CRAFT_PART_INSTALL/usr ..
make -j$CRAFT_PARALLEL_BUILD_COUNT install-LLVMgold-stripped
fi
override-stage: |
craftctl default
mkdir -p usr
cp -R $CRAFT_PART_SRC/clang+llvm-$LLVM_RELEASE-*/* usr/
override-prime: ''
dump-syms:
plugin: nil
after:
- rust
build-packages:
- curl
- git
- jq
- python3-yaml
override-pull: |
if [ $CRAFT_TARGET_ARCH = "amd64" ] || [ $CRAFT_TARGET_ARCH = "arm64" ]; then
VERSION=$(craftctl get version | cut -d- -f1)
BUILD=$(craftctl get version | cut -d- -f2 | cut -d. -f1)
FFINFO=$(curl -s https://ftp.mozilla.org/pub/firefox/candidates/$VERSION-candidates/build$BUILD/linux-x86_64/en-US/firefox-$VERSION.json)
MOZ_SOURCE_REPO=$(echo $FFINFO | jq -r .moz_source_repo)
MOZ_SOURCE_STAMP=$(echo $FFINFO | jq -r .moz_source_stamp)
FETCHES=$MOZ_SOURCE_REPO/raw-file/$MOZ_SOURCE_STAMP/taskcluster/kinds/fetch/toolchains.yml
TOOLCHAINS=$(curl -sSL "${FETCHES}")
unset PYTHONPATH
REPO=$(echo "${TOOLCHAINS}" | /usr/bin/python3 -c 'import yaml, sys; fetches = yaml.safe_load(sys.stdin); print("{}".format(fetches["dump-syms"]["fetch"]["repo"]))')
SHA1=$(echo "${TOOLCHAINS}" | /usr/bin/python3 -c 'import yaml, sys; fetches = yaml.safe_load(sys.stdin); print("{}".format(fetches["dump-syms"]["fetch"]["revision"]))')
git clone "${REPO}" . && git checkout "${SHA1}"
fi
override-build: |
craftctl default
if [ $CRAFT_TARGET_ARCH = "amd64" ] || [ $CRAFT_TARGET_ARCH = "arm64" ]; then
cargo build --release
cp target/release/dump_syms $CRAFT_STAGE/usr/bin/
fi
# This is a temporary workaround to including the hunspell content
# snap, which would cause breakage in the Ubuntu desktop image build
# because of the Ubuntu policy. See:
# https://bugzilla.mozilla.org/show_bug.cgi?id=1792006
#
# The definition of this part is essentially a copy of the
# corresponding part in hunspell-dictionaries-1-7-2004 by
# Buo-ren, Lin.
hunspell:
plugin: nil
override-build: |
craftctl default
set -eu
apt download $(apt-cache search '^hunspell-.*$' |
awk '!/myspell|dbgsym|tools|transitional|dependency/{printf "%s ", $1}')
find . -name "*.deb" -exec dpkg-deb -x {} "$CRAFT_PART_INSTALL" \;
prime:
- usr/share/hunspell
# We use the amd64 binary for all architectures since the used files are said
# to be arch-independent.
wasi-sdk:
plugin: nil
after:
- clang
build-packages:
- wget
build-environment:
- WASI_BRANCH: "15"
- WASI_RELEASE: "15.0"
override-pull: |
ROOT=https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$WASI_BRANCH
wget $ROOT/wasi-sysroot-$WASI_RELEASE.tar.gz
wget $ROOT/libclang_rt.builtins-wasm32-wasi-$WASI_RELEASE.tar.gz
override-build: |
craftctl default
tar -C $CRAFT_STAGE -xf wasi-sysroot-$WASI_RELEASE.tar.gz
tar -C $CRAFT_STAGE/usr/lib/clang/* -xf libclang_rt.builtins-wasm32-wasi-$WASI_RELEASE.tar.gz
override-prime: ''
nodejs:
plugin: nil
build-packages:
- wget
build-environment:
- NODEJS_RELEASE: "v16.18.1"
override-pull: |
ROOT=https://nodejs.org/dist/$NODEJS_RELEASE/node-$NODEJS_RELEASE-linux-
if [ $CRAFT_TARGET_ARCH = "amd64" ]; then
SUFFIX=x64.tar.xz
elif [ $CRAFT_TARGET_ARCH = "armhf" ]; then
SUFFIX=armv7l.tar.xz
elif [ $CRAFT_TARGET_ARCH = "arm64" ]; then
SUFFIX=arm64.tar.xz
fi
wget -O - $ROOT$SUFFIX | tar -x --xz
override-build: |
craftctl default
cp -R node-$NODEJS_RELEASE-linux-*/ $CRAFT_PART_INSTALL/usr/
override-prime: ''
mozconfig:
plugin: nil
override-stage: |
cp $CRAFT_PROJECT_DIR/mozconfig.in $CRAFT_STAGE/mozconfig
override-prime: ''
# Launchpad builders have a timeout for how long they are allowed to access
# the internet (through a proxy) starting from the start of the build.
# Since the firefox part takes a long time to build, we need to ensure
# that all other parts that need to access the internet (to e.g. fetch build
# or stage packages) are built before it (before the proxy authentication is
# revoked).
firefox:
plugin: nil
after:
- apikeys
- cbindgen
- clang
- distribution
- dump-syms
- ffmpeg
- firefox-langpacks
- hunspell
- mozconfig
- nodejs
- rust
- wasi-sdk
build-packages:
- cmake
- coreutils
- file
- git
- libasound2-dev
- libdbus-glib-1-dev
- libgtk2.0-dev
- libpython3-dev
- libx11-xcb-dev
- libxt-dev
- m4
- make
- nasm
- quilt
- unzip
- wget
- xvfb
- zip
override-pull: |
VERSION=$(craftctl get version | cut -d- -f1)
BUILD=$(craftctl get version | cut -d- -f2 | cut -d. -f1)
ROOT=https://ftp.mozilla.org/pub/firefox/candidates/$VERSION-candidates/build$BUILD
wget -O - $ROOT/source/firefox-$VERSION.source.tar.xz | tar -x --xz --strip-components=1
mkdir -p $CRAFT_STAGE/debug-symbols
cp toolkit/crashreporter/tools/upload_symbols.py $CRAFT_STAGE/debug-symbols/
override-build: |
craftctl default
QUILT_PATCHES=$CRAFT_PROJECT_DIR/patches quilt push -a
BUILD_DBGSYMS=false
if [ $CRAFT_TARGET_ARCH = "amd64" ] || [ $CRAFT_TARGET_ARCH = "arm64" ]; then
# Build and publish debug symbols for amd64 and arm64 only,
# because Launchpad builders for armhf choke (OOM) when
# building with debug symbols enabled, even with
# patches/mozilla-reduce-rust-debuginfo.patch applied,
# at least as of 2023-06-25.
BUILD_DBGSYMS=true
fi
# GitHub Actions is limited to 2 CPUs and 7GB RAM, and
# too much debug info from Rust will make gkrust linkage fail.
# Same goes for arm64 builds on Launchpad. It seems we can't
# detect $GITHUB_WORKSPACE, so we assume presence of the file
# "symbols-upload-token" means we are running on GitHub.
if [ -f "$CRAFT_PROJECT_DIR/symbols-upload-token"] || [ $CRAFT_TARGET_ARCH = "arm64" ] || [ $CRAFT_TARGET_ARCH = "armhf" ]; then
patch -p1 < $CRAFT_PROJECT_DIR/patches/mozilla-reduce-rust-debuginfo.patch
fi
if [ $CRAFT_TARGET_ARCH = "armhf" ]; then
patch -p1 < $CRAFT_PROJECT_DIR/patches/armhf-thin-lto.patch
fi
export MOZCONFIG="$CRAFT_STAGE/mozconfig"
if [ $BUILD_DBGSYMS = "true" ]; then
echo "ac_add_options --enable-debug-symbols" >> $MOZCONFIG
else
echo "ac_add_options --disable-debug-symbols" >> $MOZCONFIG
fi
if [ $CRAFT_TARGET_ARCH = "amd64" ]; then
# Enable LTO and PGO (https://firefox-source-docs.mozilla.org/build/buildsystem/pgo.html) only on amd64 for now.
# Linking with gold fails on armhf (error: undefined reference to '__aeabi_uldivmod') and would need to be
# investigated further, and running PGO on arm64 takes forever (> 4 days in the Launchpad build environment!).
echo "ac_add_options --enable-linker=lld" >> $MOZCONFIG
echo "ac_add_options MOZ_PGO=1" >> $MOZCONFIG
fi
if [ $CRAFT_TARGET_ARCH != "armhf" ]; then
echo "ac_add_options --enable-rust-simd" >> $MOZCONFIG
fi
echo "ac_add_options --prefix=$CRAFT_PART_INSTALL/usr" >> $MOZCONFIG
GNOME_SDK_SNAP=/snap/gnome-42-2204-sdk/current
if [ $CRAFT_TARGET_ARCH = "amd64" ]; then
# "clang -dumpmachine" returns "x86_64-unknown-linux-gnu" on
# amd64 (at least the binaries they distribute), but what we
# really need is "x86_64-pc-linux-gnu"; so let's hard-code it.
export TARGET_TRIPLET="x86_64-pc-linux-gnu"
else
export TARGET_TRIPLET=$(clang -dumpmachine)
fi
export LDFLAGS="-Wl,-rpath-link=$GNOME_SDK_SNAP/usr/lib/$CRAFT_ARCH_TRIPLET -Wl,-rpath-link=$GNOME_SDK_SNAP/usr/lib"
export LDFLAGS="-Wl,-rpath-link=$CRAFT_PART_BUILD/obj-$TARGET_TRIPLET/dist/bin${LDFLAGS:+ $LDFLAGS}"
export LD_LIBRARY_PATH="$CRAFT_PART_BUILD/obj-$TARGET_TRIPLET/dist/bin${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
export WASI_SYSROOT=$CRAFT_STAGE/wasi-sysroot
export MOZBUILD_STATE_PATH=$CRAFT_PART_BUILD/.mozbuild
unset PYTHONPATH
if [ $CRAFT_TARGET_ARCH = "amd64" ]; then
# Needed for PGO-enabled builds that execute the built binaries. This should mirror the link paths in $LDFLAGS.
export LD_LIBRARY_PATH="$GNOME_SDK_SNAP/usr/lib/$CRAFT_ARCH_TRIPLET:$GNOME_SDK_SNAP/usr/lib"
# Ensure the instrumented binary is run against the right version of libssl3.so and libnss3.so
# (locally-built versions are more recent than the ones in the gnome platform snap)
export LD_LIBRARY_PATH="$CRAFT_PART_BUILD/obj-$TARGET_TRIPLET/instrumented/dist/bin${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
fi
MACH="/usr/bin/python3 ./mach"
$MACH repackage desktop-file --output $CRAFT_PART_INSTALL/firefox.desktop --flavor snap --release-product "firefox" --release-type release
if [ $CRAFT_TARGET_ARCH = "amd64" ]; then
# xvfb is only needed when doing a PGO-enabled build
xvfb-run '--server-args=-screen 0 1920x1080x24' $MACH build -j$CRAFT_PARALLEL_BUILD_COUNT
else
$MACH build -j$CRAFT_PARALLEL_BUILD_COUNT
fi
if [ $BUILD_DBGSYMS = "true" ]; then
DUMP_SYMS=$CRAFT_STAGE/usr/bin/dump_syms $MACH buildsymbols
fi
$MACH install
cp obj-*/dist/host/bin/geckodriver $CRAFT_PART_INSTALL/usr/lib/firefox/
DISTRIBUTION=$CRAFT_PART_INSTALL/usr/lib/firefox/distribution
mkdir -p $DISTRIBUTION/extensions
cp browser/branding/official/default256.png $CRAFT_PART_INSTALL/
if [ $BUILD_DBGSYMS = "true" ]; then
cp obj-*/dist/firefox-*.crashreporter-symbols.zip $CRAFT_STAGE/debug-symbols/
fi
# update the path to the vulkan drivers for the snap environment
sed -i 's#/usr/lib/#/snap/firefox/current/usr/lib/#' $CRAFT_PART_INSTALL/usr/share/vulkan/icd.d/*.json
override-stage: |
# Workaround for LP: #2016358: create mount points for the gnome
# content interface, while a proper fix is implemented in snapd.
# Thanks to James Henstridge.
mkdir $CRAFT_PART_INSTALL/{gnome-platform,data-dir,data-dir/{icons,sounds,themes}}
craftctl default
stage-packages:
- libasound2
- libcurl4
- libpci3
- libpipewire-0.3-0
- libpipewire-0.3-modules
- libspa-0.2-modules
- libspeechd2
- libvulkan1
- libxt6
- mesa-vulkan-drivers
- pipewire-bin
- pipewire-pulse
- opensc-pkcs11
prime:
- default256.png
- firefox.desktop
- usr/lib/firefox
- usr/lib/*/opensc-pkcs11.so
- usr/lib/*/pkcs11/opensc-pkcs11.so
- usr/lib/*/libasn1.so.*
- usr/lib/*/libcurl.so.*
- usr/lib/*/libgssapi.so.*
- usr/lib/*/libhcrypto.so.*
- usr/lib/*/libheimbase.so.*
- usr/lib/*/libheimntlm.so.*
- usr/lib/*/libhogweed.so.*
- usr/lib/*/libhx509.so.*
- usr/lib/*/libkrb5.so.*
- usr/lib/*/liblber-2.4.so.*
- usr/lib/*/libldap_r-2.4.so.*
- usr/lib/*/libnettle.so.*
- usr/lib/*/libnghttp2.so.*
- usr/lib/*/libpci.so.*
- usr/lib/*/libpipewire*.so*
- usr/lib/*/libroken.so.*
- usr/lib/*/librtmp.so.*
- usr/lib/*/libsasl2.so.*
- usr/lib/*/libspeechd.so.*
- usr/lib/*/libssh.so.*
- usr/lib/*/libssl.so.*
- usr/lib/*/libvulkan*
- usr/lib/*/libVkLayer*
- usr/lib/*/libwind.so.*
- usr/lib/*/libXt.so.*
- usr/lib/*/pipewire-*
- usr/lib/*/spa-*
- usr/share/alsa
- usr/share/pipewire
- usr/share/vulkan
# Workaround for LP: #2016358 (see the 'override-stage' above).
- gnome-platform
- data-dir/icons
- data-dir/sounds
- data-dir/themes
firefox-langpacks:
plugin: nil
build-packages:
- coreutils
- sed
- wget
override-pull: |
VERSION=$(craftctl get version | cut -d- -f1)
BUILD=$(craftctl get version | cut -d- -f2 | cut -d. -f1)
SERVER=https://ftp.mozilla.org
ROOT=$SERVER/pub/firefox/candidates/$VERSION-candidates/build$BUILD
XPIS=$(wget -O - $ROOT/linux-x86_64/xpi/ | sed -n 's/.* href="\(.*\.xpi\)".*/\1/p')
for XPI in $XPIS; do
wget $SERVER$XPI
done
override-prime: |
INSTALLDIR=$CRAFT_PRIME/usr/lib/firefox/distribution/extensions
mkdir -p $INSTALLDIR
for XPI in $(ls $CRAFT_PART_SRC/*.xpi); do
LANGCODE=$(basename $XPI .xpi)
mkdir $INSTALLDIR/locale-$LANGCODE
cp $XPI $INSTALLDIR/locale-$LANGCODE/langpack-$LANGCODE@firefox.mozilla.org.xpi
done
launcher:
plugin: nil
override-prime: |
cp "$CRAFT_PROJECT_DIR/firefox.launcher" "$CRAFT_PRIME/"
cp "$CRAFT_PROJECT_DIR/patch-default-profile.py" "$CRAFT_PRIME/"
distribution:
plugin: nil
source: https://github.com/mozilla-partners/canonical.git
override-prime: |
mkdir -p $CRAFT_PRIME/usr/lib/firefox
cp -R $CRAFT_PART_SRC/desktop/ubuntu/distribution $CRAFT_PRIME/usr/lib/firefox/
ffmpeg:
plugin: nil
# Not using the ffmpeg snap (which might provide a more recent version)
# because it is currently built on core18
stage-packages:
- libavcodec58
prime:
- usr/lib/*/libaom.so.*
- usr/lib/*/libavcodec.so.*
- usr/lib/*/libavutil.so.*
- usr/lib/*/libcodec2.so.*
- usr/lib/*/libdav1d.so.*
- usr/lib/*/libgsm.so.*
- usr/lib/*/libmd.so.*
- usr/lib/*/libmfx.so.*
- usr/lib/*/libmp3lame.so.*
- usr/lib/*/libnuma.so.*
- usr/lib/*/libOpenCL.so.*
- usr/lib/*/libopus.so.*
- usr/lib/*/libshine.so.*
- usr/lib/*/libsnappy.so.*
- usr/lib/*/libsoxr.so.*
- usr/lib/*/libspeex.so.*
- usr/lib/*/libswresample.so.*
- usr/lib/*/libtheoradec.so.*
- usr/lib/*/libtheoraenc.so.*
- usr/lib/*/libtwolame.so.*
- usr/lib/*/libvdpau.so.*
- usr/lib/*/libvpx.so.*
- usr/lib/*/libwavpack.so.*
- usr/lib/*/libwebpmux.so.*
- usr/lib/*/libwebp.so.*
- usr/lib/*/libx264.so.*
- usr/lib/*/libx265.so.*
- usr/lib/*/libxvidcore.so.*
- usr/lib/*/libzvbi.so.*
apikeys:
plugin: nil
after:
- mozconfig
build-packages:
- coreutils
- gpg
- jq
override-build: |
craftctl default
MOZCONFIG="$CRAFT_STAGE/mozconfig"
gpg -d --batch --passphrase "$(base64 -d $CRAFT_PROJECT_DIR/.passphrase)" -o apikeys $CRAFT_PROJECT_DIR/.apikeys
cat apikeys | jq .MOZ_GOOGLE_LOCATION_SERVICE_API_KEY | tr -d '"' > $CRAFT_PART_INSTALL/gls-gapi.data
echo "ac_add_options --with-google-location-service-api-keyfile=$CRAFT_STAGE/gls-gapi.data" >> $MOZCONFIG
cat apikeys | jq .MOZ_GOOGLE_SAFEBROWSING_API_KEY | tr -d '"' > $CRAFT_PART_INSTALL/sb-gapi.data
echo "ac_add_options --with-google-safebrowsing-api-keyfile=$CRAFT_STAGE/sb-gapi.data" >> $MOZCONFIG
override-prime: ''
debug-symbols:
plugin: nil
build-packages:
- python3
- python3-virtualenv
after:
- firefox
override-build: |
export SYMBOLS_ARCHIVE=$(find $CRAFT_STAGE/debug-symbols/ -type f -name "firefox-*.crashreporter-symbols.zip")
if [ -f "$SYMBOLS_ARCHIVE" ]; then
if [ -f "$CRAFT_PROJECT_DIR/symbols-upload-token" ]; then
virtualenv venv/
source venv/bin/activate
venv/bin/pip3 install redo requests argparse
SOCORRO_SYMBOL_UPLOAD_URL=https://symbols.stage.mozaws.net/upload/ SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE="$CRAFT_PROJECT_DIR/symbols-upload-token" venv/bin/python3 $CRAFT_STAGE/debug-symbols/upload_symbols.py $SYMBOLS_ARCHIVE
rm "$CRAFT_PROJECT_DIR/symbols-upload-token"
deactivate
else
cp $SYMBOLS_ARCHIVE $CRAFT_PROJECT_DIR/$CRAFT_PROJECT_NAME_$(craftctl get version)_$CRAFT_TARGET_ARCH.debug
fi
fi
slots:
dbus-daemon:
interface: dbus
bus: session
name: org.mozilla.firefox
hooks:
post-refresh:
plugs: [host-usr-share-hunspell]