summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6be8c120bd6441d750c0ef7b079061c629d531c6 (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
# Maintainer: FLX (Paul Werther) <flx@evait.de>
pkgname=pdtm-git
_pkgname=pdtm
pkgver=0.0.3.r0.gef9c86b
pkgrel=1
pkgdesc='pdtm is a simple and easy-to-use golang based tool for managing open source projects from ProjectDiscovery'
arch=('x86_64' 'armv6h' 'armv7h' 'aarch64')
url='https://github.com/projectdiscovery/pdtm'
license=('MIT')
makedepends=('go' 'git')
provides=("${_pkgname}")
conflicts=("${_pkgname}")
depends=('glibc')
source=("${_pkgname}::git+https://github.com/projectdiscovery/${_pkgname}.git")
sha256sums=('SKIP')

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

prepare() {
  export GOPATH="${srcdir}/gopath"
  go clean -modcache
}

build() {
  cd "${srcdir}/${_pkgname}/cmd/${_pkgname}"
  export GOPATH="${srcdir}/gopath"
  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"
  mkdir -p ../build
  go build -o ../build -v ./...

  go clean -modcache
}

package() {
  cd "${srcdir}/${_pkgname}"
  install -Dvm755 "cmd/build/${_pkgname}" -t "${pkgdir}/usr/bin/"
  install -Dvm644 'README.md' -t "${pkgdir}/usr/share/doc/${_pkgname}"
}