Skip to content

Commit

Permalink
Add 32- and 64-bit Linux builds, AppImage and .deb
Browse files Browse the repository at this point in the history
  • Loading branch information
CalcProgrammer1 committed Apr 11, 2021
1 parent 88499e1 commit 723b346
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 9 deletions.
72 changes: 68 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,86 @@ stages:
before_script:
- echo "started by ${GITLAB_USER_NAME}"

#reusable templates
.ccache_init: &ccache_init
before_script:
- apt update
- apt install -y build-essential qtcreator qt5-default libopenal-dev pkgconf wget git

#-----------------------------------------------------------------------#
# Linux (AppImage) Build Target #
# Linux (AppImage) 32-bit Build Target #
#-----------------------------------------------------------------------#
build_linux:
build_linux_32:
<<: *ccache_init
image: i386/ubuntu:bionic
stage: build
script:
- export $(dpkg-architecture)
- ./scripts/build-appimage.sh

artifacts:
paths:
- Keyboard_Visualizer-i386.AppImage
expire_in: 30 days

#-----------------------------------------------------------------------#
# Linux (AppImage) 64-bit Build Target #
#-----------------------------------------------------------------------#
build_linux_64:
<<: *ccache_init
image: ubuntu:bionic
stage: build
script:
- apt update
- apt install -y build-essential qtcreator qt5-default libopenal-dev pkgconf wget git
- export $(dpkg-architecture)
- ./scripts/build-appimage.sh

artifacts:
paths:
- Keyboard_Visualizer-x86_64.AppImage
expire_in: 30 days

#-----------------------------------------------------------------------#
# Linux (.deb) 32-bit Build Target #
#-----------------------------------------------------------------------#
build_linux_deb32:
<<: *ccache_init
image: i386/ubuntu:bionic
stage: build
script:
- apt install -y debhelper
- dpkg-architecture -l
- dpkg-buildpackage --target-arch i386 -us -B
- rm -v ../keyboardvisualizer-dbgsym*.ddeb
- mv -v ../keyboardvisualizer*.deb ./

artifacts:
paths:
- keyboardvisualizer*.deb
exclude:
- keyboardvisualizer-dbgsym*.deb
expire_in: 30 days

#-----------------------------------------------------------------------#
# Linux (.deb) 64-bit Build Target #
#-----------------------------------------------------------------------#
build_linux_deb64:
<<: *ccache_init
image: ubuntu:bionic
stage: build
script:
- apt install -y debhelper
- dpkg-architecture -l
- dpkg-buildpackage -us -B
- rm -v ../keyboardvisualizer-dbgsym*.ddeb
- mv -v ../keyboardvisualizer*.deb ./

artifacts:
paths:
- keyboardvisualizer*.deb
exclude:
- keyboardvisualizer-dbgsym*.deb
expire_in: 30 days

#-----------------------------------------------------------------------#
# Windows (32-bit) Build Target #
#-----------------------------------------------------------------------#
Expand Down
23 changes: 18 additions & 5 deletions scripts/build-appimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ fi

BUILD_DIR=$(mktemp -d -p "$TEMP_BASE" appimage-build-XXXXXX)

#-----------------------------------------------------------------------#
# This checks the Architecture of the system to work out if we're #
# building on i386 or x86_64 and saves for later use #
#-----------------------------------------------------------------------#

if [ ${DEB_HOST_ARCH:0:1} == ${DEB_HOST_GNU_CPU:0:1} ]; then
ARCH="$DEB_HOST_ARCH"
else
ARCH="$DEB_HOST_GNU_CPU"
fi
echo Inputs: "$DEB_HOST_ARCH" "$DEB_HOST_GNU_CPU"
echo Calculated: "$ARCH"

#-----------------------------------------------------------------------#
# Make sure to clean up build dir, even if errors occur #
#-----------------------------------------------------------------------#
Expand Down Expand Up @@ -51,7 +64,7 @@ qmake "$REPO_ROOT"
#-----------------------------------------------------------------------#
# Build project and install files into AppDir #
#-----------------------------------------------------------------------#
make -j$(nproc)
make -j$(nproc) TARGET="$TARGET"
make install INSTALL_ROOT=AppDir

#-----------------------------------------------------------------------#
Expand All @@ -64,12 +77,12 @@ chmod +x "$REPO_ROOT"/OpenRGB/scripts/tools/linuxdeploy*.AppImage
# files #
export QML_SOURCES_PATHS="$REPO_ROOT"/src

"$REPO_ROOT"/OpenRGB/scripts/tools/linuxdeploy-x86_64.AppImage --appimage-extract-and-run --appdir AppDir -e KeyboardVisualizer -i "$REPO_ROOT"/KeyboardVisualizerQT/KeyboardVisualizer.png -d "$REPO_ROOT"/KeyboardVisualizerQT/KeyboardVisualizer.desktop
"$REPO_ROOT"/OpenRGB/scripts/tools/linuxdeploy-plugin-qt-x86_64.AppImage --appimage-extract-and-run --appdir AppDir
"$REPO_ROOT"/OpenRGB/scripts/tools/linuxdeploy-x86_64.AppImage --appimage-extract-and-run --appdir AppDir --output appimage
"$REPO_ROOT"/OpenRGB/scripts/tools/linuxdeploy-"$ARCH".AppImage --appimage-extract-and-run --appdir AppDir -e "$TARGET" -i "$REPO_ROOT"/KeyboardVisualizerQT/KeyboardVisualizer.png -d "$REPO_ROOT"/KeyboardVisualizerQT/KeyboardVisualizer.desktop
"$REPO_ROOT"/OpenRGB/scripts/tools/linuxdeploy-plugin-qt-"$ARCH".AppImage --appimage-extract-and-run --appdir AppDir
"$REPO_ROOT"/OpenRGB/scripts/tools/linuxdeploy-"$ARCH".AppImage --appimage-extract-and-run --appdir AppDir --output appimage

#-----------------------------------------------------------------------#
# Move built AppImage back into original CWD #
#-----------------------------------------------------------------------#
mv Keyboard_Visualizer*.AppImage "$OLD_CWD"
mv "$TARGET"*.AppImage "$OLD_CWD"

0 comments on commit 723b346

Please sign in to comment.