-
-
Notifications
You must be signed in to change notification settings - Fork 450
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate Ubuntu .deb packages per Ubuntu release (#4357)
Our .deb packages are now very Ubuntu-specific and are packages based on our CI builds.
- Loading branch information
1 parent
cf80ae8
commit 98c2ff5
Showing
10 changed files
with
288 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,91 @@ | ||
#!/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 | ||
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 <[email protected]> | ||
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" | ||
make install | ||
find "$install_prefix" | ||
breakline | ||
|
||
|
||
echo "Merge install into packaging dir" | ||
cp -rv "$install_prefix/" "$packaging_dir/" | ||
find "$packaging_dir" | ||
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 "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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
FROM ubuntu:20.04 | ||
|
||
ENV TZ=UTC | ||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
|
||
RUN apt-get update && apt-get -y install --no-install-recommends \ | ||
cmake \ | ||
virtualenv \ | ||
rapidjson-dev \ | ||
libfuse2 \ | ||
libssl-dev \ | ||
libboost-dev \ | ||
libxcb-randr0-dev \ | ||
libboost-system-dev \ | ||
libboost-filesystem-dev \ | ||
libpulse-dev \ | ||
libxkbcommon-x11-0 \ | ||
build-essential \ | ||
libgl1-mesa-dev \ | ||
libxcb-icccm4 \ | ||
libxcb-image0 \ | ||
libxcb-keysyms1 \ | ||
libxcb-render-util0 \ | ||
libxcb-xinerama0 | ||
|
||
RUN apt-get -y install \ | ||
git \ | ||
lsb-release \ | ||
python3-pip && \ | ||
apt-get clean all | ||
|
||
# Install Qt as we do in CI | ||
|
||
RUN pip3 install -U pip && \ | ||
pip3 install aqtinstall && \ | ||
aqt install-qt linux desktop 5.12.12 && \ | ||
mkdir -p /opt/qt512 && \ | ||
mv /5.12.12/gcc_64/* /opt/qt512 | ||
|
||
ADD . /src | ||
|
||
RUN mkdir /src/build | ||
|
||
# cmake | ||
RUN cd /src/build && \ | ||
CXXFLAGS=-fno-sized-deallocation cmake \ | ||
-DCMAKE_INSTALL_PREFIX=appdir/usr/ \ | ||
-DCMAKE_PREFIX_PATH=/opt/qt512/lib/cmake \ | ||
-DBUILD_WITH_QTKEYCHAIN=OFF \ | ||
.. | ||
|
||
# build | ||
RUN cd /src/build && \ | ||
make -j8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM chatterino-ubuntu-20.04-build | ||
|
||
ADD .CI /src/.CI | ||
|
||
WORKDIR /src/build | ||
|
||
# RUN apt-get install -y wget | ||
|
||
# create appimage | ||
# RUN pwd && ./../.CI/CreateAppImage.sh | ||
|
||
# package deb | ||
RUN pwd && ./../.CI/CreateUbuntuDeb.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
FROM ubuntu:22.04 | ||
|
||
ENV TZ=UTC | ||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
|
||
RUN apt-get update && apt-get -y install --no-install-recommends \ | ||
cmake \ | ||
virtualenv \ | ||
rapidjson-dev \ | ||
libfuse2 \ | ||
libssl-dev \ | ||
libboost-dev \ | ||
libxcb-randr0-dev \ | ||
libboost-system-dev \ | ||
libboost-filesystem-dev \ | ||
libpulse-dev \ | ||
libxkbcommon-x11-0 \ | ||
build-essential \ | ||
libgl1-mesa-dev \ | ||
libxcb-icccm4 \ | ||
libxcb-image0 \ | ||
libxcb-keysyms1 \ | ||
libxcb-render-util0 \ | ||
libxcb-xinerama0 | ||
|
||
RUN apt-get -y install \ | ||
git \ | ||
lsb-release \ | ||
python3-pip && \ | ||
apt-get clean all | ||
|
||
# Install Qt as we do in CI | ||
|
||
RUN pip3 install -U pip && \ | ||
pip3 install aqtinstall && \ | ||
aqt install-qt linux desktop 5.15.2 && \ | ||
mkdir -p /opt/qt515 && \ | ||
mv /5.15.2/gcc_64/* /opt/qt515 | ||
|
||
ADD . /src | ||
|
||
RUN mkdir /src/build | ||
|
||
# Apply Qt patches | ||
RUN patch "/opt/qt515/include/QtConcurrent/qtconcurrentthreadengine.h" /src/.patches/qt5-on-newer-gcc.patch | ||
|
||
# cmake | ||
RUN cd /src/build && \ | ||
CXXFLAGS=-fno-sized-deallocation cmake \ | ||
-DCMAKE_INSTALL_PREFIX=appdir/usr/ \ | ||
-DCMAKE_PREFIX_PATH=/opt/qt515/lib/cmake \ | ||
-DBUILD_WITH_QTKEYCHAIN=OFF \ | ||
.. | ||
|
||
# build | ||
RUN cd /src/build && \ | ||
make -j8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM chatterino-ubuntu-22.04-build | ||
|
||
ADD .CI /src/.CI | ||
|
||
WORKDIR /src/build | ||
|
||
# package deb | ||
RUN ./../.CI/CreateUbuntuDeb.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
## Groups | ||
|
||
### Ubuntu 20.04 package | ||
|
||
`Dockerfile-ubuntu-20.04-package` relies on `Dockerfile-ubuntu-20.04-build` | ||
|
||
To build, from the repo root | ||
|
||
1. Build a docker image that contains all the build artifacts and source from building Chatterino on Ubuntu 20.04 | ||
`docker build -t chatterino-ubuntu-20.04-build -f .docker/Dockerfile-ubuntu-20.04-build .` | ||
1. Build a docker image that uses the above-built image & packages it into a .deb file | ||
`docker build -t chatterino-ubuntu-20.04-package -f .docker/Dockerfile-ubuntu-20.04-package .` | ||
|
||
To extract the final package, you can run the following command: | ||
`docker run -v $PWD:/opt/mount --rm -it chatterino-ubuntu-20.04-package bash -c "cp /src/build/Chatterino-x86_64.deb /opt/mount/"` | ||
|
||
### Ubuntu 22.04 package | ||
|
||
`Dockerfile-ubuntu-22.04-package` relies on `Dockerfile-ubuntu-22.04-build` | ||
|
||
To build, from the repo root | ||
|
||
1. Build a docker image that contains all the build artifacts and source from building Chatterino on Ubuntu 22.04 | ||
`docker build -t chatterino-ubuntu-22.04-build -f .docker/Dockerfile-ubuntu-22.04-build .` | ||
1. Build a docker image that uses the above-built image & packages it into a .deb file | ||
`docker build -t chatterino-ubuntu-22.04-package -f .docker/Dockerfile-ubuntu-22.04-package .` | ||
|
||
To extract the final package, you can run the following command: | ||
`docker run -v $PWD:/opt/mount --rm -it chatterino-ubuntu-22.04-package bash -c "cp /src/build/Chatterino-x86_64.deb /opt/mount/"` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
build* | ||
.mypy_cache | ||
.cache | ||
.docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.