diff --git a/ui/bin/package b/ui/bin/package index 6dbbae2..6dd6beb 100755 --- a/ui/bin/package +++ b/ui/bin/package @@ -6,30 +6,43 @@ 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" - exit 1 - fi -} +BUILD_PATH=build +UI_BUILD_PATH=$BUILD_PATH/ui +PACKAGE_DIR=$BUILD_PATH/breezy_ui +mkdir -p $UI_BUILD_PATH +mkdir -p $PACKAGE_DIR -check_command "flatpak" -check_command "flatpak-builder" +meson setup $UI_BUILD_PATH +pushd $UI_BUILD_PATH +meson compile +popd -# https://stackoverflow.com/a/246128 -SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) +PACKAGE_SRC_DIR=$PACKAGE_DIR/src +PACKAGE_BIN_DIR=$PACKAGE_DIR/bin +PACKAGE_ICONS_DIR=$PACKAGE_DIR/icons +mkdir -p $PACKAGE_SRC_DIR +mkdir -p $PACKAGE_BIN_DIR +mkdir -p $PACKAGE_ICONS_DIR -TMP_DIR=$(mktemp -d --tmpdir=$SCRIPT_DIR/.. -t .breezy-ui-flatpak-XXXXXXXXXX) -OUT_DIR=$SCRIPT_DIR/../out -mkdir -p $OUT_DIR +cp src/*.py $PACKAGE_SRC_DIR +cp -r po $BUILD_PATH +cp modules/PyXRLinuxDriverIPC/xrdriveripc.py $PACKAGE_SRC_DIR +cp $UI_BUILD_PATH/src/breezydesktop $PACKAGE_BIN_DIR +cp $UI_BUILD_PATH/src/breezydesktop.gresource $PACKAGE_DIR +cp $UI_BUILD_PATH/data/com.xronlinux.BreezyDesktop.desktop $PACKAGE_DIR -BUILD_ARTIFACT=$OUT_DIR/com.xronlinux.BreezyDesktop-$ARCH.flatpak -if [ -e "$BUILD_ARTIFACT" ]; then - rm $BUILD_ARTIFACT -fi +rsvg-convert data/icons/hicolor/scalable/apps/com.xronlinux.BreezyDesktop.svg -w 64 -h 64 -o $PACKAGE_ICONS_DIR/com.xronlinux.BreezyDesktop_64.png +rsvg-convert data/icons/hicolor/scalable/apps/com.xronlinux.BreezyDesktop.svg -w 128 -h 128 -o $PACKAGE_ICONS_DIR/com.xronlinux.BreezyDesktop_128.png +rsvg-convert data/icons/hicolor/scalable/apps/com.xronlinux.BreezyDesktop.svg -w 256 -h 256 -o $PACKAGE_ICONS_DIR/com.xronlinux.BreezyDesktop_256.png +rsvg-convert data/icons/hicolor/scalable/apps/com.xronlinux.BreezyDesktop.svg -w 1024 -h 1024 -o $PACKAGE_ICONS_DIR/com.xronlinux.BreezyDesktop_1024.png -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 $BUILD_ARTIFACT com.xronlinux.BreezyDesktop --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo +pushd $BUILD_PATH -rm -rf "$TMP_DIR" \ No newline at end of file +tar -zcvf breezyUI-$ARCH.tar.gz breezy_ui + +popd + +mkdir -p out +cp $BUILD_PATH/breezyUI-$ARCH.tar.gz out/ + +rm -rf $BUILD_PATH \ No newline at end of file diff --git a/ui/build-aux/dconf-override.patch b/ui/build-aux/dconf-override.patch deleted file mode 100644 index 2f6e38e..0000000 --- a/ui/build-aux/dconf-override.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/engine/dconf-engine-source-user.c b/engine/dconf-engine-source-user.c -index 1657875..e4f8786 100644 ---- a/engine/dconf-engine-source-user.c -+++ b/engine/dconf-engine-source-user.c -@@ -39,11 +39,17 @@ dconf_engine_source_user_open_gvdb (const gchar *name) - { - GvdbTable *table; - gchar *filename; -+ const gchar *override; -+ -+ override = g_getenv ("DCONF_USER_CONFIG_DIR"); -+ if (override == NULL) -+ filename = g_build_filename (g_get_user_config_dir (), "dconf", name, NULL); -+ else -+ filename = g_build_filename (g_get_home_dir (), override, name, NULL); - - /* This can fail in the normal case of the user not having any - * settings. That's OK and it shouldn't be considered as an error. - */ -- filename = g_build_filename (g_get_user_config_dir (), "dconf", name, NULL); - table = gvdb_table_new (filename, FALSE, NULL); - g_free (filename); - \ No newline at end of file diff --git a/ui/build-aux/start-breezy-desktop.sh b/ui/build-aux/start-breezy-desktop.sh deleted file mode 100644 index b82f292..0000000 --- a/ui/build-aux/start-breezy-desktop.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env bash - -# stolen from dconf-editor: -# https://gitlab.gnome.org/GNOME/dconf-editor/-/blob/master/build-aux/start-dconf-editor.sh - -IFS=: read -ra host_data_dirs < <(flatpak-spawn --host sh -c 'echo "$XDG_DATA_DIRS"') -IFS=: read -ra HOST_XDG_STATE_HOME < <(flatpak-spawn --host sh -c 'echo "$XDG_STATE_HOME"') -IFS=: read -ra HOST_XDG_CONFIG_HOME < <(flatpak-spawn --host sh -c 'echo "$XDG_CONFIG_HOME"') -IFS=: read -ra HOST_XDG_BIN_HOME < <(flatpak-spawn --host sh -c 'echo "$XDG_BIN_HOME"') -IFS=: read -ra HOST_XDG_DATA_HOME < <(flatpak-spawn --host sh -c 'echo "$XDG_DATA_HOME"') - -# To avoid potentially muddying up $XDG_DATA_DIRS too much, we link the schema paths -# into a temporary directory. -bridge_dir=$XDG_RUNTIME_DIR/dconf-bridge -mkdir -p "$bridge_dir" - -HOST_XDG_DATA_DIRS="" - -for dir in "${host_data_dirs[@]}"; do - if [[ "$dir" == /usr/* ]]; then - dir=/run/host/"$dir" - fi - - schemas="$dir/glib-2.0/schemas" - if [[ -d "$schemas" ]]; then - bridged=$(mktemp -d XXXXXXXXXX -p "$bridge_dir") - mkdir -p "$bridged"/glib-2.0 - ln -s "$schemas" "$bridged"/glib-2.0 - HOST_XDG_DATA_DIRS="${HOST_XDG_DATA_DIRS}:${bridged}" - fi -done - -# We MUST prepend the host's data dirs BEFORE the Flatpak environment's own dirs, -# otherwise data (such as default values) load in the wrong order and would then -# incorrectly prefer the Flatpak's internal defaults instead of the host's defaults! -if [[ ! -z "${HOST_XDG_DATA_DIRS}" ]]; then - XDG_DATA_DIRS="${HOST_XDG_DATA_DIRS:1}:${XDG_DATA_DIRS}" -fi - -if [[ ! -z "${HOST_XDG_BIN_HOME}" ]]; then - XDG_BIN_HOME="${HOST_XDG_BIN_HOME}" -else - XDG_BIN_HOME="$(realpath ~)/.local/bin" -fi - -if [[ ! -z "${HOST_XDG_STATE_HOME}" ]]; then - XDG_STATE_HOME="${HOST_XDG_STATE_HOME}" -else - XDG_STATE_HOME="$(realpath ~)/.local/state" -fi - -if [[ ! -z "${HOST_XDG_CONFIG_HOME}" ]]; then - XDG_CONFIG_HOME="${HOST_XDG_CONFIG_HOME}" -else - XDG_CONFIG_HOME="$(realpath ~)/.config" -fi - -if [[ ! -z "${HOST_XDG_DATA_HOME}" ]]; then - XDG_DATA_HOME="${HOST_XDG_DATA_HOME}" -else - XDG_DATA_HOME="$(realpath ~)/.local/share" -fi - -export XDG_DATA_DIRS -export XDG_BIN_HOME -export XDG_STATE_HOME -export XDG_CONFIG_HOME -export XDG_DATA_HOME -exec breezydesktop "$@" \ No newline at end of file diff --git a/ui/data/com.xronlinux.BreezyDesktop.desktop.in b/ui/data/com.xronlinux.BreezyDesktop.desktop.in index 3955dac..1264eef 100644 --- a/ui/data/com.xronlinux.BreezyDesktop.desktop.in +++ b/ui/data/com.xronlinux.BreezyDesktop.desktop.in @@ -1,6 +1,6 @@ [Desktop Entry] Name=Breezy Desktop -Exec=start-breezy-desktop +Exec=env LOCALE_DIR=/usr/local/share/breezydesktop/breezydesktop/po breezydesktop Icon=com.xronlinux.BreezyDesktop Terminal=false Type=Application diff --git a/ui/docker-build/Dockerfile b/ui/docker-build/Dockerfile new file mode 100644 index 0000000..8074855 --- /dev/null +++ b/ui/docker-build/Dockerfile @@ -0,0 +1,26 @@ +# To run the build from the package root: +# docker buildx build --platform linux/amd64,linux/arm64 -f ./docker-build/Dockerfile -t "breezy-ui" . +# docker run --rm -t -v ./:/source -v --platform linux/amd64 "breezy-ui:amd64" +# docker run --rm -t -v ./:/source -v --platform linux/arm64 "breezy-ui:arm64" + +FROM --platform=$TARGETPLATFORM debian:latest + +ARG TARGETPLATFORM +RUN echo "Target platform: $TARGETPLATFORM" + +RUN apt-get update && apt-get install -y \ + build-essential \ + meson \ + ninja-build \ + librsvg2-bin \ + libglib2.0-dev \ + libgtk-4-common \ + libgtk-4-bin \ + gtk-update-icon-cache \ + desktop-file-utils \ + gettext \ + appstream + +WORKDIR /source + +CMD bin/package \ No newline at end of file diff --git a/ui/docker-build/init.sh b/ui/docker-build/init.sh new file mode 100755 index 0000000..2d1d173 --- /dev/null +++ b/ui/docker-build/init.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# might be needed on a fresh docker setup: +# install qemu and qemu-user-static packages +# sudo docker context rm default +# docker run --privileged --rm tonistiigi/binfmt --install all +# sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes +# ls -l /proc/sys/fs/binfmt_misc/ # should contain qemu- files + +if [[ "$1" == "--init" || ! $(docker buildx inspect breezyuibuilder &>/dev/null; echo $?) -eq 0 ]]; then + # start fresh + echo "Creating new docker builder instance" + docker buildx rm breezyuibuilder 2>/dev/null || true + docker buildx create --use --name breezyuibuilder --driver docker-container --driver-opt image=moby/buildkit:latest +else + echo "Using existing docker builder instance" + docker buildx use breezyuibuilder +fi + +echo "Building docker image" +docker buildx build --platform linux/amd64 -f ./docker-build/Dockerfile -t "breezy-ui:amd64" --load . +docker buildx build --platform linux/arm64 -f ./docker-build/Dockerfile -t "breezy-ui:arm64" --load . \ No newline at end of file diff --git a/ui/docker-build/run-build.sh b/ui/docker-build/run-build.sh new file mode 100755 index 0000000..da29d78 --- /dev/null +++ b/ui/docker-build/run-build.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set -e + +USER=${SUDO_USER:-$USER} +GROUP=$(id -gn $USER) + +# Run containers for each architecture +if [[ "$1" == "x86_64" || -z "$1" ]]; then + sudo rm -rf build/ + docker run --rm -t -v ./:/source --platform linux/amd64 "breezy-ui:amd64" + sudo chown -R $USER:$GROUP out/ +fi + +if [[ "$1" == "aarch64" || -z "$1" ]]; then + sudo rm -rf build/ + docker run --rm -t -v ./:/source --platform linux/arm64 "breezy-ui:arm64" + sudo chown -R $USER:$GROUP out/ +fi + +# 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/ui/meson.build b/ui/meson.build index e851137..4d147ed 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -7,8 +7,6 @@ project('breezydesktop', i18n = import('i18n') gnome = import('gnome') - - subdir('data') subdir('src') subdir('po')