From dae47ccbb0d0bbfb4a95aee782578486cb8c07ea Mon Sep 17 00:00:00 2001
From: wheaney <42350981+wheaney@users.noreply.github.com>
Date: Wed, 17 Jul 2024 15:05:07 -0700
Subject: [PATCH] Update GNOME packaging architecture awareness, fix aarch64
build
---
bin/package_gnome | 46 ++++++++++++-------
docker-build/Dockerfile | 43 -----------------
docker-build/init.sh | 15 ------
docker-build/run-build.sh | 16 -------
gnome/bin/breezy_gnome_verify | 2 +-
modules/XRLinuxDriver | 2 +-
ui/bin/package | 12 +++--
...om.xronlinux.BreezyDesktop.metainfo.xml.in | 8 +++-
8 files changed, 46 insertions(+), 98 deletions(-)
delete mode 100644 docker-build/Dockerfile
delete mode 100755 docker-build/init.sh
delete mode 100755 docker-build/run-build.sh
diff --git a/bin/package_gnome b/bin/package_gnome
index 5d8c530..b4a112b 100755
--- a/bin/package_gnome
+++ b/bin/package_gnome
@@ -3,8 +3,8 @@
# exit when any command fails
set -e
-ARCH=$(uname -m)
-echo "Building for $ARCH"
+ARCH=${ARCH:-$(uname -m)}
+echo "Building Breezy GNOME for $ARCH"
# https://stackoverflow.com/a/246128
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
@@ -12,9 +12,12 @@ ROOT_DIR=$(realpath $SCRIPT_DIR/..)
VULKAN_DIR=$ROOT_DIR/vulkan
GNOME_DIR=$ROOT_DIR/gnome
GNOME_BUILD_DIR=$GNOME_DIR/build
+BUILD_FILE_NAME=breezyGNOME-$ARCH.tar.gz
-rm -rf $GNOME_BUILD_DIR
mkdir -p $GNOME_BUILD_DIR
+if [ -e "$GNOME_BUILD_DIR/$BUILD_FILE_NAME" ]; then
+ rm $GNOME_BUILD_DIR/$BUILD_FILE_NAME
+fi
PACKAGE_DIR=$GNOME_BUILD_DIR/breezy_gnome
rm -rf $PACKAGE_DIR
@@ -23,9 +26,6 @@ mkdir -p $PACKAGE_DIR
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
-
# if a custom_banner image exists, copy it over the sombrero one
if [ -e "$VULKAN_DIR/custom_banner.png" ]; then
cp $VULKAN_DIR/custom_banner.png $PACKAGE_DIR
@@ -35,10 +35,10 @@ fi
mkdir -p $PACKAGE_DIR/bin
copy_and_inject_ua "$XREAL_DRIVER_DIR/bin/ua.sh" "$PACKAGE_DIR/bin" "$GNOME_DIR/bin/setup" "$GNOME_DIR/bin/breezy_gnome_verify" "$GNOME_DIR/bin/breezy_gnome_uninstall"
-XREAL_BINARY=$XREAL_DRIVER_DIR/build/xrealAirLinuxDriver-$ARCH.tar.gz
+XREAL_BINARY=$XREAL_DRIVER_DIR/out/xrealAirLinuxDriver-$ARCH.tar.gz
pushd $XREAL_DRIVER_DIR
-if [ ! -e "$XREAL_BINARY" ] || [ "$1" != "--skip-module-builds" ]; then
+if [ ! -e "$XREAL_BINARY" ] || [ "$1" == "--rebuild-driver" ]; then
# if a file exists at custom_banner_config.yml, copy it to the xrealAirLinuxDriver directory
if [ -e "$VULKAN_DIR/custom_banner_config.yml" ]; then
cp $VULKAN_DIR/custom_banner_config.yml $XREAL_DRIVER_DIR
@@ -47,25 +47,33 @@ if [ ! -e "$XREAL_BINARY" ] || [ "$1" != "--skip-module-builds" ]; then
# strange issue where the base library produces a .so file if the build is not cleaned
rm -rf build/
- BREEZY_DESKTOP=1 bin/package
+ docker-build/init.sh
+ BREEZY_DESKTOP=1 docker-build/run-build.sh $ARCH
fi
-
-XREAL_MANIFEST_LINE=$(sha256sum build/driver_air_glasses/manifest)
popd
+TMP_DIR=$(mktemp -d -t breezy-gnome-XXXXXXXXXX)
+pushd $TMP_DIR
+cp $XREAL_BINARY $TMP_DIR/xrealAirLinuxDriver.tar.gz
+tar -xf $TMP_DIR/xrealAirLinuxDriver.tar.gz
+
+XREAL_MANIFEST_LINE=$(sha256sum driver_air_glasses/manifest)
+popd
+rm -rf $TMP_DIR
+
cp $XREAL_BINARY $PACKAGE_DIR/xrealAirLinuxDriver.tar.gz
cp $XREAL_DRIVER_DIR/bin/xreal_driver_setup $PACKAGE_DIR/bin
gnome/bin/package_extension
-cp gnome/out/* $PACKAGE_DIR
+cp gnome/out/breezydesktop@xronlinux.com.shell-extension.zip $PACKAGE_DIR
# create a checksum that combines the checksums of all files in the directory
pushd gnome/src
GNOME_MANIFEST_LINE=$(find -L . -type f ! -name "*.compiled" -exec sha256sum {} \; | sort | sha256sum | sed 's/ .*//')
popd
-ui/bin/package
-cp ui/out/* $PACKAGE_DIR
+ui/bin/package $ARCH
+cp ui/out/com.xronlinux.BreezyDesktop-$ARCH.flatpak $PACKAGE_DIR/com.xronlinux.BreezyDesktop.flatpak
# create manifest file for verifying installed file checksums against the originally packaged versions
# include any file that doesn't get modified during setup (e.g. vkBasalt.json files)
@@ -76,5 +84,11 @@ popd
# bundle everything up
pushd $GNOME_BUILD_DIR
-tar -zcvf breezyGNOME-$ARCH.tar.gz breezy_gnome
-popd
\ No newline at end of file
+tar -zcvf $BUILD_FILE_NAME breezy_gnome
+popd
+
+mkdir -p out
+if [ -e "out/$BUILD_FILE_NAME" ]; then
+ rm out/$BUILD_FILE_NAME
+fi
+cp $GNOME_BUILD_DIR/$BUILD_FILE_NAME out
\ No newline at end of file
diff --git a/docker-build/Dockerfile b/docker-build/Dockerfile
deleted file mode 100644
index ef7ab3c..0000000
--- a/docker-build/Dockerfile
+++ /dev/null
@@ -1,43 +0,0 @@
-# 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 .
-# docker run --rm -t -v ./:/source -v ./out/amd64:/out --platform linux/amd64 "breezy-desktop:amd64"
-# docker run --rm -t -v ./:/source -v ./out/arm64:/out --platform linux/arm64 "breezy-desktop:arm64"
-# docker run --rm -t -v ./:/source -v ./out/arm64:/out --platform linux/arm64 "breezy-desktop:armv7"
-
-FROM --platform=$TARGETPLATFORM debian:latest
-
-ARG TARGETPLATFORM
-RUN echo "Target platform: $TARGETPLATFORM"
-
-RUN apt-get update && apt-get install -y \
- build-essential \
- cmake \
- pkg-config \
- libudev-dev \
- libusb-1.0-0-dev \
- libcurl4-openssl-dev \
- libevdev-dev \
- libssl-dev \
- libjson-c-dev \
- python3 \
- python3-yaml \
- flatpak \
- 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 gnome/build/*.tar.gz /out/
\ No newline at end of file
diff --git a/docker-build/init.sh b/docker-build/init.sh
deleted file mode 100755
index 9744546..0000000
--- a/docker-build/init.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-
-if [[ "$1" == "--init" || ! $(docker buildx inspect breezydesktopbuilder &>/dev/null; echo $?) -eq 0 ]]; then
- # start fresh
- echo "Creating new docker builder instance"
- docker buildx rm breezydesktopbuilder 2>/dev/null || true
- docker buildx create --name breezydesktopbuilder --use
-else
- echo "Using existing docker builder instance"
- docker buildx use breezydesktopbuilder
-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 .
\ No newline at end of file
diff --git a/docker-build/run-build.sh b/docker-build/run-build.sh
deleted file mode 100755
index dd0b963..0000000
--- a/docker-build/run-build.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-set -e
-
-# Create output directories
-mkdir -p out/x86_64 out/aarch64
-
-# Run containers for each architecture
-sudo rm -rf build/
-docker run --privileged --rm -t -v ./:/source -v ./out/x86_64:/out --platform linux/amd64 "breezy-desktop:amd64"
-
-sudo rm -rf build/
-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/breezy_gnome_verify b/gnome/bin/breezy_gnome_verify
index c91b47b..af525ba 100755
--- a/gnome/bin/breezy_gnome_verify
+++ b/gnome/bin/breezy_gnome_verify
@@ -12,7 +12,7 @@ DATA_DIR="$XDG_DATA_HOME/breezy_gnome"
# create a string to string mapping, file name to expected file location
declare -A file_paths
file_paths=(
- ["build/driver_air_glasses/manifest"]="$USER_HOME/.local/bin/xr_driver/manifest"
+ ["driver_air_glasses/manifest"]="$USER_HOME/.local/bin/xr_driver/manifest"
["breezydesktop@xronlinux.com"]="$XDG_DATA_HOME/gnome-shell/extensions/breezydesktop@xronlinux.com"
)
diff --git a/modules/XRLinuxDriver b/modules/XRLinuxDriver
index bbf7740..6a85172 160000
--- a/modules/XRLinuxDriver
+++ b/modules/XRLinuxDriver
@@ -1 +1 @@
-Subproject commit bbf77403b432e25b763900a6fc90ff551b914155
+Subproject commit 6a85172e70e91c1f86c0eba17bbfaadd52ca20db
diff --git a/ui/bin/package b/ui/bin/package
index 3b6bd3d..b257757 100755
--- a/ui/bin/package
+++ b/ui/bin/package
@@ -3,6 +3,9 @@
# exit when any command fails
set -e
+ARCH=${ARCH:-$(uname -m)}
+echo "Building Breezy UI for $ARCH"
+
check_command() {
if ! command -v "$1" &>/dev/null; then
echo "Please install \"$1\" and make sure it's available in your \$PATH"
@@ -16,14 +19,13 @@ check_command "flatpak-builder"
# https://stackoverflow.com/a/246128
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
-TMP_DIR=$(mktemp -d --tmpdir=$SCRIPT_DIR -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 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
+flatpak-builder --arch $ARCH --disable-rofiles-fuse --disable-cache --force-clean --delete-build-dirs --user $TMP_DIR/build $SCRIPT_DIR/../com.xronlinux.BreezyDesktop.json
+flatpak build-export --arch $ARCH $TMP_DIR/export $TMP_DIR/build
+flatpak build-bundle --arch $ARCH $TMP_DIR/export $OUT_DIR/com.xronlinux.BreezyDesktop-$ARCH.flatpak com.xronlinux.BreezyDesktop --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
rm -rf "$TMP_DIR"
\ No newline at end of file
diff --git a/ui/data/com.xronlinux.BreezyDesktop.metainfo.xml.in b/ui/data/com.xronlinux.BreezyDesktop.metainfo.xml.in
index eab0852..b16137d 100644
--- a/ui/data/com.xronlinux.BreezyDesktop.metainfo.xml.in
+++ b/ui/data/com.xronlinux.BreezyDesktop.metainfo.xml.in
@@ -3,7 +3,13 @@
com.xronlinux.BreezyDesktop.desktop
CC0-1.0
GPL-3.0-or-later
+ Breezy Desktop
+ XR Desktop Control Panel
- No description
+ XR Desktop Control Panel
+
+ Office
+ Development
+