summaryrefslogtreecommitdiff
path: root/arch/PKGBUILD
blob: c16df3d4c179eaf83c9982f4059fbfc1fffd1b87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Maintainer: Dawid Rycerz <dawid@craftknight.com>
pkgname=witryna
pkgver=0.2.0
pkgrel=1
pkgdesc='Minimalist Git-based static site deployment orchestrator'
url='https://git.craftknight.com/dawid/witryna'
license=('MIT')
arch=('x86_64')
makedepends=('cargo' 'git')
depends=('gcc-libs' 'glibc' 'git' 'git-lfs')
optdepends=('podman: container runtime for builds (recommended)'
            'docker: alternative container runtime')
backup=('etc/witryna/witryna.toml')
install=witryna.install
_tag=v0.2.0
source=("$pkgname::git+https://git.craftknight.com/dawid/witryna.git#tag=$_tag"
        'witryna.sysusers'
        'witryna.tmpfiles'
        'witryna.install')
b2sums=('SKIP' 'SKIP' 'SKIP' 'SKIP')

prepare() {
    cd "$pkgname"
    export RUSTUP_TOOLCHAIN=stable
    cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
    cd "$pkgname"
    export RUSTUP_TOOLCHAIN=stable
    export CARGO_TARGET_DIR=target
    cargo build --frozen --release
}

check() {
    cd "$pkgname"
    export RUSTUP_TOOLCHAIN=stable
    export CARGO_TARGET_DIR=target
    cargo test --frozen
}

package() {
    cd "$pkgname"

    # Binary
    install -Dm0755 target/release/witryna "$pkgdir/usr/bin/witryna"

    # Man pages
    install -Dm0644 man/witryna.1 "$pkgdir/usr/share/man/man1/witryna.1"
    install -Dm0644 man/witryna.toml.5 "$pkgdir/usr/share/man/man5/witryna.toml.5"

    # Config
    install -Dm0644 examples/witryna.toml "$pkgdir/etc/witryna/witryna.toml"

    # Systemd
    install -Dm0644 debian/witryna.service "$pkgdir/usr/lib/systemd/system/witryna.service"
    install -Dm0644 "$srcdir/witryna.sysusers" "$pkgdir/usr/lib/sysusers.d/witryna.conf"
    install -Dm0644 "$srcdir/witryna.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/witryna.conf"

    # License
    install -Dm0644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

    # Examples / documentation
    install -Dm0755 examples/hooks/caddy-deploy.sh "$pkgdir/usr/share/doc/$pkgname/examples/hooks/caddy-deploy.sh"
    install -Dm0644 examples/caddy/Caddyfile "$pkgdir/usr/share/doc/$pkgname/examples/caddy/Caddyfile"
    install -Dm0644 examples/nginx/witryna.conf "$pkgdir/usr/share/doc/$pkgname/examples/nginx/witryna.conf"
    install -Dm0644 examples/witryna.yaml "$pkgdir/usr/share/doc/$pkgname/examples/witryna.yaml"
    install -Dm0644 examples/systemd/docker.conf "$pkgdir/usr/share/doc/$pkgname/examples/systemd/docker.conf"
    install -Dm0644 examples/systemd/podman.conf "$pkgdir/usr/share/doc/$pkgname/examples/systemd/podman.conf"
}