summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c445c3ae380b0a7fa7071659d1865f10b4f105f0 (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: Benjamin Reich <aur@benjaminreich.de>
#Source found on github.com/b-reich/aur
pkgname=smap-git # '-bzr', '-git', '-hg' or '-svn'
pkgver=0.1.0.r2.08f4aee
pkgrel=1
pkgdesc="a drop-in replacement for Nmap powered by shodan.io "
arch=('x86_64')
url="https://github.com/s0md3v/smap"
license=('GPL3')
groups=()
depends=()
makedepends=('git' 'go')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
replaces=()
backup=()
options=()
install=
source=('git+https://github.com/s0md3v/smap')
noextract=()
md5sums=('SKIP')

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

prepare() {
  cd "$srcdir/${pkgname%-git}"
  mkdir -p build
}

build() {
  cd "$srcdir/${pkgname%-git}"
  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 ./cmd/...
}

package() {
  cd "$srcdir/${pkgname%-git}"
  install -Dm755 build/${pkgname%-git} "$pkgdir"/usr/bin/${pkgname%-git}
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/${pkgname%-git}/LICENSE"
}