From b3a7b7be81e2dc32e9652f1fbb1e9a32c717b0d7 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Mon, 3 Aug 2020 21:18:32 -0500 Subject: [PATCH] Add 32-bit AppImage build target --- .gitlab-ci.yml | 22 ++++++++-- scripts/build-appimage-32.sh | 82 ++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 3 deletions(-) create mode 100755 scripts/build-appimage-32.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 51cb5829..10a879bd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,9 +21,25 @@ before_script: - echo "started by ${GITLAB_USER_NAME}" #-----------------------------------------------------------------------# -# Linux (AppImage) Build Target # +# Linux (AppImage) 32-bit Build Target # #-----------------------------------------------------------------------# -build_linux: +build_linux_32: + image: i386/ubuntu:bionic + stage: build + script: + - apt update + - apt install -y build-essential qtcreator qt5-default libusb-1.0-0-dev libhidapi-dev pkgconf wget git + - ./scripts/build-appimage-32.sh + + artifacts: + paths: + - OpenRGB-i386.AppImage + expire_in: 1337 years + +#-----------------------------------------------------------------------# +# Linux (AppImage) 64-bit Build Target # +#-----------------------------------------------------------------------# +build_linux_64: image: ubuntu:bionic stage: build script: @@ -35,7 +51,7 @@ build_linux: paths: - OpenRGB-x86_64.AppImage expire_in: 1337 years - + #-----------------------------------------------------------------------# # Windows (32-bit) Build Target # #-----------------------------------------------------------------------# diff --git a/scripts/build-appimage-32.sh b/scripts/build-appimage-32.sh new file mode 100755 index 00000000..50720333 --- /dev/null +++ b/scripts/build-appimage-32.sh @@ -0,0 +1,82 @@ +#!/bin/bash + +#-----------------------------------------------------------------------# +# OpenRGB AppImage 32-bit Build Script # +#-----------------------------------------------------------------------# + +set -x +set -e + +#-----------------------------------------------------------------------# +# Build in a temporary directory to keep the system clean # +# Use RAM disk if possible (if available and not building on a CI # +# system like Travis) # +#-----------------------------------------------------------------------# +if [ "$CI" == "" ] && [ -d /dev/shm ]; then + TEMP_BASE=/dev/shm +else + TEMP_BASE=/tmp +fi + +BUILD_DIR=$(mktemp -d -p "$TEMP_BASE" appimage-build-XXXXXX) + +#-----------------------------------------------------------------------# +# Make sure to clean up build dir, even if errors occur # +#-----------------------------------------------------------------------# +cleanup () { + if [ -d "$BUILD_DIR" ]; then + rm -rf "$BUILD_DIR" + fi +} +trap cleanup EXIT + +#-----------------------------------------------------------------------# +# Store repo root as variable # +#-----------------------------------------------------------------------# +REPO_ROOT=$(readlink -f $(dirname $(dirname $0))) +OLD_CWD=$(readlink -f .) + +#-----------------------------------------------------------------------# +# Switch to build dir # +#-----------------------------------------------------------------------# +pushd "$BUILD_DIR" + +#-----------------------------------------------------------------------# +# Configure build files with qmake # +# we need to explicitly set the install prefix, as qmake's default is # +# /usr/local for some reason... # +#-----------------------------------------------------------------------# +qmake "$REPO_ROOT" + +#-----------------------------------------------------------------------# +# Build project and install files into AppDir # +#-----------------------------------------------------------------------# +make -j$(nproc) +make install INSTALL_ROOT=AppDir + +#-----------------------------------------------------------------------# +# Now, build AppImage using linuxdeploy and linuxdeploy-plugin-qt # +# Download linuxdeploy and its Qt plugin # +#-----------------------------------------------------------------------# +wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-i386.AppImage +wget https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-i386.AppImage + +#-----------------------------------------------------------------------# +# Make them executable # +#-----------------------------------------------------------------------# +chmod +x linuxdeploy*.AppImage + +#-----------------------------------------------------------------------# +# Make sure Qt plugin finds QML sources so it can deploy the imported # +# files # +export QML_SOURCES_PATHS="$REPO_ROOT"/src + +./linuxdeploy-i386.AppImage --appimage-extract-and-run --appdir AppDir -e OpenRGB -i "$REPO_ROOT"/qt/OpenRGB.png -d "$REPO_ROOT"/qt/OpenRGB.desktop +./linuxdeploy-plugin-qt-i386.AppImage --appimage-extract-and-run --appdir AppDir +./linuxdeploy-i386.AppImage --appimage-extract-and-run --appdir AppDir --output appimage + +#-----------------------------------------------------------------------# +# Move built AppImage back into original CWD # +#-----------------------------------------------------------------------# +mv OpenRGB*.AppImage "$OLD_CWD" +