polycat/compilation.sh
askiiart 42f49fe1af
* use actual releases
* update for 2.0
* add note for why it's built with fedora instead of debian
2025-05-26 18:14:48 -05:00

43 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
# prep
dnf install jq -y
workdir=$(mktemp -d)
built_dir=${COMPILED_DIR:-/compiled}/polycat
mkdir -p $built_dir
version_file=$built_dir/version
touch $version_file
# check whether it's up-to-date
# check version
version=$(curl 'https://api.github.com/repos/2IMT/polycat/releases/latest' | jq '.tag_name' -r | tr -d 'v')
if grep -q $version $version_file; then
echo "already up to date, exiting"
exit
fi
# get build deps
dnf install make g++ -y
# get source
cd $workdir
curl -LO $(curl 'https://api.github.com/repos/2IMT/polycat/releases/latest' | jq '.assets' | jq '.[0].browser_download_url' -r)
tar -xzf polycat-$version.tar.gz
mv ./polycat-$version ./polycat
# compilation
cd $workdir/polycat
make
# build .tar.zst archive
cd $workdir
mkdir ./polycat-built
mv ./polycat/build/polycat ./polycat-built/
mv ./polycat/res/polycat.ttf ./polycat-built/
mv ./polycat/res/polycat-config ./polycat-built/
mkdir -p ${COMPILED_DIR:-/compiled}/polycat/
cd $workdir/polycat-built/
tar --zstd -cf $built_dir/polycat.tar.zst .
echo $version >$version_file
echo "polycat updated to $version"