Jobboerse/dist/arch/devel/PKGBUILD
Skgland 11fda40e3b
move root package to packages/jobboerse
for more consistency and also fix docker builds

more descriptive startup errors
2022-10-08 20:26:24 +02:00

102 lines
2.5 KiB
Bash

# Maintainer: Bennet Bleßmann <ben@fs-infmath.uni-kiel.de>
# Based on the PKGBUILD for FS-Protokoll-git by: Einhard Leichtfuß <alguien@respiranto.de>
# shellcheck disable=SC2034 # unused variables pkgname, pkgver etc.
export GIT_CONFIG_GLOBAL=/dev/null
_reponame=Jobboerse
_pkgname="${_reponame,,}"
_features=('dev_mode')
pkgname=${_pkgname}-git
pkgver=0.1.0.r0.g69a372b
pkgrel=1
pkgdesc="FS-InfMath Job-Offer Page"
arch=('x86_64') # Other architectures may work
url="https://www.fs-infmath.uni-kiel.de/git/FS-InfMath/${_reponame}"
license=('Apache') # Or MIT (see Cargo.toml).
depends=()
makedepends=('git' 'git-lfs' 'cargo')
checkdepends=('cargo')
provides=("$_pkgname")
conflicts=("$_pkgname")
backup=("etc/${_pkgname}/config.toml")
source=("git+${url}.git")
sha512sums=('SKIP')
pkgver()
{
cd "$_reponame"
git describe --long --tags \
| sed -E 's/^version-//; s/([^-]*-g)/r\1/; s/-/./g'
}
prepare()
{
cd "$_reponame"
# Download git-lfs files
git remote | grep -q lfs-remote || git remote add lfs-remote "${url}.git"
git lfs install --local
git lfs pull lfs-remote
cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}
_oldIFS="${IFS}"
IFS=","
_feature_list="${_features[*]}"
IFS="${_oldIFS}"
build()
{
cd "$_reponame"
export RUSTUP_TOOLCHAIN=stable
export CARGO_TARGET_DIR=target
cargo build --frozen --release ${_features[@]:+--features} ${_features[@]:+"$_feature_list"}
}
check()
{
cd "$_reponame"
export RUSTUP_TOOLCHAIN=stable
# we only have limited diskspace of 2GB for build and check files on /tmp on metabo
# without --release here we exceed that, this also means we want a different target dir to not override the
# release profile binary with a bench profile binary
# see <https://wiki.archlinux.org/title/Rust_package_guidelines> for reference
export CARGO_TARGET_DIR=target-check
cargo test --release --frozen ${_features[@]:+--features} ${_features[@]:+"$_feature_list"}
}
package()
{
cd "$_reponame"
# shellcheck disable=SC2154 # use of unassigned variable pkgdir
install -Dm0755 \
"target/release/${_pkgname}" \
"${pkgdir}/usr/bin/${_pkgname}"
install -dm0755 "${pkgdir}/usr/lib/${_pkgname}/"
cp -r "packages/jobboerse/static/" "packages/jobboerse/templates/" "${pkgdir}/usr/lib/${_pkgname}/"
install -Dm0644 -t "${pkgdir}/usr/share/doc/${_pkgname}" \
README.md \
Changelog.md
install -Dm0644 \
"packages/jobboerse/config/dist-config.toml" \
"${pkgdir}/etc/${_pkgname}/config.toml"
install -Dm0644 \
"jobboerse.service" \
"${pkgdir}/usr/lib/systemd/system/jobboerse.service"
}