Compare commits

...

No commits in common. "build" and "fedora" have entirely different histories.

5 changed files with 92 additions and 70 deletions

View file

@ -3,15 +3,20 @@ type: docker
name: default
steps:
- name: Build polycat
- name: Build polycat fedora package
image: fedora
commands:
- '/drone/src/compilation.sh'
- '/drone/src/run.sh'
volumes:
- name: program-archives
path: /compiled
- name: fedora-repo
path: /repo
volumes:
- name: program-archives
host:
path: /mnt/user/files/repos/archives
path: /mnt/user/files/repos/archives/
- name: fedora-repo
host:
path: /mnt/user/files/repos/fedora/x86_64/

View file

@ -1,24 +1 @@
# Polycat build
- Builds polycat and places it in `$COMPILED_DIR/polycat/polycat.tar.zst`
- Version file at `$COMPILED_DIR/polycat/version`
## Archive details
```
.
├── polycat
└── polycat.ttf
```
Recommended:
| File | Location | Permissions |
| ------------------ | ----------------------------------------- | ----------- |
| `./polycat` | `/usr/bin/polycat` | 755 |
| `./polycat.ttf` | `/usr/share/fonts/polycat/polycat.ttf` | 644 |
| `./polycat-config` | `/usr/local/share/polycat/polycat-config` | 644 |
---
Note: Builds with Fedora because Debian's gcc is out of date.
# Polycat (fedora)

View file

@ -1,43 +0,0 @@
#!/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"

42
polycat.spec Normal file
View file

@ -0,0 +1,42 @@
Name: polycat
Version: r93.0c836d5
Release: %autorelease
Summary: runcat module for polybar (or waybar)
License: MIT
URL: https://github.com/2IMT/polycat
BuildRequires: tar zstd
Requires: glibc
%description
A runcat module for polybar (or waybar) written in C++
%prep
mkdir ./polycat/
cd ./polycat/
tar --zstd -xf ${COMPILED_DIR:-/compiled}/polycat/polycat.tar.zst
%install
cd ./polycat/
mkdir -p %{buildroot}%{_bindir}
install -Dm755 ./polycat %{buildroot}%{_bindir}/polycat
mkdir -p %{buildroot}%{datadir}/fonts/polycat/
install -Dm644 ./polycat.ttf %{buildroot}%{_datadir}/fonts/polycat/polycat.ttf
mkdir -p %{buildroot}/usr/local/share/polycat/
install -Dm644 ./polycat-config %{buildroot}/usr/local/share/polycat/polycat-config
%files
%{_bindir}/polycat
%{_datadir}/fonts/polycat/polycat.ttf
/usr/local/share/polycat/polycat-config
%changelog
* Mon May 26 2025 askiiart <dev@askiiart.net>
- fix copy-paste error for polycat-config
* Mon May 26 2025 askiiart <dev@askiiart.net>
- Update to 2.0
* Thu Mar 6 2025 askiiart <dev@askiiart.net>
- Add zstd (previous changes were not listed here)

41
run.sh Executable file
View file

@ -0,0 +1,41 @@
#!/usr/bin/env bash
set -euo pipefail
built_dir=${COMPILED_DIR:-/compiled}/polycat
version=$(cat $built_dir/version)
repo_dir=${REPO_DIR:-/repo}
# skip if already up-to-date
# TODO: use the repo instead and check the version with dnf
# yeah this is bad; see also the polycat-aaaaaa thing below
touch $repo_dir/polycat-tmp
if $(ls $repo_dir/polycat-* | grep -q "$version"); then
rm $repo_dir/polycat-tmp
echo "package is already up to date, exiting"
exit
fi
rm $repo_dir/polycat-tmp
# prep
dnf install fedora-packager rpmdevtools createrepo_c -y
rpmdev-setuptree
# update spec file
sed -i "s/Version:.*/Version: $version/g" polycat.spec
# build package and move to the repo
rpmbuild -bb polycat.spec
mv ~/rpmbuild/RPMS/x86_64/polycat-$version-* $repo_dir/
# remove old versions
cd $repo_dir
# this is the easiest way to make sure it doesn't just fail because no polycat-* exists
# (which only happens on first run)
touch polycat-0.rpm
rm $(ls polycat-*.rpm | sort --version-sort | sed '$d')
rm polycat-0.rpm || true
# update repo
createrepo_c .
echo "package is at $(ls $repo_dir/polycat-*.rpm)"