Add multi-arch build support (#29)

This commit is contained in:
Wayne Heaney 2024-07-18 17:40:36 -07:00 committed by GitHub
parent 182096bdf6
commit 44b1ebe464
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 41 additions and 26 deletions

View File

@ -3,15 +3,21 @@
# exit when any command fails # exit when any command fails
set -e set -e
ARCH=${ARCH:-$(uname -m)}
echo "Building Breezy GNOME for $ARCH"
# https://stackoverflow.com/a/246128 # https://stackoverflow.com/a/246128
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(realpath $SCRIPT_DIR/..) ROOT_DIR=$(realpath $SCRIPT_DIR/..)
VULKAN_DIR=$ROOT_DIR/vulkan VULKAN_DIR=$ROOT_DIR/vulkan
GNOME_DIR=$ROOT_DIR/gnome GNOME_DIR=$ROOT_DIR/gnome
GNOME_BUILD_DIR=$GNOME_DIR/build GNOME_BUILD_DIR=$GNOME_DIR/build
BUILD_FILE_NAME=breezyGNOME-$ARCH.tar.gz
rm -rf $GNOME_BUILD_DIR
mkdir -p $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 PACKAGE_DIR=$GNOME_BUILD_DIR/breezy_gnome
rm -rf $PACKAGE_DIR rm -rf $PACKAGE_DIR
@ -20,9 +26,6 @@ mkdir -p $PACKAGE_DIR
XREAL_DRIVER_DIR=$ROOT_DIR/modules/XRLinuxDriver XREAL_DRIVER_DIR=$ROOT_DIR/modules/XRLinuxDriver
source $XREAL_DRIVER_DIR/bin/inject_ua 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 a custom_banner image exists, copy it over the sombrero one
if [ -e "$VULKAN_DIR/custom_banner.png" ]; then if [ -e "$VULKAN_DIR/custom_banner.png" ]; then
cp $VULKAN_DIR/custom_banner.png $PACKAGE_DIR cp $VULKAN_DIR/custom_banner.png $PACKAGE_DIR
@ -32,10 +35,10 @@ fi
mkdir -p $PACKAGE_DIR/bin 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" 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.tar.gz XREAL_BINARY=$XREAL_DRIVER_DIR/out/xrealAirLinuxDriver-$ARCH.tar.gz
pushd $XREAL_DRIVER_DIR 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 a file exists at custom_banner_config.yml, copy it to the xrealAirLinuxDriver directory
if [ -e "$VULKAN_DIR/custom_banner_config.yml" ]; then if [ -e "$VULKAN_DIR/custom_banner_config.yml" ]; then
cp $VULKAN_DIR/custom_banner_config.yml $XREAL_DRIVER_DIR cp $VULKAN_DIR/custom_banner_config.yml $XREAL_DRIVER_DIR
@ -44,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 # strange issue where the base library produces a .so file if the build is not cleaned
rm -rf build/ rm -rf build/
BREEZY_DESKTOP=1 bin/package docker-build/init.sh
BREEZY_DESKTOP=1 docker-build/run-build.sh $ARCH
fi fi
XREAL_MANIFEST_LINE=$(sha256sum build/driver_air_glasses/manifest)
popd popd
cp $XREAL_BINARY $PACKAGE_DIR 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 cp $XREAL_DRIVER_DIR/bin/xreal_driver_setup $PACKAGE_DIR/bin
gnome/bin/package_extension 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 # create a checksum that combines the checksums of all files in the directory
pushd gnome/src pushd gnome/src
GNOME_MANIFEST_LINE=$(find -L . -type f ! -name "*.compiled" -exec sha256sum {} \; | sort | sha256sum | sed 's/ .*//') GNOME_MANIFEST_LINE=$(find -L . -type f ! -name "*.compiled" -exec sha256sum {} \; | sort | sha256sum | sed 's/ .*//')
popd popd
ui/bin/package ui/bin/package $ARCH
cp ui/out/* $PACKAGE_DIR 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 # 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) # include any file that doesn't get modified during setup (e.g. vkBasalt.json files)
@ -73,5 +84,11 @@ popd
# bundle everything up # bundle everything up
pushd $GNOME_BUILD_DIR pushd $GNOME_BUILD_DIR
tar -zcvf breezyGNOME.tar.gz breezy_gnome tar -zcvf $BUILD_FILE_NAME breezy_gnome
popd 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

View File

@ -12,7 +12,7 @@ DATA_DIR="$XDG_DATA_HOME/breezy_gnome"
# create a string to string mapping, file name to expected file location # create a string to string mapping, file name to expected file location
declare -A file_paths declare -A file_paths
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" ["breezydesktop@xronlinux.com"]="$XDG_DATA_HOME/gnome-shell/extensions/breezydesktop@xronlinux.com"
) )

View File

@ -5,11 +5,6 @@ UUID="breezydesktop@xronlinux.com"
# fail on error # fail on error
set -e 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 # https://stackoverflow.com/a/246128
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)

@ -1 +1 @@
Subproject commit b97faa82a7767e4270e46886d68dd1c70b71abca Subproject commit 45d895f409b35662af206c0921922452ceb5b6d7

View File

@ -3,6 +3,9 @@
# exit when any command fails # exit when any command fails
set -e set -e
ARCH=${ARCH:-$(uname -m)}
echo "Building Breezy UI for $ARCH"
check_command() { check_command() {
if ! command -v "$1" &>/dev/null; then if ! command -v "$1" &>/dev/null; then
echo "Please install \"$1\" and make sure it's available in your \$PATH" echo "Please install \"$1\" and make sure it's available in your \$PATH"
@ -16,13 +19,13 @@ check_command "flatpak-builder"
# https://stackoverflow.com/a/246128 # https://stackoverflow.com/a/246128
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
TMP_DIR=$(mktemp -d -t --tmpdir=$SCRIPT_DIR/.. breezy-ui-flatpak-XXXXXXXXXX) TMP_DIR=$(mktemp -d --tmpdir=$SCRIPT_DIR/.. -t .breezy-ui-flatpak-XXXXXXXXXX)
OUT_DIR=$SCRIPT_DIR/../out OUT_DIR=$SCRIPT_DIR/../out
rm -rf $OUT_DIR rm -rf $OUT_DIR
mkdir -p $OUT_DIR mkdir -p $OUT_DIR
flatpak-builder --force-clean --delete-build-dirs $TMP_DIR/build $SCRIPT_DIR/../com.xronlinux.BreezyDesktop.json 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 $TMP_DIR/export $TMP_DIR/build flatpak build-export --arch $ARCH $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 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" rm -rf "$TMP_DIR"