Fix package/build process so it produces steamos and non-steamos arch binaries

This commit is contained in:
wheaney 2025-08-25 15:09:26 -07:00
parent 705d940a0d
commit a6f9d0b9d0
12 changed files with 106 additions and 14 deletions

View File

@ -4,15 +4,20 @@
set -e
ARCH=${ARCH:-$(uname -m)}
BUILD_ARCH=$ARCH
if [ -n "${STEAMOS+x}" ]; then
ARCH="x86_64"
BUILD_ARCH="steamos"
fi
# https://stackoverflow.com/a/246128
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(realpath $SCRIPT_DIR/..)
XR_DRIVER_DIR=$ROOT_DIR/modules/XRLinuxDriver
echo "Building Breezy KWin for $ARCH"
echo "Building Breezy KWin for $BUILD_ARCH"
KWIN_DIR=$ROOT_DIR/kwin
BUILD_FILE_NAME=breezyKWin-$ARCH.tar.gz
BUILD_FILE_NAME=breezyKWin-$BUILD_ARCH.tar.gz
TMP_DIR=$(mktemp -d -t breezy-kwin-XXXXXXXXXX)
PACKAGE_DIR=$TMP_DIR/breezy_kwin
@ -56,9 +61,9 @@ cp $XR_DRIVER_DIR/bin/xr_driver_setup $PACKAGE_DIR/bin
pushd $KWIN_DIR
docker-build/init.sh
docker-build/run-build.sh $ARCH
docker-build/run-build.sh $BUILD_ARCH
popd
cp $KWIN_DIR/out/breezyKWinPlugin-$ARCH.tar.gz $PACKAGE_DIR/breezyKWinPlugin.tar.gz
cp $KWIN_DIR/out/breezyKWinPlugin-$BUILD_ARCH.tar.gz $PACKAGE_DIR/breezyKWinPlugin.tar.gz
pushd $TMP_DIR
tar -zcvf $BUILD_FILE_NAME breezy_kwin

View File

@ -40,9 +40,6 @@ if(${QT_MAJOR_VERSION} EQUAL 6)
find_package(KF${QT_MAJOR_VERSION} ${KF_MIN_VERSION} REQUIRED COMPONENTS KCMUtils)
find_package(KWin REQUIRED COMPONENTS kwineffects)
message(STATUS "Found KWin Version: ${KWin_VERSION}")
else()
find_package(KWinEffects REQUIRED COMPONENTS kwineffects kwinglutils)
message(STATUS "Found KWin Version: ${KWinEffects_VERSION}")
endif ()
include(cmake/info.cmake)
find_package(epoxy REQUIRED)

0
kwin/bin/breezy_kwin_uninstall Normal file → Executable file
View File

View File

@ -4,6 +4,9 @@
set -e
ARCH=${ARCH:-$(uname -m)}
if [ -n "${STEAMOS+x}" ]; then
ARCH="steamos"
fi
echo "Building Breezy KWin plugin for $ARCH"
BUILD_PATH=build

View File

@ -45,13 +45,23 @@ UA_EVENT_VERSION="$1"
tar -xf $(pwd)/breezyKWinPlugin.tar.gz
pushd breezy_desktop/usr > /dev/null
# locate the lib path that ends with qt6/plugins (handles multiarch dirs)
QT_PLUGIN_DIR_RELATIVE=$(find lib -type d -path '*/qt6/plugins' -print -quit 2>/dev/null || true)
if [ -z "$QT_PLUGIN_DIR_RELATIVE" ]; then
QT_PLUGIN_DIR_RELATIVE="lib/qt6/plugins"
fi
# directory structure matches XDG, so just recursive copy
$SUDO cp -r . "$USER_HOME/.local/"
chmod -R 755 .
cp -r . "$USER_HOME/.local/"
popd
cp bin/breezy_kwin_uninstall $XDG_BIN_HOME
# Install QT_PLUGIN_PATH snippet into ~/.bash_profile if not present
BASH_PROFILE="$HOME/.bash_profile"
QT_PLUGIN_DIR="$HOME/.local/lib/qt6/plugins"
QT_PLUGIN_DIR="$HOME/.local/$QT_PLUGIN_DIR_RELATIVE"
QT_PLUGIN_EXPORT="export QT_PLUGIN_PATH=\"$QT_PLUGIN_DIR\""
if [[ ! -f "$BASH_PROFILE" ]] || ! grep -Fq "$QT_PLUGIN_EXPORT" "$BASH_PROFILE" 2>/dev/null; then
mkdir -p "$(dirname "$BASH_PROFILE")"

View File

@ -3,7 +3,7 @@
# docker run --rm -t -v ./:/source -v --platform linux/amd64 "breezy-kwin:amd64"
# docker run --rm -t -v ./:/source -v --platform linux/arm64 "breezy-kwin:arm64"
FROM --platform=$TARGETPLATFORM ghcr.io/steamdeckhomebrew/holo-base:3.7@sha256:8da120a3e89c750abd0090c0aab86d543a55d667c3002c8d64960f7fd82ccdd6
FROM --platform=$TARGETPLATFORM archlinux:base-20250817.0.405639@sha256:31f0749bdb81517dc8f379feac0a3860b097f1da1f53c8315c1bae0817d6c0a1
ARG TARGETPLATFORM
RUN echo "Target platform: $TARGETPLATFORM"

View File

