I’m setting with this hack:
Stuff everything in a single part (combining all the parts’ build-packages) and have its override-build manually fetch each tarball (wget/curl/you name it), extract it, manually build it and then remove the sources. As illustration, here is the full context diff.
diff --git a/snapcraft.yaml b/snapcraft.yaml
index a1eb3bc..2117679 100644
--- a/snapcraft.yaml
+++ b/snapcraft.yaml
@@ -1,315 +1,124 @@
name: chromium-ffmpeg
version: "116575-116569-115541-115016"
summary: FFmpeg codecs (free and proprietary) for use by third-party browser snaps
description: |
This package provides a chromium-ffmpeg content interface that third-party
browser snaps can connect to to get access to a host of proprietary codecs for
web content that they might not be allowed to redistribute themselves.
confinement: strict
base: core22
slots:
chromium-ffmpeg-115016: # chromium 124.0.6367.118
interface: content
source:
read:
- $SNAP/chromium-ffmpeg-115016/chromium-ffmpeg
chromium-ffmpeg-115541: # chromium 125.0.6420.0
interface: content
source:
read:
- $SNAP/chromium-ffmpeg-115541/chromium-ffmpeg
chromium-ffmpeg-116569: # chromium 127.0.6533.4.tar.xz
interface: content
source:
read:
- $SNAP/chromium-ffmpeg-116569/chromium-ffmpeg
chromium-ffmpeg-116575: # chromium 130.0.6683.2
interface: content
source:
read:
- $SNAP/chromium-ffmpeg-116569/chromium-ffmpeg
parts:
build:
plugin: dump
source: build
organize:
'*' : build/
override-prime: ""
chromium-ffmpeg-115016:
- after: [build, chromium-ffmpeg-115541]
+ after: [build]
plugin: nil
source: https://commondatastorage.googleapis.com/chromium-browser-official/chromium-124.0.6367.118.tar.xz
source-checksum: sha512/7615e301d02e2d06f64a75d601b64089c8f528ab546745a358fd521cb26d63b15dbc3f1faa4952d1d510bf0c2a132301023b8e179a21e26cf1c48a80e1650e3f
build-snaps:
- - llvm-chromium
- build-packages:
- - chrpath
- - cmake
- - elfutils
- - gperf
- - libatk1.0-dev
- - libatk-bridge2.0-dev
- - libcups2-dev
- - libevdev-dev
- - libgbm-dev
- - libglib2.0-dev
- - libgtk-3-dev
- - libnss3-dev
- - libpango1.0-dev
- - mesa-common-dev
- - ninja-build
- - python3
- - quilt
- - rustc
- build-environment:
- - CC: /snap/llvm-chromium/current/bin/clang
- - CXX: /snap/llvm-chromium/current/bin/clang++
- - AR: /snap/llvm-chromium/current/bin/llvm-ar
- override-pull: |
- craftctl default
- # Find the space offenders, builders are getting out of space.
- # Top offenders so far and whether they are required (R) or can be
- # deleted (D) for a successful build:
- # R 292M llvm-build
- # R 316M blink
- # 367M tflite
- # 372M catapult
- # R 442M devtools-frontend
- # R 956M dawn
- # D 1,2G rust-toolchain
- # R 1,3G swiftshader
- # R 1,7G angle
- # D 1,9G llvm
- # D 4,4G rust-src
- du -sh third_party/*|sort -h
- rm -rf third_party/{rust-src,llvm,rust-toolchain}
- override-build: |
- set -eux
- rm -rf $SNAPCRAFT_PART_SRC/*
- VERSION=115016
- QUILT_PATCHES=$SNAPCRAFT_STAGE/build/$VERSION quilt push -a
- python3 tools/gn/bootstrap/bootstrap.py --skip-generate-buildfiles
- OUT=out/ffmpeg
- mkdir -p $OUT
- cp $SNAPCRAFT_STAGE/build/$VERSION/args.gn $OUT/
- if [ $CRAFT_TARGET_ARCH = "armhf" ]; then
- # Do not build with ThinLTO either, because it requires lld
- echo "use_thin_lto = false" >> $OUT/args.gn
- # Do not build with NEON on armhf (https://launchpad.net/bugs/1884856)
- echo "arm_use_neon = false" >> $OUT/args.gn
- fi
- out/Release/gn gen $OUT
- ninja -C $OUT libffmpeg.so
- DEST=$SNAPCRAFT_PART_INSTALL/chromium-ffmpeg-$VERSION/chromium-ffmpeg
- mkdir -p $DEST
- cp $OUT/libffmpeg.so $DEST/
- rm -rf *
- chromium-ffmpeg-115541: # chromium 125
- after: [build, chromium-ffmpeg-116569]
- plugin: nil
- source: https://commondatastorage.googleapis.com/chromium-browser-official/chromium-125.0.6420.0.tar.xz
- source-checksum: sha512/32e351b4d8309d2db0e1859dc3e99e3a63c2689ed21da4cf686faf71c767994c04ea745a3e581e1944450414e1fa1f0b4278ac71ef77f4f02e56e6b68cf9ca00
- build-snaps:
- - llvm-chromium
- build-packages:
- - chrpath
- - cmake
- - elfutils
- - gperf
- - libatk1.0-dev
- - libatk-bridge2.0-dev
- - libcups2-dev
- - libevdev-dev
- - libgbm-dev
- - libglib2.0-dev
- - libgtk-3-dev
- - libnss3-dev
- - libpango1.0-dev
- - mesa-common-dev
- - ninja-build
- - python3
- - quilt
- - rustc
- build-environment:
- - CC: /snap/llvm-chromium/current/bin/clang
- - CXX: /snap/llvm-chromium/current/bin/clang++
- - AR: /snap/llvm-chromium/current/bin/llvm-ar
- override-pull: |
- craftctl default
- # Find the space offenders, builders are getting out of space.
- # Top offenders so far and whether they are required (R) or can be
- # deleted (D) for a successful build:
- # R 292M llvm-build
- # R 316M blink
- # 367M tflite
- # 372M catapult
- # R 442M devtools-frontend
- # R 956M dawn
- # D 1,2G rust-toolchain
- # R 1,3G swiftshader
- # R 1,7G angle
- # D 1,9G llvm
- # D 4,4G rust-src
- du -sh third_party/*|sort -h
- rm -rf third_party/{rust-src,llvm,rust-toolchain}
- override-build: |
- set -eux
- rm -rf $SNAPCRAFT_PART_SRC/*
- VERSION=115541
- QUILT_PATCHES=$SNAPCRAFT_STAGE/build/$VERSION quilt push -a
- python3 tools/gn/bootstrap/bootstrap.py --skip-generate-buildfiles
- OUT=out/ffmpeg
- mkdir -p $OUT
- cp $SNAPCRAFT_STAGE/build/$VERSION/args.gn $OUT/
- if [ $CRAFT_TARGET_ARCH = "armhf" ]; then
- # Do not build with ThinLTO either, because it requires lld
- echo "use_thin_lto = false" >> $OUT/args.gn
- # Do not build with NEON on armhf (https://launchpad.net/bugs/1884856)
- echo "arm_use_neon = false" >> $OUT/args.gn
- fi
- out/Release/gn gen $OUT
- ninja -C $OUT libffmpeg.so
- DEST=$SNAPCRAFT_PART_INSTALL/chromium-ffmpeg-$VERSION/chromium-ffmpeg
- mkdir -p $DEST
- cp $OUT/libffmpeg.so $DEST/
- rm -rf *
- chromium-ffmpeg-116569: # chromium 127
- after: [build]
- plugin: nil
- source: https://commondatastorage.googleapis.com/chromium-browser-official/chromium-127.0.6533.4.tar.xz
- source-checksum: sha512/b203c016978683402ab08a171326bb1fd41921de4cad46945af5fefb0983ecc07b15a5f2911d0282caeb459a243b2adaa99809172c632109950ff24ffebf3fd9
- build-snaps:
- - llvm-chromium
+ - llvm-chromium/beta
build-packages:
- chrpath
- cmake
- elfutils
- gperf
- libatk1.0-dev
- libatk-bridge2.0-dev
- libcups2-dev
- libevdev-dev
- libgbm-dev
- libglib2.0-dev
- libgtk-3-dev
- libnss3-dev
- libpango1.0-dev
- mesa-common-dev
- ninja-build
- python3
- quilt
- rustc
+ - wget
build-environment:
- CC: /snap/llvm-chromium/current/bin/clang
- CXX: /snap/llvm-chromium/current/bin/clang++
- AR: /snap/llvm-chromium/current/bin/llvm-ar
override-pull: |
craftctl default
# Find the space offenders, builders are getting out of space.
# Top offenders so far and whether they are required (R) or can be
# deleted (D) for a successful build:
# R 292M llvm-build
# R 316M blink
# 367M tflite
# 372M catapult
# R 442M devtools-frontend
# R 956M dawn
# D 1,2G rust-toolchain
# R 1,3G swiftshader
# R 1,7G angle
# D 1,9G llvm
# D 4,4G rust-src
du -sh third_party/*|sort -h
rm -rf third_party/{rust-src,llvm,rust-toolchain}
override-build: |
set -eux
rm -rf $SNAPCRAFT_PART_SRC/*
- VERSION=116569
- QUILT_PATCHES=$SNAPCRAFT_STAGE/build/$VERSION quilt push -a
- python3 tools/gn/bootstrap/bootstrap.py --skip-generate-buildfiles
- OUT=out/ffmpeg
- mkdir -p $OUT
- cp $SNAPCRAFT_STAGE/build/$VERSION/args.gn $OUT/
- if [ $CRAFT_TARGET_ARCH = "armhf" ]; then
- # Do not build with ThinLTO either, because it requires lld
- echo "use_thin_lto = false" >> $OUT/args.gn
- # Do not build with NEON on armhf (https://launchpad.net/bugs/1884856)
- echo "arm_use_neon = false" >> $OUT/args.gn
- fi
- out/Release/gn gen $OUT
- ninja -C $OUT libffmpeg.so
- DEST=$SNAPCRAFT_PART_INSTALL/chromium-ffmpeg-$VERSION/chromium-ffmpeg
- mkdir -p $DEST
- cp $OUT/libffmpeg.so $DEST/
- rm -rf *
- chromium-ffmpeg-116575: # chromium 130
- after: [build]
- plugin: nil
- source: https://commondatastorage.googleapis.com/chromium-browser-official/chromium-130.0.6683.2.tar.xz
- source-checksum: sha512/5406523316ab1f378660fdcfbfd4ba0a372e2b56dbb8f04f9906b822cb3778d90fad5fa1df7dc183ce288e2a4cb06880c6a473c792c22a9642d15f6aafcff5c6
- build-snaps:
- - llvm-chromium
- build-packages:
- - chrpath
- - cmake
- - elfutils
- - gperf
- - libatk1.0-dev
- - libatk-bridge2.0-dev
- - libcups2-dev
- - libevdev-dev
- - libgbm-dev
- - libglib2.0-dev
- - libgtk-3-dev
- - libnss3-dev
- - libpango1.0-dev
- - mesa-common-dev
- - ninja-build
- - python3
- - quilt
- - rustc
- build-environment:
- - CC: /snap/llvm-chromium/current/bin/clang
- - CXX: /snap/llvm-chromium/current/bin/clang++
- - AR: /snap/llvm-chromium/current/bin/llvm-ar
- override-pull: |
- craftctl default
- # Find the space offenders, builders are getting out of space.
- # Top offenders so far and whether they are required (R) or can be
- # deleted (D) for a successful build:
- # R 292M llvm-build
- # R 316M blink
- # 367M tflite
- # 372M catapult
- # R 442M devtools-frontend
- # R 956M dawn
- # D 1,2G rust-toolchain
- # R 1,3G swiftshader
- # R 1,7G angle
- # D 1,9G llvm
- # D 4,4G rust-src
- du -sh third_party/*|sort -h
- rm -rf third_party/{rust-src,llvm,rust-toolchain}
- override-build: |
- set -eux
- rm -rf $SNAPCRAFT_PART_SRC/*
- VERSION=116575
+
+ main(){
+ VERSION=$1
QUILT_PATCHES=$SNAPCRAFT_STAGE/build/$VERSION quilt push -a
python3 tools/gn/bootstrap/bootstrap.py --skip-generate-buildfiles
OUT=out/ffmpeg
mkdir -p $OUT
cp $SNAPCRAFT_STAGE/build/$VERSION/args.gn $OUT/
if [ $CRAFT_TARGET_ARCH = "armhf" ]; then
# Do not build with ThinLTO either, because it requires lld
echo "use_thin_lto = false" >> $OUT/args.gn
# Do not build with NEON on armhf (https://launchpad.net/bugs/1884856)
echo "arm_use_neon = false" >> $OUT/args.gn
fi
out/Release/gn gen $OUT
ninja -C $OUT libffmpeg.so
DEST=$SNAPCRAFT_PART_INSTALL/chromium-ffmpeg-$VERSION/chromium-ffmpeg
mkdir -p $DEST
cp $OUT/libffmpeg.so $DEST/
- rm -rf *
+ rm -rf * .pc
+ }
+
+ main 115016
+
+ wget -q -O- https://commondatastorage.googleapis.com/chromium-browser-official/chromium-130.0.6683.2.tar.xz | tar xJ --strip-components=1
+ main 116575
+
+ wget -q -O- https://commondatastorage.googleapis.com/chromium-browser-official/chromium-125.0.6420.0.tar.xz | tar xJ --strip-components=1
+ ls . ..
+ main 115541
+
+ wget -q -O- https://commondatastorage.googleapis.com/chromium-browser-official/chromium-127.0.6533.4.tar.xz | tar xJ --strip-components=1
+ main 116569