diff --git a/.forgejo/workflows/rpm.yml b/.forgejo/workflows/rpm.yml index 479665c..825c3e6 100644 --- a/.forgejo/workflows/rpm.yml +++ b/.forgejo/workflows/rpm.yml @@ -25,11 +25,15 @@ jobs: fetch-depth: 0 - name: Build - # /var/cache/quine-rpm-build outlives the job (host-mode runner): the Flutter SDK and pub packages. + # /var/cache/quine-rpm-build outlives the job (host-mode runner): the Flutter SDKs and pub packages. + # Once per architecture: Flutter can't cross-compile, so arm64 builds in an arm64 Fedora under + # the runner's QEMU emulation (slow). quine-linux's arm64 image installs that one. run: | mkdir -p out /var/cache/quine-rpm-build - podman run --rm -v "$PWD":/src -v /var/cache/quine-rpm-build:/cache -v "$PWD/out":/out \ - registry.fedoraproject.org/fedora:44 bash /src/packaging/build-flutter-rpm.sh dnf-package-store + for arch in amd64 arm64; do + podman run --rm --platform "linux/$arch" -v "$PWD":/src -v /var/cache/quine-rpm-build:/cache -v "$PWD/out":/out \ + registry.fedoraproject.org/fedora:44 bash /src/packaging/build-flutter-rpm.sh dnf-package-store + done ls -l out - name: Upload to the quine RPM group diff --git a/packaging/build-flutter-rpm.sh b/packaging/build-flutter-rpm.sh index d22f5e9..93faf54 100755 --- a/packaging/build-flutter-rpm.sh +++ b/packaging/build-flutter-rpm.sh @@ -18,14 +18,20 @@ dnf install -y --setopt=install_weak_deps=False \ clang cmake ninja-build pkgconf-pkg-config gtk3-devel xz-devel libstdc++-devel \ git xz which unzip rpm-build desktop-file-utils -sdk=/cache/flutter-$FLUTTER_VERSION +# Flutter builds for the machine it runs on: x64 natively, arm64 in an arm64 +# container (the runner's QEMU emulation). One SDK per architecture. +case $(uname -m) in x86_64) arch=x64 ;; aarch64) arch=arm64 ;; *) echo "unsupported: $(uname -m)" >&2; exit 1 ;; esac +sdk=/cache/flutter-$FLUTTER_VERSION-$arch if [ ! -x "$sdk/bin/flutter" ]; then - curl -fL --retry 3 -o /cache/flutter.tar.xz \ + curl -fL --retry 3 -o "/cache/flutter-$arch.tar.xz" \ "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_$FLUTTER_VERSION-stable.tar.xz" - echo "$FLUTTER_SHA256 /cache/flutter.tar.xz" | sha256sum -c + echo "$FLUTTER_SHA256 /cache/flutter-$arch.tar.xz" | sha256sum -c rm -rf "$sdk.tmp" && mkdir -p "$sdk.tmp" - tar -xJf /cache/flutter.tar.xz -C "$sdk.tmp" --strip-components=1 - mv "$sdk.tmp" "$sdk" && rm /cache/flutter.tar.xz + tar -xJf "/cache/flutter-$arch.tar.xz" -C "$sdk.tmp" --strip-components=1 + # The release tarball carries an x64 Dart SDK; without it, the first run + # fetches the one for this machine. + [ "$arch" = x64 ] || rm -rf "$sdk.tmp/bin/cache" + mv "$sdk.tmp" "$sdk" && rm "/cache/flutter-$arch.tar.xz" fi # The SDK and this checkout belong to other users than the container's root. git config --global --add safe.directory '*' @@ -40,5 +46,5 @@ release=$(date -u +%Y%m%d%H%M).git$(git rev-parse --short=7 HEAD) rpmbuild -bb "packaging/$NAME.spec" \ --define "_topdir /tmp/rpmbuild" \ --define "version_ $version" --define "release_ $release" \ - --define "bundle /src/build/linux/x64/release/bundle" --define "srcdir /src" + --define "bundle /src/build/linux/$arch/release/bundle" --define "srcdir /src" cp -v /tmp/rpmbuild/RPMS/*/*.rpm /out/ diff --git a/packaging/dnf-package-store.spec b/packaging/dnf-package-store.spec index adb8b71..80b1322 100644 --- a/packaging/dnf-package-store.spec +++ b/packaging/dnf-package-store.spec @@ -14,7 +14,7 @@ Release: %{release_}%{?dist} Summary: Browse DNF packages and try them out with transient installs License: LicenseRef-Not-Specified URL: https://forge.quinefoundation.com/quine-global-labs/dnf-package-store -ExclusiveArch: x86_64 +ExclusiveArch: x86_64 aarch64 Requires: gtk3 Requires: polkit