summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ea4a8b4a70ea7bddca66f45e1bdc130de9c08033 (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: Stefen Wakefield <me@xstefen.dev>

_pkgname="xmap"
pkgname="$_pkgname-git"
pkgver=2.0.2.r0.g86ae0fe
pkgrel=1
pkgdesc="Fast Internet-wide IPv6 & IPv4 network scanner"
url="https://github.com/idealeer/xmap"
license=('Apache-2.0')
arch=('x86_64')

depends=('gmp' 'libpcap' 'json-c' 'libunistring')
makedepends=('byacc' 'cmake' 'flex' 'gengetopt' 'git' 'ninja')

provides=("$_pkgname=${pkgver%%.r*}")
conflicts=("$_pkgname")

_pkgsrc="$_pkgname"
source=("git+https://github.com/idealeer/xmap.git")
sha256sums=('SKIP')

pkgver() {
  cd "$_pkgsrc"
  git describe --long --tags --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  sed -E 's|DESTINATION sbin|DESTINATION bin|' -i "$_pkgsrc/src/CMakeLists.txt"
  sed '/set(XMAP_VERSION DEVELOPMENT)/d' -i "$_pkgsrc/CMakeLists.txt"
}

build() {
  export CFLAGS
  CFLAGS="${CFLAGS/_FORTIFY_SOURCE=?/_FORTIFY_SOURCE=2}"

  local _cmake_options=(
    -B build
    -S "$_pkgsrc"
    -G Ninja
    -DCMAKE_BUILD_TYPE=None
    -DCMAKE_INSTALL_PREFIX='/usr'
    -DENABLE_DEVELOPMENT=OFF
    -DENABLE_LOG_TRACE=OFF
    -DXMAP_VERSION="AUR $pkgver"
    -Wno-dev
  )
  cmake "${_cmake_options[@]}"
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
  install -Dm644 "$_pkgsrc/LICENSE" -t "$pkgdir/usr/share/licenses/$pkgname/"
}