Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove MLS #72

Open
wants to merge 2 commits into
base: stable-core24
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 34 additions & 36 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ 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
base: core24
assumes:
- snapd2.54 # for mount-control
compression: lzo
Expand All @@ -33,8 +33,8 @@ apps:
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"
PIPEWIRE_MODULE_DIR: "$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/pipewire-0.3"
SPA_PLUGIN_DIR: "$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/spa-0.2"
SPEECHD_ADDRESS: "unix_socket:/run/user/$SNAP_UID/speech-dispatcher/speechd.sock"
slots:
- dbus-daemon
Expand Down Expand Up @@ -127,11 +127,11 @@ parts:
# 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
if [ $CRAFT_ARCH_BUILD_FOR = "amd64" ]; then
BINARIES_SUFFIX=x86_64-unknown-linux-gnu
elif [ $CRAFT_TARGET_ARCH = "armhf" ]; then
elif [ $CRAFT_ARCH_BUILD_FOR = "armhf" ]; then
BINARIES_SUFFIX=armv7-unknown-linux-gnueabihf
elif [ $CRAFT_TARGET_ARCH = "arm64" ]; then
elif [ $CRAFT_ARCH_BUILD_FOR = "arm64" ]; then
BINARIES_SUFFIX=aarch64-unknown-linux-gnu
fi
wget -O - $ROOT-$BINARIES_SUFFIX.tar.gz | tar -x -z --strip-components=1
Expand All @@ -152,7 +152,7 @@ parts:
build-packages:
- binutils-dev
- cmake
- libtinfo5
- libncurses-dev
- make
- wget
build-environment:
Expand All @@ -161,24 +161,24 @@ parts:
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
if [ $CRAFT_ARCH_BUILD_FOR = "amd64" ]; then
BINARIES_SUFFIX=x86_64-linux-gnu-ubuntu-22.04.tar.xz
elif [ $CRAFT_TARGET_ARCH = "armhf" ]; then
elif [ $CRAFT_ARCH_BUILD_FOR = "armhf" ]; then
BINARIES_SUFFIX=armv7a-linux-gnueabihf.tar.xz
elif [ $CRAFT_TARGET_ARCH = "arm64" ]; then
elif [ $CRAFT_ARCH_BUILD_FOR = "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
if [ $CRAFT_ARCH_BUILD_FOR = "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
if [ $CRAFT_ARCH_BUILD_FOR = "amd64" ]; then
cd llvm-$LLVM_RELEASE.src
mkdir build
cd build
Expand All @@ -201,7 +201,7 @@ parts:
- jq
- python3-yaml
override-pull: |
if [ $CRAFT_TARGET_ARCH = "amd64" ] || [ $CRAFT_TARGET_ARCH = "arm64" ]; then
if [ $CRAFT_ARCH_BUILD_FOR = "amd64" ] || [ $CRAFT_ARCH_BUILD_FOR = "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)
Expand All @@ -216,7 +216,7 @@ parts:
fi
override-build: |
craftctl default
if [ $CRAFT_TARGET_ARCH = "amd64" ] || [ $CRAFT_TARGET_ARCH = "arm64" ]; then
if [ $CRAFT_ARCH_BUILD_FOR = "amd64" ] || [ $CRAFT_ARCH_BUILD_FOR = "arm64" ]; then
cargo build --release
cp target/release/dump_syms $CRAFT_STAGE/usr/bin/
fi
Expand Down Expand Up @@ -267,11 +267,11 @@ parts:
- NODEJS_RELEASE: "v16.18.1"
override-pull: |
ROOT=https://nodejs.org/dist/$NODEJS_RELEASE/node-$NODEJS_RELEASE-linux-
if [ $CRAFT_TARGET_ARCH = "amd64" ]; then
if [ $CRAFT_ARCH_BUILD_FOR = "amd64" ]; then
SUFFIX=x64.tar.xz
elif [ $CRAFT_TARGET_ARCH = "armhf" ]; then
elif [ $CRAFT_ARCH_BUILD_FOR = "armhf" ]; then
SUFFIX=armv7l.tar.xz
elif [ $CRAFT_TARGET_ARCH = "arm64" ]; then
elif [ $CRAFT_ARCH_BUILD_FOR = "arm64" ]; then
SUFFIX=arm64.tar.xz
fi
wget -O - $ROOT$SUFFIX | tar -x --xz
Expand Down Expand Up @@ -337,7 +337,7 @@ parts:
craftctl default
QUILT_PATCHES=$CRAFT_PROJECT_DIR/patches quilt push -a
BUILD_DBGSYMS=false
if [ $CRAFT_TARGET_ARCH = "amd64" ] || [ $CRAFT_TARGET_ARCH = "arm64" ]; then
if [ $CRAFT_ARCH_BUILD_FOR = "amd64" ] || [ $CRAFT_ARCH_BUILD_FOR = "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
Expand All @@ -350,10 +350,10 @@ parts:
# 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
if [ -f "$CRAFT_PROJECT_DIR/symbols-upload-token"] || [ $CRAFT_ARCH_BUILD_FOR = "arm64" ] || [ $CRAFT_ARCH_BUILD_FOR = "armhf" ]; then
patch -p1 < $CRAFT_PROJECT_DIR/patches/mozilla-reduce-rust-debuginfo.patch
fi
if [ $CRAFT_TARGET_ARCH = "armhf" ]; then
if [ $CRAFT_ARCH_BUILD_FOR = "armhf" ]; then
patch -p1 < $CRAFT_PROJECT_DIR/patches/armhf-thin-lto.patch
fi
export MOZCONFIG="$CRAFT_STAGE/mozconfig"
Expand All @@ -362,41 +362,41 @@ parts:
else
echo "ac_add_options --disable-debug-symbols" >> $MOZCONFIG
fi
if [ $CRAFT_TARGET_ARCH = "amd64" ]; then
if [ $CRAFT_ARCH_BUILD_FOR = "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
if [ $CRAFT_ARCH_BUILD_FOR != "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
GNOME_SDK_SNAP=/snap/gnome-46-2404-sdk/current
if [ $CRAFT_ARCH_BUILD_FOR = "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=$GNOME_SDK_SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR -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
if [ $CRAFT_ARCH_BUILD_FOR = "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"
export LD_LIBRARY_PATH="$GNOME_SDK_SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR:$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"
if [ $CRAFT_TARGET_ARCH = "amd64" ]; then
if [ $CRAFT_ARCH_BUILD_FOR = "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
Expand Down Expand Up @@ -424,15 +424,15 @@ parts:
mkdir $CRAFT_PART_INSTALL/{gnome-platform,data-dir,data-dir/{icons,sounds,themes}}
craftctl default
stage-packages:
- libasound2
- libcurl4
- libasound2t64
- libcurl4t64
- libpci3
- libpipewire-0.3-0
- libpipewire-0.3-0t64
- libpipewire-0.3-modules
- libspa-0.2-modules
- libspeechd2
- libvulkan1
- libxt6
- libxt6t64
- mesa-vulkan-drivers
- pipewire-bin
- pipewire-pulse
Expand Down Expand Up @@ -518,7 +518,7 @@ parts:
# Not using the ffmpeg snap (which might provide a more recent version)
# because it is currently built on core18
stage-packages:
- libavcodec58
- libavcodec60
prime:
- usr/lib/*/libaom.so.*
- usr/lib/*/libavcodec.so.*
Expand Down Expand Up @@ -566,8 +566,6 @@ parts:
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
cat apikeys | jq .MOZ_MOZILLA_API_KEY | tr -d '"' > $CRAFT_PART_INSTALL/mozilla-desktop-geoloc-api.key
echo "ac_add_options --with-mozilla-api-keyfile=$CRAFT_STAGE/mozilla-desktop-geoloc-api.key" >> $MOZCONFIG
override-prime: ''

debug-symbols:
Expand All @@ -588,7 +586,7 @@ parts:
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
cp $SYMBOLS_ARCHIVE $CRAFT_PROJECT_DIR/$CRAFT_PROJECT_NAME_$(craftctl get version)_$CRAFT_ARCH_BUILD_FOR.debug
fi
fi

Expand Down