diff options
author | a821 | 2022-03-18 20:38:13 +0100 |
---|---|---|
committer | a821 | 2022-03-18 20:38:13 +0100 |
commit | e1c7b71d0a307f23b44c4c6d8115abe0b7ee55f3 (patch) | |
tree | 97430e782c6c5976db65d923efc6c43a748e5f60 /PKGBUILD | |
parent | cd7ad66fc741fd09a6ab673bd990e9b2a14ccc93 (diff) | |
download | aur-go-symbols-git.tar.gz |
Modernize PKGBUILD to the GO guidelines
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 62 |
1 files changed, 26 insertions, 36 deletions
@@ -1,49 +1,39 @@ pkgname=go-symbols-git -pkgver=20151212.3_b75dfef +pkgver=r3.b75dfef pkgrel=1 +epoch=1 pkgdesc="A utility for extracting a JSON representation of the package symbols from a go source tree." arch=('i686' 'x86_64') -license=('GPL') -depends=( -) -makedepends=( - 'go' - 'git' -) - -source=( - "git://github.com/newhook/go-symbols.git" -) - -md5sums=( - 'SKIP' -) - -backup=( -) - -conflicts=( -) +url="https://github.com/newhook/go-symbols" +license=('MIT') +depends=('glibc') +makedepends=('go' 'git') +source=("git+${url}") +md5sums=('SKIP') pkgver() { - cd "$srcdir/go-symbols" - local date=$(git log -1 --format="%cd" --date=short | sed s/-//g) - local count=$(git rev-list --count HEAD) - local commit=$(git rev-parse --short HEAD) - echo "$date.${count}_$commit" + cd ${pkgname%-git} + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" +} + +prepare() { + cd ${pkgname%-git} + go mod init "${url#https://}" + go mod tidy } build() { - GOPATH=$srcdir - GOBIN=$srcdir/bin/ - mkdir -p $srcdir/src - ln -sf $srcdir/go-symbols $srcdir/src - cd $srcdir/src/go-symbols - go get -v + cd ${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/ } package() { - find "$srcdir/bin/" -type f -executable | while read filename; do - install -DT "$filename" "$pkgdir/usr/bin/$(basename $filename)" - done + cd ${pkgname%-git} + install -Dm755 -t "$pkgdir/usr/bin" build/go-symbols + install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" } |