2021-07-17 13:28:45 +02:00
|
|
|
#!/bin/sh
|
2023-02-11 23:50:01 +01:00
|
|
|
|
2021-07-17 13:28:45 +02:00
|
|
|
set -e
|
|
|
|
|
2023-02-11 23:50:01 +01:00
|
|
|
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)"
|
|
|
|
|
2023-02-13 10:34:40 +01:00
|
|
|
# The final path where we'll save the .deb package
|
2023-02-13 11:33:25 +01:00
|
|
|
deb_path="Chatterino-ubuntu-${ubuntu_release}-x86_64.deb"
|
2023-02-13 10:34:40 +01:00
|
|
|
|
2023-02-11 23:50:01 +01:00
|
|
|
# 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"
|
|
|
|
|
2021-07-17 13:28:45 +02:00
|
|
|
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
|
|
|
|
fi
|
|
|
|
|
2022-11-08 23:07:44 +01:00
|
|
|
chatterino_version=$(git describe 2>/dev/null | cut -c 2-) || true
|
|
|
|
if [ -z "$chatterino_version" ]; then
|
2023-02-11 23:50:01 +01:00
|
|
|
# Fall back to this in case the build happened outside of a git repo
|
2022-11-08 23:07:44 +01:00
|
|
|
chatterino_version="0.0.0-dev"
|
|
|
|
fi
|
2021-07-17 13:28:45 +02:00
|
|
|
|
2023-02-11 23:50:01 +01:00
|
|
|
# Make sure no old remnants of a previous packaging remains
|
|
|
|
rm -vrf "$packaging_dir"
|
2021-07-17 13:28:45 +02:00
|
|
|
|
2023-02-11 23:50:01 +01:00
|
|
|
mkdir -p "$packaging_dir/DEBIAN"
|
2021-07-17 13:28:45 +02:00
|
|
|
|
|
|
|
echo "Making control file"
|
|
|
|
cat >> "$packaging_dir/DEBIAN/control" << EOF
|
|
|
|
Package: chatterino
|
2023-02-11 23:50:01 +01:00
|
|
|
Version: $chatterino_version
|
2021-07-17 13:28:45 +02:00
|
|
|
Architecture: amd64
|
|
|
|
Maintainer: Mm2PL <mm2pl@kotmisia.pl>
|
2023-02-11 23:50:01 +01:00
|
|
|
Depends: $dependencies
|
|
|
|
Section: net
|
|
|
|
Priority: optional
|
|
|
|
Homepage: https://github.com/Chatterino/chatterino2
|
|
|
|
Description: Ubuntu package built for $ubuntu_release
|
2021-07-17 13:28:45 +02:00
|
|
|
EOF
|
2023-02-11 23:50:01 +01:00
|
|
|
cat "$packaging_dir/DEBIAN/control"
|
|
|
|
breakline
|
|
|
|
|
|
|
|
|
|
|
|
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
|
2021-07-17 13:28:45 +02:00
|
|
|
|
|
|
|
|
2023-02-11 23:50:01 +01:00
|
|
|
echo "Building package"
|
2023-02-13 10:34:40 +01:00
|
|
|
dpkg-deb --build "$packaging_dir" "$deb_path"
|
2023-02-11 23:50:01 +01:00
|
|
|
breakline
|
|
|
|
|
|
|
|
|
|
|
|
echo "Package info"
|
2023-02-13 10:34:40 +01:00
|
|
|
dpkg --info "$deb_path"
|
2023-02-11 23:50:01 +01:00
|
|
|
breakline
|
|
|
|
|
|
|
|
|
|
|
|
echo "Package contents"
|
2023-02-13 10:34:40 +01:00
|
|
|
dpkg --contents "$deb_path"
|
2023-02-11 23:50:01 +01:00
|
|
|
breakline
|