%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/firefox/current/snap/
Upload File :
Create Path :
Current File : //snap/firefox/current/snap/snapcraft.yaml

# 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: "131.0.2-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: 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
      - 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
      - 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

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
    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/*/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]

Zerion Mini Shell 1.0