summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 766819b0166aab39041b2b83db5118c3e04e7f69 (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: jkl
_srcname=duplicacy
_pkgname=duplicacy-ix
pkgname=$_pkgname-git
pkgver=v3.2.2.ix.r0.28efe91
pkgrel=1
pkgdesc="Cloud backup tool based on lock-free deduplication with Linux/POSIX enhancement (special file/hardlinks/flags)"
arch=('x86_64' 'i686')
url="https://duplicacy.com/"
license=('custom')
depends=('glibc')
makedepends=('go' 'git')
source=("git+https://github.com/jkl1337/duplicacy#branch=ix")
sha256sums=('SKIP')
provides=("$_srcname")
conflicts=("$_srcname" "$_srcname-git")

pkgver () {
  cd "$srcdir/$_srcname"
  printf "%s" "$(git describe --tags --long | sed 's/\([^-]*-\)g/r\1/;s/-/./g')"
}

prepare() {
  cd "$_srcname/$_srcname"

  mkdir -p "src/github.com/gilbertchen"
  ln -nsf "$srcdir/$_srcname" "src/github.com/gilbertchen/$_srcname"

  GO111MODULE=auto GOPATH="$srcdir/$_srcname/$_srcname" go get -d -v
}

build() {
  cd "$_srcname/$_srcname"
  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"

  GO111MODULE=auto GOPATH="$srcdir/$_srcname/$_srcname" go build -x -ldflags="-X main.GitCommit=$pkgver"
}

check() {
  cd "$_srcname/$_srcname"

  GO111MODULE=auto GOPATH="$srcdir/$_srcname/$_srcname" go test -v -x
}

package() {
  cd "$_srcname"

  install -Dm755 "$_srcname/$_srcname" "$pkgdir/usr/bin/$_srcname"
  install -Dm644 LICENSE.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE.md"
}