Update GNOME packaging architecture awareness, fix aarch64 build

This commit is contained in:
wheaney 2024-07-17 15:05:07 -07:00
parent 3b437f1b41
commit dae47ccbb0
8 changed files with 46 additions and 98 deletions

View File

@ -3,8 +3,8 @@
# exit when any command fails # exit when any command fails
set -e set -e
ARCH=$(uname -m) ARCH=${ARCH:-$(uname -m)}
echo "Building for $ARCH" 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)
@ -12,9 +12,12 @@ 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
@ -23,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
@ -35,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-$ARCH.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
@ -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 # 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
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_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)
@ -76,5 +84,11 @@ popd
# bundle everything up # bundle everything up
pushd $GNOME_BUILD_DIR pushd $GNOME_BUILD_DIR
tar -zcvf breezyGNOME-$ARCH.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

@ -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/

View File

@ -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 .

View File

@ -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/

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"
) )

@ -1 +1 @@
Subproject commit bbf77403b432e25b763900a6fc90ff551b914155 Subproject commit 6a85172e70e91c1f86c0eba17bbfaadd52ca20db

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,14 +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 --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 OUT_DIR=$SCRIPT_DIR/../out
rm -rf $OUT_DIR rm -rf $OUT_DIR
mkdir -p $OUT_DIR mkdir -p $OUT_DIR
flatpak build-init $TMP_DIR/build org.example.myapp org.gnome.Sdk org.gnome.Platform 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-builder --disable-rofiles-fuse --disable-cache --force-clean $TMP_DIR/build $SCRIPT_DIR/../com.xronlinux.BreezyDesktop.json flatpak build-export --arch $ARCH $TMP_DIR/export $TMP_DIR/build
flatpak build-export $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
flatpak build-bundle $TMP_DIR/export $OUT_DIR/com.xronlinux.BreezyDesktop.flatpak com.xronlinux.BreezyDesktop --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
rm -rf "$TMP_DIR" rm -rf "$TMP_DIR"

View File

@ -3,7 +3,13 @@
<id>com.xronlinux.BreezyDesktop.desktop</id> <id>com.xronlinux.BreezyDesktop.desktop</id>
<metadata_license>CC0-1.0</metadata_license> <metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0-or-later</project_license> <project_license>GPL-3.0-or-later</project_license>
<name>Breezy Desktop</name>
<summary>XR Desktop Control Panel</summary>
<description> <description>
<p>No description</p> <p>XR Desktop Control Panel</p>
</description> </description>
<categories>
<category>Office</category>
<category>Development</category>
</categories>
</component> </component>