summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a26d3e8b31a34452d0867e8fffad005c3893015d (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
# Maintainer: Fabien LEFEBVRE <contact@d1ceward.com>

pkgname=hd-idle-go
_pkgname=hd-idle
pkgver=1.21
pkgrel=1
pkgdesc='Hard Disk Idle Spin-Down Utility - enhanced reimplementation of hd-idle'
arch=('x86_64'
      'armv7h'
      'aarch64')
url='https://github.com/adelolmo/hd-idle'
license=('GPL3')
install=hd-idle-go.install
backup=('etc/default/hd-idle'
        'etc/logrotate.d/hd-idle')
provides=('hd-idle')
conflicts=('hd-idle')
optdepends=('logrotate')
makedepends=('go')
source=("${url}/archive/refs/tags/v${pkgver}.tar.gz")

prepare(){
  cd "${_pkgname}-${pkgver}"

  mkdir -p build/
}

build() {
  cd "${_pkgname}-${pkgver}"

  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 build ./...
}

package() {
  cd "${_pkgname}-${pkgver}"

  install -Dm755 "build/${_pkgname}" "${pkgdir}/usr/bin/${_pkgname}"
  install -Dm644 "debian/hd-idle.8" "${pkgdir}/usr/share/man/man8/hd-idle.8"
  install -Dm644 "debian/hd-idle.default" "${pkgdir}/etc/default/hd-idle"
  install -Dm644 "debian/hd-idle.logrotate" "${pkgdir}/etc/logrotate.d/hd-idle"
  install -Dm644 "debian/hd-idle.service" "${pkgdir}/usr/lib/systemd/system/hd-idle.service"
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE"
}
sha256sums=('eb88022f52c1122de2f5ef1a87306644f96aebb9fdbcdc2fff21a0575ee6ed92')