@ -0,0 +1,37 @@
# To run the build from the package root:
# docker buildx build --platform linux/amd64,linux/arm64 -f ./docker-build/Dockerfile.steamos -t "breezy-kwin-steamos" .
# docker run --rm -t -v ./:/source -v --platform linux/amd64 "breezy-kwin-steamos:amd64"
# docker run --rm -t -v ./:/source -v --platform linux/arm64 "breezy-kwin-steamos:arm64"
FROM --platform=$TARGETPLATFORM ghcr.io/steamdeckhomebrew/holo-base:3.7@sha256:8da120a3e89c750abd0090c0aab86d543a55d667c3002c8d64960f7fd82ccdd6
ARG TARGETPLATFORM
ENV STEAMOS=1
RUN echo "SteamOS build - target platform: $TARGETPLATFORM"
RUN pacman -Sy --noconfirm --needed \
ca-certificates \
base-devel \
cmake \
pkgconf \
git \
curl \
wget \
extra-cmake-modules \
qt6-base \
qt6-declarative \
qt6-tools \
kconfig \
kconfigwidgets \
kcoreaddons \
kglobalaccel \
ki18n \
kcmutils \
kxmlgui \
kwindowsystem \
kwin \
&& pacman -Scc --noconfirm
WORKDIR /source
CMD bin/package_kwin_plugin

View File

@ -19,4 +19,5 @@ fi
echo "Building docker image"
docker buildx build --platform linux/amd64 -f ./docker-build/Dockerfile -t "breezy-kwin:amd64" --load .
# docker buildx build --platform linux/arm64 -f ./docker-build/Dockerfile -t "breezy-kwin:arm64" --load .
# docker buildx build --platform linux/arm64 -f ./docker-build/Dockerfile -t "breezy-kwin:arm64" --load .
docker buildx build --platform linux/amd64 -f ./docker-build/Dockerfile.steamos -t "breezy-kwin-steamos:amd64" --load .

View File

@ -18,5 +18,11 @@ if [[ "$1" == "aarch64" || -z "$1" ]]; then
sudo chown -R $USER:$GROUP out/
fi
if [[ "$1" == "steamos" || -z "$1" ]]; then
sudo rm -rf build/
docker run --rm -t -v ./:/source --platform linux/amd64 "breezy-kwin-steamos:amd64"
sudo chown -R $USER:$GROUP out/
fi
# build directory structure is all owned by root because of docker, delete it all now
sudo chown -R $USER:$GROUP build/

View File

@ -7,6 +7,36 @@ target_sources(breezy_desktop PRIVATE
)
kconfig_add_kcfg_files(breezy_desktop breezydesktopconfig.kcfgc)
# Split KWin version into numeric components (major, minor, patch)
string(REGEX MATCHALL "[0-9]+" KWIN_VERSION_COMPONENTS "${KWin_VERSION}")
# defaults
set(KWIN_VERSION_MAJOR 0)
set(KWIN_VERSION_MINOR 0)
set(KWIN_VERSION_PATCH 0)
list(LENGTH KWIN_VERSION_COMPONENTS _kwin_version_len)
if(_kwin_version_len GREATER 0)
list(GET KWIN_VERSION_COMPONENTS 0 KWIN_VERSION_MAJOR)
endif()
if(_kwin_version_len GREATER 1)
list(GET KWIN_VERSION_COMPONENTS 1 KWIN_VERSION_MINOR)
endif()
if(_kwin_version_len GREATER 2)
list(GET KWIN_VERSION_COMPONENTS 2 KWIN_VERSION_PATCH)
endif()
# optional: a single encoded integer (major*10000 + minor*100 + patch)
math(EXPR KWIN_VERSION_ENCODED "${KWIN_VERSION_MAJOR} * 10000 + ${KWIN_VERSION_MINOR} * 100 + ${KWIN_VERSION_PATCH}")
# Export as compile definitions. Keep the original string macro as well.
target_compile_definitions(breezy_desktop PRIVATE
KWIN_VERSION_STR=\"${KWin_VERSION}\"
KWIN_VERSION_MAJOR=${KWIN_VERSION_MAJOR}
KWIN_VERSION_MINOR=${KWIN_VERSION_MINOR}
KWIN_VERSION_PATCH=${KWIN_VERSION_PATCH}
KWIN_VERSION_ENCODED=${KWIN_VERSION_ENCODED}
)
target_include_directories(breezy_desktop PRIVATE /usr/include/kwin)
target_link_libraries(breezy_desktop
Qt6::Core

View File

@ -233,8 +233,12 @@ void BreezyDesktopEffect::addVirtualDisplay(QSize size)
static int virtualDisplayCount = 0;
++virtualDisplayCount;
QString name = QStringLiteral("BreezyDesktop_VirtualDisplay_%1x%2_%3").arg(size.width()).arg(size.height()).arg(virtualDisplayCount);
QString description = QStringLiteral("Breezy Display %1x%2 (%3)").arg(size.width()).arg(size.height()).arg(virtualDisplayCount);
auto output = KWin::kwinApp()->outputBackend()->createVirtualOutput(name, size, 1.0);
#if defined(KWIN_VERSION_ENCODED) && KWIN_VERSION_ENCODED > 60290
QString description = QStringLiteral("Breezy Display %1x%2 (%3)").arg(size.width()).arg(size.height()).arg(virtualDisplayCount);
auto output = KWin::kwinApp()->outputBackend()->createVirtualOutput(name, description, size, 1.0);
#else
auto output = KWin::kwinApp()->outputBackend()->createVirtualOutput(name, size, 1.0);
#endif
if (output) {
m_virtualOutputs.append(output);
}

View File

@ -10,7 +10,6 @@
"Category": "Tools",
"Description": "Breezy Desktop XR Effect",
"EnabledByDefault": true,
"Id": "breezy_desktop",
"License": "GPL",
"Name": "Breezy Desktop XR"
},