cd: the package builder scripts (ignored by the *build-* glob)

Force-added: .gitignore's *build-* pattern matches the filenames.
This commit is contained in:
2026-08-21 05:59:41 +08:00
parent 32cd8f46f0
commit f6e7bf20a4
3 changed files with 143 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
#!/bin/bash
# Oak Video Editor - Non-Linear Video Editor
# Copyright (C) 2026 Oak Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# 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 <http://www.gnu.org/licenses/>.
# Build the .deb by hand: stage the release binaries + resources, compute
# the FULL runtime dependency set with dpkg-shlibdeps (Debian-family names
# of the build distro), and pack with dpkg-deb. Run from the repo root
# after `cargo build --release`. Usage: tooling/package/build-deb.sh <version>
set -euo pipefail
VERSION="${1:?usage: build-deb.sh <version>}"
STAGING=target/pkg/deb
rm -rf "$STAGING"
mkdir -p "$STAGING/usr/bin" "$STAGING/usr/share/applications" \
"$STAGING/usr/share/icons/hicolor/512x512/apps" "$STAGING/usr/share/oak/i18n" \
"$STAGING/DEBIAN"
install -m755 target/release/oak-editor target/release/oak-cli target/release/oak-worker \
"$STAGING/usr/bin/"
install -m644 packaging/oak.desktop "$STAGING/usr/share/applications/oak.desktop"
install -m644 icons/icon.png "$STAGING/usr/share/icons/hicolor/512x512/apps/oak.png"
install -m644 assets/i18n/*.yaml "$STAGING/usr/share/oak/i18n/"
# The full shlib dependency set (FFmpeg/OCIO are statically linked, so
# only base-OS packages appear).
DEPS=$(for bin in "$STAGING"/usr/bin/*; do dpkg-shlibdeps -O "$bin"; done \
| sed 's/^shlibs:Depends=//' | tr ',' '\n' | sed 's/^ //;s/ $//' | sort -u \
| paste -sd', ' -)
echo "declared deps: $DEPS"
cat > "$STAGING/DEBIAN/control" <<EOF
Package: oak-editor
Version: $VERSION
Section: video
Priority: optional
Architecture: $(dpkg --print-architecture)
Maintainer: Oak Team
Depends: $DEPS
Description: Oak Video Editor — a free, open-source non-linear video editor
Oak is a non-linear video editor written in Rust (OpenFX plug-in host,
proxy editing, multicam, hardware decoding).
EOF
dpkg-deb --root-owner-group --build "$STAGING" "target/release/oak-editor_${VERSION}_amd64.deb"
echo "built target/release/oak-editor_${VERSION}_amd64.deb"
+39
View File
@@ -0,0 +1,39 @@
#!/bin/bash
# Oak Video Editor - Non-Linear Video Editor
# Copyright (C) 2026 Oak Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# 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 <http://www.gnu.org/licenses/>.
# Build the Arch package: substitute the version into the PKGBUILD and
# run makepkg (as a non-root user — makepkg refuses root, and CI
# containers are root). Run from the repo root after
# `cargo build --release`. Usage: tooling/package/build-pkg.sh <version>
set -euo pipefail
VERSION="${1:?usage: build-pkg.sh <version>}"
WORK=target/pkg/arch
rm -rf "$WORK"
mkdir -p "$WORK"
sed "s/@VERSION@/$VERSION/" tooling/package/PKGBUILD > "$WORK/PKGBUILD"
if [ "$(id -u)" = "0" ]; then
useradd -m builder 2>/dev/null || true
chown -R builder:builder "$WORK" target/release
su builder -c "cd '$PWD/$WORK' && OAK_BIN='$PWD/target/release' OAK_ROOT='$PWD' makepkg -f --nodeps"
else
(cd "$WORK" && OAK_BIN="$PWD/target/release" OAK_ROOT="$PWD" makepkg -f --nodeps)
fi
find "$WORK" -name '*.pkg.tar.zst' -exec mv {} target/release/ \;
ls target/release/*.pkg.tar.zst
+46
View File
@@ -0,0 +1,46 @@
#!/bin/bash
# Oak Video Editor - Non-Linear Video Editor
# Copyright (C) 2026 Oak Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# 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 <http://www.gnu.org/licenses/>.
# Build the .rpm: stage into a buildroot and let rpmbuild's automatic
# dependency discovery (find-requires) compute the Requires from the
# binaries' NEEDED entries. Run from the repo root after
# `cargo build --release`. Usage: tooling/package/build-rpm.sh <version>
set -euo pipefail
VERSION="${1:?usage: build-rpm.sh <version>}"
TOP=$(pwd)/target/pkg/rpm
rm -rf "$TOP"
mkdir -p "$TOP"/{BUILD,RPMS,SOURCES,SPECS,BUILDROOT}
ROOT="$TOP/BUILDROOT/oak-editor-$VERSION-1.x86_64"
mkdir -p "$ROOT/usr/bin" "$ROOT/usr/share/applications" \
"$ROOT/usr/share/icons/hicolor/512x512/apps" "$ROOT/usr/share/oak/i18n"
install -m755 target/release/oak-editor target/release/oak-cli target/release/oak-worker \
"$ROOT/usr/bin/"
install -m644 packaging/oak.desktop "$ROOT/usr/share/applications/oak.desktop"
install -m644 icons/icon.png "$ROOT/usr/share/icons/hicolor/512x512/apps/oak.png"
install -m644 assets/i18n/*.yaml "$ROOT/usr/share/oak/i18n/"
rpmbuild -bb \
--define "_topdir $TOP" \
--define "_version $VERSION" \
--define "buildroot $ROOT" \
--define "_binary_payload w6.zstdio" \
tooling/package/oak.spec
find "$TOP/RPMS" -name '*.rpm' -exec mv {} target/release/ \;
ls target/release/*.rpm