summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 97b70ef9c20d0014352b31a55fb2ea36049f0fcf (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
# Maintainer: chris.imx <chris.imx.aur@online.de>

pkgname=findmydeviceserver
pkgver=0.8.0
pkgrel=1
pkgdesc='Official server for the android app FindMyDevice (FMD) written in Go'
arch=('x86_64' 'armv7h' 'aarch64')
url=https://gitlab.com/Nulide/findmydeviceserver
license=(GPL-3.0-or-later)
provides=("findmydeviceserver=${pkgver}")
depends=(
  glibc
)
makedepends=(
  npm
  git
  go
)
source=(git+https://gitlab.com/Nulide/findmydeviceserver.git#tag=v${pkgver}
	findmydeviceserver.service
	findmydeviceserver.sysusers
	findmydeviceserver.tmpfiles)
sha256sums=('88c6f4fc1e564b484d65b654760785b3f53ad8d94cba4ef7a85d87a14bafa24e'
            '97e417fc2f14e66aad74cfc4b357474e30006c357894bf459b1eca78e5fb6e1b'
            'd3f754171a12f8559de28b9c08699dd96f741abeb0f0e44dff9a912e9b381387'
            '73859307a7577701e3c711ce13da4b391179e2b43acff880e23ac01abc4bb8cb')
backup=(etc/fmdserver/config.yml)

build() {
  cd findmydeviceserver
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
  go build -o fmdserver
  cd web
  npm install
}

package() {
  # sysusers.d integration
  install -Dm644 findmydeviceserver.sysusers "$pkgdir/usr/lib/sysusers.d/findmydeviceserver.conf"
  # tmpfiles.d integration
  install -Dm644 findmydeviceserver.tmpfiles "$pkgdir/usr/lib/tmpfiles.d/findmydeviceserver.conf"

  install -Dm700 "${srcdir}/findmydeviceserver/config.example.yml" "$pkgdir/etc/fmdserver/config.yml"
  chmod 700 "$pkgdir/etc/fmdserver"
  install -Dm755 "${srcdir}/findmydeviceserver/fmdserver" "${pkgdir}/usr/bin/fmdserver"
  install -Dm644 "${srcdir}/findmydeviceserver.service" "${pkgdir}/usr/lib/systemd/system/findmydeviceserver.service"

  cd findmydeviceserver/web
  find . -type f -exec install -Dm 644 {} "$pkgdir/usr/share/webapps/fmdserver/"{} \;
}