crossfire/dist/PKGBUILD

75 lines
3.1 KiB
Bash

# Maintainer: haskal <haskal@awoo.systems>
pkgname=crossfire
# from crossfire/info.rkt
pkgver=0.1
pkgrel=1
# from crossfire/info.rkt
pkgdesc="distributed brute force infrastructure"
arch=('x86_64' 'i686' 'armv7h' 'aarch64')
url="https://git.lain.faith/haskal/crossfire"
license=('GPL3')
depends=('sqlite' 'glibc')
makedepends=('gcc' 'make' 'gsfonts')
# from agent-deployment makefiles
_pkgver_emb_monocypher=3.1.1
_pkgver_emb_racket=7.9
_source_emb_monocypher="https://monocypher.org/download/monocypher-$_pkgver_emb_monocypher.tar.gz"
_source_emb_racket="https://mirror.racket-lang.org/installers/$_pkgver_emb_racket/racket-minimal-$_pkgver_emb_racket-src.tgz"
backup=("etc/crossfire.rktd")
source=(
"git+https://git.lain.faith/haskal/crossfire.git"
"monocypher.tar.gz::$_source_emb_monocypher"
"racket.tar.gz::$_source_emb_racket"
)
noextract=("monocypher.tar.gz" "racket.tar.gz")
sha256sums=(SKIP SKIP SKIP)
prepare() {
cd "$srcdir"
_cachedir=crossfire/agent-deployment/cache
[ ! -d $_cachedir ] && mkdir $_cachedir
ln -sf $(readlink -e monocypher.tar.gz) $_cachedir/monocypher.tar.gz
ln -sf $(readlink -e racket.tar.gz) $_cachedir/racket.tar.gz
}
build() {
cd "$srcdir/crossfire/agent-deployment"
# make agent binary
make
# install crossfire into local installation
_arch="$(gcc -dumpmachine)"
_raco="$srcdir/crossfire/agent-deployment/arch_$_arch/vendor/racket-$_pkgver_emb_racket/bin/raco"
"$_raco" pkg install --skip-installed --auto "$srcdir/crossfire/crossfire"
"$_raco" exe ++lang north -o "$srcdir/crossfire/crossfire-server" "$srcdir/crossfire/crossfire/server.rkt"
"$_raco" exe -o "$srcdir/crossfire/crossfire-client" "$srcdir/crossfire/crossfire/client.rkt"
}
package() {
# install crossfire core and dependencies
install -d "$pkgdir/usr/lib/crossfire"
install -d "$pkgdir/usr/bin"
_arch="$(gcc -dumpmachine)"
_raco="$srcdir/crossfire/agent-deployment/arch_$_arch/vendor/racket-$_pkgver_emb_racket/bin/raco"
"$_raco" dist "$pkgdir/usr/lib/crossfire/" "$srcdir/crossfire/crossfire-server" "$srcdir/crossfire/crossfire-client"
for binary in crossfire-server crossfire-client; do
ln -s /usr/lib/crossfire/bin/$binary "$pkgdir/usr/bin/$binary"
done
## monocypher
install -Dm644 "$(readlink -e "$srcdir/crossfire/agent-deployment/arch_$_arch/vendor/monocypher-$_pkgver_emb_monocypher/lib/libmonocypher.so")" "$pkgdir/usr/lib/crossfire/lib/plt/crossfire-server/lib/libmonocypher.so"
# install agent binaries
cd "$srcdir/crossfire/agent-deployment" && for agent in arch_*/crossfire-agent; do \
install -Dm644 $agent "$pkgdir/usr/lib/crossfire/$agent"
done
# install configuration
install -Dm644 "$srcdir/crossfire/etc/crossfire.rktd" "$pkgdir/etc/crossfire.rktd"
# install tmpfiles and sysusers for systemd
# install server systemd service
install -Dm644 "$srcdir/crossfire/dist/sysusers.conf" "$pkgdir/usr/lib/sysusers.d/crossfire.conf"
install -Dm644 "$srcdir/crossfire/dist/tmpfiles.conf" "$pkgdir/usr/lib/tmpfiles.d/crossfire.conf"
install -Dm644 "$srcdir/crossfire/dist/crossfire.service" "$pkgdir/usr/lib/systemd/system/crossfire.service"
}