forked from canonical/firefox-snap
-
Notifications
You must be signed in to change notification settings - Fork 1
/
snapcraft.yaml
556 lines (536 loc) · 19.9 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
name: firefox-appmenu
version: "108.0.1-1"
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: core20
assumes:
- snapd2.54 # for mount-control
compression: lzo
apps:
firefox:
command: firefox.launcher
desktop: firefox.desktop
extensions: [gnome-3-38]
environment:
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/$SNAPCRAFT_ARCH_TRIPLET/pipewire-0.3"
SPA_PLUGIN_DIR: "$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/spa-0.2"
slots:
- dbus-daemon
- mpris
plugs:
- audio-playback
- audio-record
- avahi-observe
- browser-sandbox
- camera
- cups-control
- gsettings
- hardware-observe
- home
- host-hunspell
- joystick
- network
- network-observe
- opengl
- removable-media
- screen-inhibit-control
- system-packages-doc
- u2f-devices
- unity7
- upower-observe
geckodriver:
command: usr/lib/firefox/geckodriver
extensions: [gnome-3-38]
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
- joystick
- network
- network-observe
- opengl
- 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]
layout:
/usr/share/libdrm:
bind: $SNAP/gnome-platform/usr/share/libdrm
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.64.0
ROOT=https://static.rust-lang.org/dist/rust-$REQUIRED_RUST_VERSION
if [ $SNAPCRAFT_TARGET_ARCH = "amd64" ]; then
BINARIES_SUFFIX=x86_64-unknown-linux-gnu
elif [ $SNAPCRAFT_TARGET_ARCH = "armhf" ]; then
BINARIES_SUFFIX=armv7-unknown-linux-gnueabihf
elif [ $SNAPCRAFT_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=$SNAPCRAFT_STAGE
override-prime: ''
cbindgen:
plugin: nil
after:
- rust
override-build: cargo install cbindgen
override-prime: ''
clang:
plugin: nil
build-packages:
- binutils-dev
- cmake
- libtinfo5
- make
- wget
build-environment:
- LLVM_RELEASE: "14.0.0"
override-pull: |
ROOT=https://github.com/llvm/llvm-project/releases/download/llvmorg-$LLVM_RELEASE
# Download the binaries
BINARIES_BASENAME=clang+llvm-$LLVM_RELEASE
if [ $SNAPCRAFT_TARGET_ARCH = "amd64" ]; then
BINARIES_SUFFIX=x86_64-linux-gnu-ubuntu-18.04.tar.xz
elif [ $SNAPCRAFT_TARGET_ARCH = "armhf" ]; then
BINARIES_SUFFIX=armv7a-linux-gnueabihf.tar.xz
elif [ $SNAPCRAFT_TARGET_ARCH = "arm64" ]; then
BINARIES_SUFFIX=aarch64-linux-gnu.tar.xz
fi
wget -O - $ROOT/$BINARIES_BASENAME-$BINARIES_SUFFIX | tar -x --xz
if [ $SNAPCRAFT_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: |
if [ $SNAPCRAFT_TARGET_ARCH = "amd64" ]; then
cd llvm-$LLVM_RELEASE.src
mkdir build
cd build
cmake -DLLVM_BINUTILS_INCDIR=/usr/include -DLLVM_INCLUDE_BENCHMARKS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$SNAPCRAFT_PART_INSTALL/usr ..
make -j$SNAPCRAFT_PARALLEL_BUILD_COUNT install-LLVMgold-stripped
fi
override-stage: |
snapcraftctl stage
mkdir -p usr
cp -R $SNAPCRAFT_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 [ $SNAPCRAFT_TARGET_ARCH = "amd64" ]; then
VERSION=$(echo $SNAPCRAFT_PROJECT_VERSION | cut -d- -f1)
BUILD=$(echo $SNAPCRAFT_PROJECT_VERSION | cut -d- -f2)
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/ci/fetch/toolchains.yml
TOOLCHAINS=$(curl -sSL "${FETCHES}")
REPO=$(echo "${TOOLCHAINS}" | python3 -c 'import yaml, sys; fetches = yaml.safe_load(sys.stdin); print("{}".format(fetches["dump-syms"]["fetch"]["repo"]))')
SHA1=$(echo "${TOOLCHAINS}" | 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: |
if [ $SNAPCRAFT_TARGET_ARCH = "amd64" ]; then
cargo build --release
cp target/release/dump_syms $SNAPCRAFT_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: |
set -eu
apt download $(apt-cache search '^hunspell-.*$' |
awk '!/myspell|dbgsym|tools|transitional|dependency/{printf "%s ", $1}')
find . -name "*.deb" -exec dpkg-deb -x {} "$SNAPCRAFT_PART_INSTALL" \;
filesets:
hunspell-dictionaries: [usr/share/hunspell]
stage:
- $hunspell-dictionaries
prime:
- $hunspell-dictionaries
# 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: |
tar -C $SNAPCRAFT_STAGE -xf wasi-sysroot-$WASI_RELEASE.tar.gz
tar -C $SNAPCRAFT_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 [ $SNAPCRAFT_TARGET_ARCH = "amd64" ]; then
SUFFIX=x64.tar.xz
elif [ $SNAPCRAFT_TARGET_ARCH = "armhf" ]; then
SUFFIX=armv7l.tar.xz
elif [ $SNAPCRAFT_TARGET_ARCH = "arm64" ]; then
SUFFIX=arm64.tar.xz
fi
wget -O - $ROOT$SUFFIX | tar -x --xz
override-build: |
cp -R node-$NODEJS_RELEASE-linux-*/ $SNAPCRAFT_PART_INSTALL/usr/
override-prime: ''
mozconfig:
plugin: nil
override-stage: |
cp $SNAPCRAFT_PROJECT_DIR/mozconfig.in $SNAPCRAFT_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
- pipewire
- 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=$(echo $SNAPCRAFT_PROJECT_VERSION | cut -d- -f1)
BUILD=$(echo $SNAPCRAFT_PROJECT_VERSION | cut -d- -f2)
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 $SNAPCRAFT_STAGE/debug-symbols
cp toolkit/crashreporter/tools/upload_symbols.py $SNAPCRAFT_STAGE/debug-symbols/
override-build: |
QUILT_PATCHES=$SNAPCRAFT_PROJECT_DIR/patches quilt push -a
export MOZCONFIG="$SNAPCRAFT_STAGE/mozconfig"
BUILD_DBGSYMS=false
if [ $SNAPCRAFT_TARGET_ARCH = "amd64" ]; then
# Build and publish debug symbols for amd64 only, because Launchpad
# builders for other architectures (armhf and arm64) choke (OOM) when
# building with debug symbols enabled.
# TODO: find a way to work around this infrastructure limitation.
BUILD_DBGSYMS=true
fi
if [ $BUILD_DBGSYMS = "true" ]; then
echo "ac_add_options --enable-debug-symbols" >> $MOZCONFIG
else
echo "ac_add_options --disable-debug-symbols" >> $MOZCONFIG
fi
if [ $SNAPCRAFT_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=gold" >> $MOZCONFIG
echo "ac_add_options --enable-lto=cross" >> $MOZCONFIG
echo "ac_add_options MOZ_PGO=1" >> $MOZCONFIG
fi
if [ $SNAPCRAFT_TARGET_ARCH != "armhf" ]; then
echo "ac_add_options --enable-rust-simd" >> $MOZCONFIG
fi
GNOME_SDK_SNAP=/snap/gnome-3-38-2004-sdk/current
export LDFLAGS="-Wl,-rpath-link=$GNOME_SDK_SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET -Wl,-rpath-link=$GNOME_SDK_SNAP/usr/lib"
export WASI_SYSROOT=$SNAPCRAFT_STAGE/wasi-sysroot
export MOZBUILD_STATE_PATH=$SNAPCRAFT_PART_BUILD/.mozbuild
unset PYTHONPATH
if [ $SNAPCRAFT_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/$SNAPCRAFT_ARCH_TRIPLET:$GNOME_SDK_SNAP/usr/lib
else
unset LD_LIBRARY_PATH
fi
MACH="/usr/bin/python3 ./mach"
$MACH configure --prefix=$SNAPCRAFT_PART_INSTALL/usr
$MACH uniffi generate # workaround for https://bugzilla.mozilla.org/1797714
# Unset SNAP_INSTANCE_NAME because when snapcraft runs as a snap it is set
# (and its value is "snapcraft"), and this interferes with firefox's
# detection of whether it's running sandboxed (see
# https://searchfox.org/mozilla-central/search?q=IsRunningUnderSnap()).
# That codes is compiled in the xpcshell binary that's used to generate
# files at build time, and the environment it runs in prevents it from
# locating services it needs, causing a crash (see
# https://searchfox.org/mozilla-central/rev/aa329cf7506ddd966542e642ec00223fd7461599/xpcom/io/SpecialSystemDirectory.cpp#196).
# This is a temporary workaround to get builds going again, we really need
# to get to the bottom of this and understand why xpcshell cannot find the
# appinfo service when run in the build environment.
# Unsetting SNAP_INSTANCE_NAME has the undesirable side-effect that when
# generating a profile for PGO-enabled builds, a potentially different
# code path will be exercised (not confined as a snap), so that's not a
# good solution.
unset SNAP_INSTANCE_NAME
if [ $SNAPCRAFT_TARGET_ARCH = "amd64" ]; then
# xvfb is only needed when doing a PGO-enabled build
xvfb-run '--server-args=-screen 0 1920x1080x24' $MACH build -j$SNAPCRAFT_PARALLEL_BUILD_COUNT
else
$MACH build -j$SNAPCRAFT_PARALLEL_BUILD_COUNT
fi
if [ $BUILD_DBGSYMS = "true" ]; then
DUMP_SYMS=$SNAPCRAFT_STAGE/usr/bin/dump_syms $MACH buildsymbols
fi
$MACH install
cp obj-*/dist/bin/geckodriver $SNAPCRAFT_PART_INSTALL/usr/lib/firefox/
DISTRIBUTION=$SNAPCRAFT_PART_INSTALL/usr/lib/firefox/distribution
mkdir -p $DISTRIBUTION/extensions
cp taskcluster/docker/firefox-snap/firefox.desktop $SNAPCRAFT_PART_INSTALL/
cp browser/branding/official/default256.png $SNAPCRAFT_PART_INSTALL/
sed -i 's/\(^Icon=\).*$/\1\/default256.png/' $SNAPCRAFT_PART_INSTALL/firefox.desktop
if [ $BUILD_DBGSYMS = "true" ]; then
cp obj-*/dist/firefox-*.crashreporter-symbols.zip $SNAPCRAFT_STAGE/debug-symbols/
fi
stage-packages:
- libcurl4
- libpci3
- libxt6
prime:
- default256.png
- firefox.desktop
- usr/lib/firefox
- 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/*/libroken.so.*
- usr/lib/*/librtmp.so.*
- usr/lib/*/libsasl2.so.*
- usr/lib/*/libssh.so.*
- usr/lib/*/libssl.so.*
- usr/lib/*/libwind.so.*
- usr/lib/*/libXt.so.*
firefox-langpacks:
plugin: nil
build-packages:
- coreutils
- sed
- wget
override-pull: |
VERSION=$(echo $SNAPCRAFT_PROJECT_VERSION | cut -d- -f1)
BUILD=$(echo $SNAPCRAFT_PROJECT_VERSION | cut -d- -f2)
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=$SNAPCRAFT_PRIME/usr/lib/firefox/distribution/extensions
mkdir -p $INSTALLDIR
for XPI in $(ls $SNAPCRAFT_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 "$SNAPCRAFT_PROJECT_DIR/firefox.launcher" "$SNAPCRAFT_PRIME/"
cp "$SNAPCRAFT_PROJECT_DIR/patch-default-profile.py" "$SNAPCRAFT_PRIME/"
distribution:
plugin: nil
source: https://github.com/mozilla-partners/canonical.git
override-prime: |
mkdir -p $SNAPCRAFT_PRIME/usr/lib/firefox
cp -R $SNAPCRAFT_PART_SRC/desktop/ubuntu/distribution $SNAPCRAFT_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/*/libva-drm.so.*
- usr/lib/*/libva.so.*
- usr/lib/*/libva-x11.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.*
pipewire:
source: https://gitlab.freedesktop.org/pipewire/pipewire/-/archive/0.3.32/pipewire-0.3.32.tar.gz
plugin: meson
meson-parameters:
- --prefix=/usr
- --buildtype=release
- --strip
- -Dalsa=disabled
- -Dpipewire-alsa=disabled
- -Djack=disabled
- -Dpipewire-jack=disabled
- -Dsession-managers=[]
prime:
- usr/lib/*/pipewire-*
- usr/lib/*/spa-*
- usr/lib/*/libpipewire*.so*
- usr/share/pipewire
apikeys:
plugin: nil
after:
- mozconfig
build-packages:
- coreutils
- gpg
- jq
override-build: |
MOZCONFIG="$SNAPCRAFT_STAGE/mozconfig"
gpg -d --batch --passphrase "$(base64 -d $SNAPCRAFT_PROJECT_DIR/.passphrase)" -o apikeys $SNAPCRAFT_PROJECT_DIR/.apikeys
cat apikeys | jq .MOZ_GOOGLE_LOCATION_SERVICE_API_KEY | tr -d '"' > $SNAPCRAFT_PART_INSTALL/gls-gapi.data
echo "ac_add_options --with-google-location-service-api-keyfile=$SNAPCRAFT_STAGE/gls-gapi.data" >> $MOZCONFIG
cat apikeys | jq .MOZ_GOOGLE_SAFEBROWSING_API_KEY | tr -d '"' > $SNAPCRAFT_PART_INSTALL/sb-gapi.data
echo "ac_add_options --with-google-safebrowsing-api-keyfile=$SNAPCRAFT_STAGE/sb-gapi.data" >> $MOZCONFIG
cat apikeys | jq .MOZ_MOZILLA_API_KEY | tr -d '"' > $SNAPCRAFT_PART_INSTALL/mozilla-desktop-geoloc-api.key
echo "ac_add_options --with-mozilla-api-keyfile=$SNAPCRAFT_STAGE/mozilla-desktop-geoloc-api.key" >> $MOZCONFIG
override-prime: ''
debug-symbols:
plugin: nil
build-packages:
- python3
- python3-virtualenv
after:
- firefox
override-pull: |
export SYMBOLS_ARCHIVE=$(find $SNAPCRAFT_STAGE/debug-symbols/ -type f -name "firefox-*.crashreporter-symbols.zip")
if [ -f "$SYMBOLS_ARCHIVE" ]; then
if [ -f "$SNAPCRAFT_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="$SNAPCRAFT_PROJECT_DIR/symbols-upload-token" venv/bin/python3 $SNAPCRAFT_STAGE/debug-symbols/upload_symbols.py $SYMBOLS_ARCHIVE
rm "$SNAPCRAFT_PROJECT_DIR/symbols-upload-token"
deactivate
else
cp $SYMBOLS_ARCHIVE $SNAPCRAFT_PROJECT_DIR/$SNAPCRAFT_PROJECT_NAME_$SNAPCRAFT_PROJECT_VERSION_$SNAPCRAFT_TARGET_ARCH.debug
fi
fi
slots:
dbus-daemon:
interface: dbus
bus: session
name: org.mozilla.firefox