forked from ubuntu/thunderbird
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsnapcraft.yaml
288 lines (276 loc) · 9.89 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
# Copyright (C) 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: thunderbird
version: "128.7.0esr-1"
summary: Mozilla Thunderbird email application
description: Thunderbird is a free email application that’s easy to set up and customize - and it’s loaded with great features!
confinement: strict
grade: stable
base: core22
compression: lzo
contact: https://www.thunderbird.net/contact/
donation: https://www.thunderbird.net/donate/
issues: https://bugzilla.mozilla.org/enter_bug.cgi?product=Thunderbird&op_sys=Linux&keywords=snap
website: https://www.thunderbird.net/
apps:
thunderbird:
command-chain: [ bin/gpg-shim, bin/tmpdir ]
command: thunderbird.launcher
extensions: [gnome]
environment:
DICPATH: "$SNAP_COMMON/snap-hunspell"
GTK_USE_PORTAL: 1
HOME: "$SNAP_USER_COMMON"
plugs:
- avahi-observe
- browser-sandbox
- camera
- cups-control
- gsettings
- gpg-keys
- home
- host-usr-share-hunspell
- network
- network-control
- opengl
- audio-playback
- removable-media
- u2f-devices
slots:
- dbus-daemon
plugs:
browser-sandbox:
interface: browser-support
allow-sandbox: true
etc-thunderbird:
interface: system-files
read: [/etc/thunderbird]
dot-thunderbird:
interface: personal-files
read: [$HOME/.thunderbird]
host-usr-share-hunspell:
interface: system-files
read: [/var/lib/snapd/hostfs/usr/share/hunspell]
parts:
# 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
craftctl default
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
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.78.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: ''
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 thunderbird 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).
thunderbird:
plugin: nil
after:
- cbindgen
- mozconfig
- thunderbird-langpacks
build-packages:
- cargo
- clang-15
- cmake
- coreutils
- file
- git
- libasound2-dev
- libclang-15-dev
- libdbus-glib-1-dev
- llvm-15-dev
- libpython3-dev
- libx11-xcb-dev
- libxt-dev
- m4
- make
- nasm
- nodejs
- quilt
- rustc
- unzip
- wget
- xvfb
- zip
override-pull: |
VERSION=$(craftctl get version | cut -d- -f1)
BUILD=$(craftctl get version | cut -d- -f2)
ROOT=https://ftp.mozilla.org/pub/thunderbird/candidates/$VERSION-candidates/build$BUILD
wget -O - $ROOT/source/thunderbird-$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
export MOZCONFIG="$CRAFT_STAGE/mozconfig"
QUILT_PATCHES=$CRAFT_PROJECT_DIR/patches quilt push -a
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-15 -dumpmachine)
fi
export LDFLAGS="-Wl,-rpath-link=$GNOME_SDK_SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_ON -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 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_BUILD_ON:$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
export PATH=$PATH:/usr/lib/llvm-15/bin/
MACH="/usr/bin/python3 ./mach"
$MACH configure --prefix=$CRAFT_PART_INSTALL/usr
$MACH uniffi generate # workaround for https://bugzilla.mozilla.org/1797714
$MACH build -j$CRAFT_PARALLEL_BUILD_COUNT
$MACH install
DISTRIBUTION=$CRAFT_PART_INSTALL/usr/lib/thunderbird/distribution
mkdir -p $DISTRIBUTION/extensions
mkdir -p $CRAFT_PART_INSTALL/bin/
cp -p $CRAFT_PROJECT_DIR/gpg-shim $CRAFT_PART_INSTALL/bin/
cp -p $CRAFT_PROJECT_DIR/tmpdir $CRAFT_PART_INSTALL/bin/
cp -pr $CRAFT_PART_SRC/* $CRAFT_PART_INSTALL
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
prime:
- bin
- usr/lib/thunderbird
# Workaround for LP: #2016358 (see the 'override-stage' above).
- gnome-platform
- data-dir/icons
- data-dir/sounds
- data-dir/themes
thunderbird-langpacks:
plugin: nil
build-packages:
- coreutils
- sed
- wget
override-pull: |
VERSION=$(craftctl get version | cut -d- -f1)
BUILD=$(craftctl get version | cut -d- -f2)
SERVER=https://ftp.mozilla.org
ROOT=$SERVER/pub/thunderbird/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/thunderbird/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/[email protected]
done
thunderbird-staged:
plugin: nil
stage-packages:
- desktop-file-utils
- gnupg # Needed to use Thunderbird >78 with smartcards.
- gnupg-agent # Needed to use Thunderbird >78 with smartcards.
- libblkid1
- libcurl4 # Needed for the crash reporter (LP: #1983502)
- libgcrypt20
- libgpg-error0
- libgpgme11 # Needed to use Thunderbird >78 with smartcards.
- liblzma5
- libudev1
- libuuid1
- zlib1g
- liblz4-1
- libxt6
prime:
- -usr/lib/*/libgio*
- -usr/lib/*/libglib*
- -usr/lib/*/libgm*
launcher:
plugin: nil
override-prime: |
cp "$CRAFT_PROJECT_DIR/thunderbird.launcher" "$CRAFT_PRIME/"
cp "$CRAFT_PROJECT_DIR/patch-default-profile.py" "$CRAFT_PRIME/"
# Find files provided by the base and platform snap and ensure they aren't
# duplicated in this snap
cleanup:
after: [thunderbird]
plugin: nil
build-snaps: [core22, gnome-42-2204]
override-prime: |
set -eux
for snap in "core22" "gnome-42-2204"; do
cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$CRAFT_PRIME/{}" \;
done
slots:
dbus-daemon:
interface: dbus
bus: session
name: org.mozilla.thunderbird
hooks:
post-refresh:
plugs: [host-usr-share-hunspell]