From 3b437f1b41e47d3d07044c34661116ba734a5c56 Mon Sep 17 00:00:00 2001 From: wheaney <42350981+wheaney@users.noreply.github.com> Date: Tue, 16 Jul 2024 19:38:00 -0700 Subject: [PATCH] Almost working breezy multi-arch build --- bin/package_gnome | 2 +- docker-build/Dockerfile | 17 ++++++++++++++--- docker-build/init.sh | 3 +-- docker-build/run-build.sh | 9 +++------ gnome/bin/package_extension | 5 ----- modules/XRLinuxDriver | 2 +- ui/bin/package | 5 +++-- 7 files changed, 23 insertions(+), 20 deletions(-) mode change 100644 => 100755 docker-build/init.sh diff --git a/bin/package_gnome b/bin/package_gnome index 9263e20..5d8c530 100755 --- a/bin/package_gnome +++ b/bin/package_gnome @@ -24,7 +24,7 @@ XREAL_DRIVER_DIR=$ROOT_DIR/modules/XRLinuxDriver source $XREAL_DRIVER_DIR/bin/inject_ua # check out submodules, recursively for nested ones -git submodule update --init --recursive +# git submodule update --init --recursive # if a custom_banner image exists, copy it over the sombrero one if [ -e "$VULKAN_DIR/custom_banner.png" ]; then diff --git a/docker-build/Dockerfile b/docker-build/Dockerfile index 349f920..ef7ab3c 100644 --- a/docker-build/Dockerfile +++ b/docker-build/Dockerfile @@ -1,4 +1,4 @@ -# To run the build from the package root: +# To run the build from the package root (note: requires non-root docker): # docker buildx build --platform linux/amd64 -f ./docker-build/Dockerfile -t "breezy-desktop:amd64" --load . # docker buildx build --platform linux/arm64 -f ./docker-build/Dockerfile -t "breezy-desktop:arm64" --load . # docker buildx build --platform linux/arm/v7 -f ./docker-build/Dockerfile -t "breezy-desktop:armv7" --load . @@ -24,9 +24,20 @@ RUN apt-get update && apt-get install -y \ python3 \ python3-yaml \ flatpak \ - flatpak-builder + flatpak-builder \ + libglib2.0-dev \ + gnome-shell-extensions + +RUN case "${TARGETPLATFORM}" in \ + "linux/amd64") FLATPAK_ARCH="x86_64" ;; \ + "linux/arm64") FLATPAK_ARCH="aarch64" ;; \ + *) FLATPAK_ARCH="x86_64" ;; \ + esac && \ + flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo && \ + flatpak install --user --noninteractive runtime/org.gnome.Sdk/${FLATPAK_ARCH}/46 && \ + flatpak install --user --noninteractive runtime/org.gnome.Platform/${FLATPAK_ARCH}/46 VOLUME /out WORKDIR /source -CMD bin/package_gnome && cp build/*.tar.gz /out/ \ No newline at end of file +CMD bin/package_gnome && cp gnome/build/*.tar.gz /out/ \ No newline at end of file diff --git a/docker-build/init.sh b/docker-build/init.sh old mode 100644 new mode 100755 index d13f798..9744546 --- a/docker-build/init.sh +++ b/docker-build/init.sh @@ -12,5 +12,4 @@ fi echo "Building docker image" docker buildx build --platform linux/amd64 -f ./docker-build/Dockerfile -t "breezy-desktop:amd64" --load . -docker buildx build --platform linux/arm64 -f ./docker-build/Dockerfile -t "breezy-desktop:arm64" --load . -docker buildx build --platform linux/arm/v7 -f ./docker-build/Dockerfile -t "breezy-desktop:armv7" --load . \ No newline at end of file +docker buildx build --platform linux/arm64 -f ./docker-build/Dockerfile -t "breezy-desktop:arm64" --load . \ No newline at end of file diff --git a/docker-build/run-build.sh b/docker-build/run-build.sh index 1a80ced..dd0b963 100755 --- a/docker-build/run-build.sh +++ b/docker-build/run-build.sh @@ -3,17 +3,14 @@ set -e # Create output directories -mkdir -p out/x86_64 out/aarch64 out/armv7 +mkdir -p out/x86_64 out/aarch64 # Run containers for each architecture sudo rm -rf build/ -docker run --rm -t -v ./:/source -v ./out/x86_64:/out --platform linux/amd64 "breezy-desktop:amd64" +docker run --privileged --rm -t -v ./:/source -v ./out/x86_64:/out --platform linux/amd64 "breezy-desktop:amd64" sudo rm -rf build/ -docker run --rm -t -v ./:/source -v ./out/aarch64:/out --platform linux/arm64 "breezy-desktop:arm64" - -sudo rm -rf build/ -docker run --rm -t -v ./:/source -v ./out/armv7:/out --platform linux/arm/v7 "breezy-desktop:armv7" +docker run --privileged --rm -t -v ./:/source -v ./out/aarch64:/out --platform linux/arm64 "breezy-desktop:arm64" # build directory structure is all owned by root because of docker, delete it all now sudo rm -rf build/ \ No newline at end of file diff --git a/gnome/bin/package_extension b/gnome/bin/package_extension index 69af779..346c2ad 100755 --- a/gnome/bin/package_extension +++ b/gnome/bin/package_extension @@ -5,11 +5,6 @@ UUID="breezydesktop@xronlinux.com" # fail on error set -e -if [[ $EUID -eq 0 ]]; then - echo "This script must NOT be run as root" 1>&2 - exit 1 -fi - # https://stackoverflow.com/a/246128 SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) diff --git a/modules/XRLinuxDriver b/modules/XRLinuxDriver index 68e1c44..bbf7740 160000 --- a/modules/XRLinuxDriver +++ b/modules/XRLinuxDriver @@ -1 +1 @@ -Subproject commit 68e1c44d890cc317241dae25abba6cde8093e22a +Subproject commit bbf77403b432e25b763900a6fc90ff551b914155 diff --git a/ui/bin/package b/ui/bin/package index a3c6764..3b6bd3d 100755 --- a/ui/bin/package +++ b/ui/bin/package @@ -16,12 +16,13 @@ check_command "flatpak-builder" # https://stackoverflow.com/a/246128 SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) -TMP_DIR=$(mktemp -d -t breezy-ui-flatpak-XXXXXXXXXX) +TMP_DIR=$(mktemp -d --tmpdir=$SCRIPT_DIR -t breezy-ui-flatpak-XXXXXXXXXX) OUT_DIR=$SCRIPT_DIR/../out rm -rf $OUT_DIR mkdir -p $OUT_DIR -flatpak-builder --force-clean $TMP_DIR/build $SCRIPT_DIR/../com.xronlinux.BreezyDesktop.json +flatpak build-init $TMP_DIR/build org.example.myapp org.gnome.Sdk org.gnome.Platform +flatpak-builder --disable-rofiles-fuse --disable-cache --force-clean $TMP_DIR/build $SCRIPT_DIR/../com.xronlinux.BreezyDesktop.json flatpak build-export $TMP_DIR/export $TMP_DIR/build flatpak build-bundle $TMP_DIR/export $OUT_DIR/com.xronlinux.BreezyDesktop.flatpak com.xronlinux.BreezyDesktop --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo