43 lines
1 KiB
Bash
Executable file
43 lines
1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# prep
|
|
dnf install git -y
|
|
workdir=$(mktemp -d)
|
|
built_dir=${COMPILED_DIR:-/compiled}/polycat
|
|
mkdir -p $built_dir
|
|
version_file=$built_dir/version
|
|
touch $version_file
|
|
|
|
# clone and check whether it's up-to-date
|
|
cd $workdir
|
|
git clone https://github.com/2IMT/polycat.git
|
|
cd ./polycat/
|
|
# check version
|
|
version=$(printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)")
|
|
if grep -q $version $version_file; then
|
|
echo "already up to date, exiting"
|
|
exit
|
|
fi
|
|
# get build deps
|
|
dnf install cmake g++ -y
|
|
# get submodules
|
|
git submodule update --init --depth 1
|
|
|
|
|
|
# compilation
|
|
cd $workdir/polycat/
|
|
cmake -DCMAKE_BUILD_TYPE=RELEASE .
|
|
cmake --build .
|
|
|
|
# build .tar.zst archive
|
|
cd $workdir
|
|
mkdir ./polycat-built
|
|
mv ./polycat/polycat ./polycat-built/
|
|
mv ./polycat/res/polycat.ttf ./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"
|