summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: bb0e1542a192d3789329d65f03fb0ae89eccc8b5 (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
# Maintainer: samarthj <dev@samarthj.com>

pkgname=skopeo-git
_pkgname=skopeo
pkgver=1.3.1_dev.r0.g2fee990a
pkgrel=1
pkgdesc="A command line utility for various operations on container images and image repositories (git)"
arch=('any')
depends=(containers-common)
makedepends=(btrfs-progs go go-md2man git systemd)
provides=("$_pkgname")
conflicts=("$_pkgname")
url="https://github.com/containers/$_pkgname.git"
license=(Apache)
options=('emptydirs')
source=("git+$url")
sha256sums=('SKIP')

pkgver() {
  cd "$srcdir/$_pkgname" || exit 1
  commit=$(git rev-parse --short HEAD)
  ver=$(grep const version/version.go | sed -re 's|.*"(.*)"$|\1|g')
  echo "${ver//-/_}.r0.g${commit}"
}

build() {
  export BUILDTAGS='seccomp apparmor'
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOFLAGS="-buildmode=pie -trimpath"

  cd $_pkgname || exit 1
  make EXTRA_LDFLAGS='-s -w -linkmode=external'
}

package() {
  depends+=('libdevmapper.so' 'libgpgme.so')

  cd $_pkgname || exit 1
  make install DESTDIR="$pkgdir" PREFIX="$pkgdir"/usr
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
  # remove man pages provided by containers-common
  rm -rvf "${pkgdir}/usr/share/man/man5"
  rm -rvf "${pkgdir}/etc"
}