From 9efaca5698d71005f2fab42f1dc8c638604eb574 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sun, 19 Feb 2023 14:52:45 +0100 Subject: [PATCH] Initial version of dankerino build --- PKGBUILD | 70 +++++++++++++++++++++++++++++++++++++++++++++++ update_version.sh | 40 +++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 PKGBUILD create mode 100755 update_version.sh diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..e82f9f3 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,70 @@ +# Maintainer: Knut Ahlers + +pkgname=chatterino2-dankerino-git +pkgver=2023.02.16 +pkgrel=1 +pkgdesc="Fork of Chatterino 2" +arch=(any) +url=https://github.com/Mm2PL/dankerino +license=('MIT') +depends=('qt5-base' 'qt5-tools' 'boost-libs' 'openssl' 'qt5-imageformats' 'qtkeychain-qt5') +makedepends=('git' 'qt5-svg' 'boost' 'cmake') +optdepends=( + 'streamlink: For piping streams to video players' + 'pulseaudio: For audio output' +) +provides=('chatterino') +conflicts=('chatterino') + +source=("git+${url}.git#tag=nightly-build") +sha512sums=(SKIP) + +build() { + cd "${srcdir}/dankerino" + + mkdir -p build + cd build + + cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DUSE_SYSTEM_QTKEYCHAIN=ON \ + -DUSE_PRECOMPILED_HEADERS=OFF \ + .. + + if [ -z "$CCACHE_SLOPPINESS" ]; then + # We need to set the ccache sloppiness for the chatterino build to use it properly + # This is due to our use of precompiled headers + # See https://ccache.dev/manual/3.3.5.html#_precompiled_headers + CCACHE_SLOPPINESS="pch_defines,time_macros" + export CCACHE_SLOPPINESS + fi + + make +} + +package() { + cd "$srcdir/dankerino" + + if [ -f "build/bin/chatterino" ] && [ -x "build/bin/chatterino" ]; then + echo "Getting chatterino binary from bin folder" + install -Dm755 "build/bin/chatterino" "$pkgdir/usr/bin/chatterino" + else + echo "Getting chatterino binary from NON-BIN folder" + # System ccache is enabled, causing the binary file to not fall into the bin folder + # Temporary solution until we have figured out a way to stabilize the ccache output + install -Dm755 "build/chatterino" "$pkgdir/usr/bin/chatterino" + fi + + install -Dm644 "resources/com.chatterino.chatterino.desktop" "$pkgdir/usr/share/applications/com.chatterino.chatterino.desktop" + install -Dm644 "resources/icon.png" "$pkgdir/usr/share/pixmaps/chatterino.png" +} + +pkgver() { + cd "${srcdir}/dankerino" + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" +} + +prepare() { + cd "${srcdir}/dankerino" + git submodule update --init --recursive +} diff --git a/update_version.sh b/update_version.sh new file mode 100755 index 0000000..26ed604 --- /dev/null +++ b/update_version.sh @@ -0,0 +1,40 @@ +#!/bin/bash +set -euxo pipefail + +# Read pkg name +PKG=$(awk -F '=' '/pkgname=/{ print $2 }' PKGBUILD) + +# Get latest version date +VER_DATE=$( + curl -sSf https://api.github.com/repos/Mm2PL/dankerino/commits/nightly-build | + jq -r '.commit.author.date' +) +[[ -n $VER_DATE ]] || exit 1 + +VER=$(date -d ${VER_DATE} +%Y.%m.%d) + +# Insert latest version into PKGBUILD +sed -i \ + -e "s/^pkgver=.*/pkgver=${VER}/" \ + PKGBUILD + +# Check whether this changed anything +if (git diff --exit-code PKGBUILD); then + echo "Package ${PKG} has most recent version ${VER}" + exit 0 +fi + +# Reset pkgrel +sed -i \ + -e 's/pkgrel=.*/pkgrel=1/' \ + PKGBUILD + +# Update source hashes +updpkgsums + +# Update .SRCINFO +makepkg --printsrcinfo >.SRCINFO + +# Commit changes +git add PKGBUILD .SRCINFO +git commit -m "${PKG} v${VER}"