Jenkins: Switch Linux builds to AppImage

This commit is contained in:
RichardG867
2022-02-11 22:47:23 -03:00
parent 8243773eb1
commit efc18ff70f
2 changed files with 104 additions and 16 deletions

67
.ci/AppImageBuilder.yml Normal file
View File

@@ -0,0 +1,67 @@
#
# 86Box A hypervisor and IBM PC system emulator that specializes in
# running old operating systems and software designed for IBM
# PC systems and compatibles from 1981 through fairly recent
# system designs based on the PCI bus.
#
# This file is part of the 86Box distribution.
#
# Recipe file for appimage-builder.
#
#
# Authors: RichardG, <richardg867@gmail.com>
#
# Copyright 2022 RichardG.
#
version: 1
AppDir:
path: ./archive_tmp
app_info:
id: !ENV 'net.${project_lower}.${project_lower}'
name: !ENV '${project}'
icon: !ENV '${project_lower}'
version: '3.2'
exec: !ENV 'usr/local/bin/${project}'
exec_args: $@
apt:
arch: !ENV '${arch_deb}'
sources:
- sourceline: 'deb http://deb.debian.org/debian bullseye main'
key_url: 'https://ftp-master.debian.org/keys/archive-key-11.asc'
- sourceline: 'deb http://security.debian.org/debian-security bullseye-security main'
key_url: 'https://ftp-master.debian.org/keys/archive-key-11.asc'
- sourceline: 'deb http://deb.debian.org/debian bullseye-updates main'
key_url: 'https://ftp-master.debian.org/keys/archive-key-11-security.asc'
include:
- libevdev2
- libopenal1
- libpng16-16
- libqt5core5a
- libqt5gui5
- libqt5widgets5
- librtmidi5
- libsdl2-2.0-0
- libslirp0
- libwayland-client0
- libx11-6
files:
exclude:
- etc
- lib/udev
- usr/bin
- usr/sbin
- usr/share/alsa
- usr/share/apport
- usr/share/doc
- usr/share/doc-base
- usr/share/glib-2.0
- usr/share/libwacom
- usr/share/lintian
- usr/share/locale
- usr/share/man
- usr/share/openal
- usr/share/pkgconfig
- usr/share/X11
AppImage:
arch: !ENV '${arch_appimage}'

View File

@@ -85,6 +85,7 @@ make_tar() {
# Set common variables.
project=86Box
project_lower=86box
cwd=$(pwd)
# Parse arguments.
@@ -226,7 +227,7 @@ else
esac
# Establish general dependencies.
pkgs="cmake pkg-config git tar xz-utils wayland-protocols"
pkgs="cmake pkg-config git imagemagick wayland-protocols"
if [ "$(dpkg --print-architecture)" = "$arch_deb" ]
then
pkgs="$pkgs build-essential"
@@ -412,24 +413,20 @@ then
# TBD
:
else
# Archive readme with library package versions.
echo Libraries used to compile this $arch build of $project: > archive_tmp/README
dpkg-query -f '${Package} ${Version}\n' -W $libpkgs | sed "s/-dev / /" | sed "s/qtdeclarative/qt/" | while IFS=" " read pkg version
do
for i in $(seq $(expr $longest_libpkg - $(echo -n $pkg | wc -c)))
do
echo -n " " >> archive_tmp/README
done
echo $pkg $version >> archive_tmp/README
done
# Archive icon, while also shrinking it to 512x512 if necessary.
convert src/win/assets/$project_lower.png -resize '512x512>' icon.png
icon_base="$(identify -format 'archive_tmp/usr/share/icons/%wx%h' icon.png)"
mkdir -p "$icon_base"
mv icon.png "$icon_base/$project_lower.png"
# Archive executable, while also stripping it if requested.
mkdir -p archive_tmp/usr/local/bin
if [ $strip -ne 0 ]
then
"$strip_binary" -o "archive_tmp/$project" "build/src/$project"
"$strip_binary" -o "archive_tmp/usr/local/bin/$project" "build/src/$project"
status=$?
else
mv "build/src/$project" "archive_tmp/$project"
mv "build/src/$project" "archive_tmp/usr/local/bin/$project"
status=$?
fi
fi
@@ -443,10 +440,10 @@ fi
# Produce artifact archive.
echo [-] Creating artifact archive
cd archive_tmp
if is_windows
then
# Create zip.
cd archive_tmp
"$sevenzip" a -y "$(cygpath -w "$cwd")\\$package_name.zip" *
status=$?
elif is_mac
@@ -454,9 +451,33 @@ then
# TBD
:
else
# Create binary tarball.
VERBOSE=1 make_tar "$cwd/$package_name.tar"
# Determine AppImage runtime architecture.
case $arch in
x86) arch_appimage="i686";;
arm32) arch_appimage="armhf";;
arm64) arch_appimage="aarch64";;
*) arch_appimage="$arch";;
esac
# Download appimage-builder if necessary.
[ ! -e "appimage-builder.AppImage" ] && wget -qO appimage-builder.AppImage \
https://github.com/AppImageCrafters/appimage-builder/releases/download/v0.9.2/appimage-builder-0.9.2-35e3eab-x86_64.AppImage
chmod u+x appimage-builder.AppImage
# Remove any dangling AppImages which may interfere with the renaming process.
rm -rf "$project-"*".AppImage"
# Run appimage-builder in extract-and-run mode for Docker compatibility.
project="$project" project_lower="$project_lower" arch_deb="$arch_deb" arch_appimage="$arch_appimage" \
APPIMAGE_EXTRACT_AND_RUN=1 ./appimage-builder.AppImage --recipe .ci/AppImageBuilder.yml
status=$?
# Rename AppImage to the final name if the build succeeded.
if [ $status -eq 0 ]
then
mv "$project-"*".AppImage" "$cwd/$package_name.AppImage"
status=$?
fi
fi
cd ..