Separate Ubuntu .deb packages per Ubuntu release (#4357)

Our .deb packages are now very Ubuntu-specific and are packages based on our CI builds.
This commit is contained in:
Wissididom
2023-02-11 23:50:01 +01:00
committed by GitHub
parent cf80ae8434
commit 98c2ff5607
10 changed files with 288 additions and 24 deletions
+3
View File
@@ -57,3 +57,6 @@ exec "$here/usr/bin/chatterino" "$@"' > appdir/AppRun
chmod a+x appdir/AppRun
./appimagetool-x86_64.AppImage appdir
# TODO: Create appimage in a unique directory instead maybe idk?
rm -rf appdir
+67 -16
View File
@@ -1,6 +1,37 @@
#!/bin/sh
set -e
breakline() {
printf "================================================================================\n\n"
}
# Configured in the CI step
install_prefix="appdir/usr"
# The directory we finally pack into our .deb package
packaging_dir="package"
# Get the Ubuntu Release (e.g. 20.04 or 22.04)
ubuntu_release="$(lsb_release -rs)"
# Refactor opportunity:
case "$ubuntu_release" in
20.04)
dependencies="libc6, libstdc++6, libqt5core5a, libqt5concurrent5, libqt5dbus5, libqt5gui5, libqt5network5, libqt5svg5, libqt5widgets5, qt5-image-formats-plugins, libboost-filesystem1.71.0"
;;
22.04)
dependencies="libc6, libstdc++6, libqt5core5a, libqt5concurrent5, libqt5dbus5, libqt5gui5, libqt5network5, libqt5svg5, libqt5widgets5, qt5-image-formats-plugins, libboost-filesystem1.74.0"
;;
*)
echo "Unsupported Ubuntu release $ubuntu_release"
exit 1
;;
esac
echo "Building Ubuntu .deb file on '$ubuntu_release'"
echo "Dependencies: $dependencies"
if [ ! -f ./bin/chatterino ] || [ ! -x ./bin/chatterino ]; then
echo "ERROR: No chatterino binary file found. This script must be run in the build folder, and chatterino must be built first."
exit 1
@@ -8,33 +39,53 @@ fi
chatterino_version=$(git describe 2>/dev/null | cut -c 2-) || true
if [ -z "$chatterino_version" ]; then
# Fall back to this in case the build happened outside of a git repo
chatterino_version="0.0.0-dev"
echo "Falling back to setting the version to '$chatterino_version'"
else
echo "Found Chatterino version $chatterino_version via git"
fi
rm -vrf "./package" || true # delete any old packaging dir
# Make sure no old remnants of a previous packaging remains
rm -vrf "$packaging_dir"
# create ./package/ from scratch
mkdir package/DEBIAN -p
packaging_dir="$(realpath ./package)"
mkdir -p "$packaging_dir/DEBIAN"
echo "Making control file"
cat >> "$packaging_dir/DEBIAN/control" << EOF
Package: chatterino
Section: net
Priority: optional
Version: $chatterino_version
Architecture: amd64
Maintainer: Mm2PL <mm2pl@kotmisia.pl>
Description: Testing out chatterino as a Ubuntu package
Depends: libc6, libqt5concurrent5, libqt5core5a, libqt5dbus5, libqt5gui5, libqt5multimedia5, libqt5network5, libqt5svg5, libqt5widgets5, libssl1.1, libstdc++6
Depends: $dependencies
Section: net
Priority: optional
Homepage: https://github.com/Chatterino/chatterino2
Description: Ubuntu package built for $ubuntu_release
EOF
echo "Version: $chatterino_version" >> "$packaging_dir/DEBIAN/control"
cat "$packaging_dir/DEBIAN/control"
breakline
echo "Running make install in package dir"
DESTDIR="$packaging_dir" make INSTALL_ROOT="$packaging_dir" -j"$(nproc)" install; find "$packaging_dir/"
echo ""
echo "Building package..."
echo "Running make install"
make install
find "$install_prefix"
breakline
echo "Merge install into packaging dir"
cp -rv "$install_prefix/" "$packaging_dir/"
find "$packaging_dir"
breakline
echo "Building package"
dpkg-deb --build "$packaging_dir" "Chatterino-x86_64.deb"
breakline
echo "Package info"
dpkg --info Chatterino-x86_64.deb
breakline
echo "Package contents"
dpkg --contents Chatterino-x86_64.deb # Shows folders and files inside .deb file
breakline