aboutsummaryrefslogtreecommitdiff
path: root/packages/arch/PKGBUILD
blob: 550b8c7a1956149db53154b9f6645fdf52b6a253 (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
pkgname=shrt-git
pkgver=0.1
pkgrel=1
pkgdesc="A naively simple link shortener"
arch=('x86_64')
url="https://github.com/MetroWind/shrt"
license=('MIT')
groups=()
depends=('sqlite' 'curl' 'openssl')
makedepends=('git' 'cmake' 'gcc')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
replaces=()
backup=("etc/shrt.yaml")
# Stripping doesn’t work with ryml.
options=(!debug !strip)
install=shrt.install
source=('git+https://github.com/MetroWind/shrt.git' "sysusers-${pkgname%-git}.conf" "${pkgname%-git}.service" "${pkgname%-git}.yaml")
noextract=()
sha256sums=('SKIP' "1ea5c7d99be0954fb9aa6e22e7f11d485fd66d3232df3cbe3051c81e542b4bfc"
            "1e65ce88985b19471af84a95ebf8f2d6726e6af434cd4dafd7203ad783510a0f"
            "c91a4e0a43373e08343aba704cbd064936521decf23546a74d2d8b3f08a8e963")

pkgver()
{
	cd "$srcdir/${pkgname%-git}"
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
}

build()
{
	cd "$srcdir/${pkgname%-git}"
    # Usually CMAKE_BUILD_TYPE is set to be “None” in a PKGBUILD. But
    # it doesn’t work well with ryml.
    cmake -B build \
          -DCMAKE_BUILD_TYPE='Release' \
          -DCMAKE_INSTALL_PREFIX='/usr' \
          -Wno-dev .
    cmake --build build
}

package()
{
    install -Dm755 -t "$pkgdir/usr/bin" "${srcdir}/${pkgname%-git}/build/${pkgname%-git}"
    mkdir -pv "$pkgdir/var/lib/${pkgname%-git}/attachments"
    cp -r "${srcdir}/${pkgname%-git}/"{statics,templates} "${pkgdir}/var/lib/${pkgname%-git}"
    install -Dm644 -t "$pkgdir/etc" "${srcdir}/${pkgname%-git}.yaml"
    install -Dm644 "${srcdir}/sysusers-${pkgname%-git}.conf" "${pkgdir}/usr/lib/sysusers.d/${pkgname%-git}.conf"
    install -Dm644 "${srcdir}/${pkgname%-git}.service" "${pkgdir}/usr/lib/systemd/system/${pkgname%-git}.service"
}