yochananmarqos

ipinfo-cli

Nov 9th, 2021 (edited)
795
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.29 KB | None | 0 0
  1. pkgname=ipinfo-cli
  2. _pkgname=${pkgname%-cli}
  3. pkgver=2.3.1
  4. pkgrel=1
  5. pkgdesc="Official Command Line Interface for the IPinfo API (IP geolocation and other types of IP data)"
  6. arch=('x86_64' 'i686' 'armv7h' 'aarch64')
  7. url="https://ipinfo.io"
  8. license=('Apache')
  9. depends=('glibc')
  10. makedepends=('go')
  11. source=("$pkgname-$pkgver.tar.gz::https://github.com/ipinfo/cli/archive/$_pkgname-$pkgver.tar.gz")
  12. sha256sums=('93dff2e5fa52d567f5e929c8e6273216e85ee508b484826ebee46357f711ebf0')
  13.  
  14. prepare(){
  15.   cd "cli-$_pkgname-$pkgver"
  16.  
  17.   # Prevent creation of a `go` directory in one's home.
  18.   # Sometimes this directory cannot be removed with even `rm -rf` unless
  19.   # one becomes root or changes the write permissions.
  20.   export GOPATH="$srcdir/gopath"
  21.   go clean -modcache
  22.  
  23.   mkdir -p build/
  24. }
  25.  
  26. build() {
  27.   cd "cli-$_pkgname-$pkgver"
  28.   export GOPATH="$srcdir/gopath"
  29.   export CGO_CPPFLAGS="${CPPFLAGS}"
  30.   export CGO_CFLAGS="${CFLAGS}"
  31.   export CGO_CXXFLAGS="${CXXFLAGS}"
  32.   export CGO_LDFLAGS="${LDFLAGS}"
  33.   export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
  34.   go build -v -o build "./$_pkgname"
  35.  
  36.   # Clean mod cache for makepkg -C
  37.   go clean -modcache
  38. }
  39.  
  40. package() {
  41.   cd "cli-$_pkgname-$pkgver"
  42.   install -Dm755 "build/$_pkgname" -t "$pkgdir/usr/bin/"
  43. }
Add Comment
Please, Sign In to add comment