implement most of packaging

This commit is contained in:
xenia 2021-01-10 04:47:05 -05:00
parent 5c542dcf2c
commit c24402ad61
3 changed files with 71 additions and 2 deletions

View File

@ -53,7 +53,7 @@ VND_MONOCYPHER_CFLAGS=-I$(MONOCYPHER_DIR)/src
VND_MONOCYPHER_LDFLAGS=-L$(MONOCYPHER_DIR)/lib -lmonocypher VND_MONOCYPHER_LDFLAGS=-L$(MONOCYPHER_DIR)/lib -lmonocypher
$(VND_MONOCYPHER): $(MONOCYPHER_DIR)/.extracted $(VND_MONOCYPHER): $(MONOCYPHER_DIR)/.extracted
cd $(MONOCYPHER_DIR) && $(MAKE) USE_ED22519=true static-library cd $(MONOCYPHER_DIR) && $(MAKE) USE_ED22519=true library
$(MONOCYPHER_DIR)/.extracted: $(MONOCYPHER_FILE) $(MONOCYPHER_DIR)/.extracted: $(MONOCYPHER_FILE)
$(call extract-file,$(MONOCYPHER_DIR)) $(call extract-file,$(MONOCYPHER_DIR))

View File

@ -37,7 +37,7 @@
;; XXX : platform-specific ;; XXX : platform-specific
(define *config-root* (if *production?* "/etc/" "etc/")) (define *config-root* (if *production?* "/etc/" "etc/"))
(define *state-root* (if *production?* "/var/lib/crossfire/" "lib/")) (define *state-root* (if *production?* "/var/lib/crossfire/" "lib/"))
(define *lib-root* (if *production?* "/usr/lib/" "lib/")) (define *lib-root* (if *production?* "/usr/lib/crossfire/" "lib/"))
(define (get-binary-path-for-arch arch) (define (get-binary-path-for-arch arch)
(build-path *lib-root* (string-append "arch_" arch) "crossfire-agent")) (build-path *lib-root* (string-append "arch_" arch) "crossfire-agent"))

69
dist/PKGBUILD vendored Normal file
View File

@ -0,0 +1,69 @@
# 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=('any')
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"
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 -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
# 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
echo todo
return -1
}