diff options
author | RubenKelevra | 2022-05-25 00:44:25 +0200 |
---|---|---|
committer | RubenKelevra | 2022-05-25 00:44:25 +0200 |
commit | a7774bdef91c4c80cce723e147904f22b6c17b17 (patch) | |
tree | 869f448798c1b055987d700ebd18b901807ab02a | |
parent | 4e131217e49e94617baea89c4535b6b4bc15d52d (diff) | |
download | aur-a7774bdef91c4c80cce723e147904f22b6c17b17.tar.gz |
tidy up
-rw-r--r-- | .SRCINFO | 11 | ||||
-rw-r--r-- | PKGBUILD | 117 |
2 files changed, 84 insertions, 44 deletions
@@ -1,21 +1,22 @@ pkgbase = git-remote-ipld-git pkgdesc = git IPLD remote helper - pkgver = 0.0.0.r0.g501d5f2ce - pkgrel = 1 + pkgver = 0.0.0.r0.g2f4756ae2 + pkgrel = 2 epoch = 1 url = https://github.com/ipfs-shipyard/git-remote-ipld arch = i686 arch = x86_64 arch = armv7h + arch = aarch64 license = MIT - makedepends = go>=2:1.14.4-1 + makedepends = go makedepends = git - makedepends = go-ipfs + depends = glibc depends = git + depends = go-ipfs provides = git-remote-ipld conflicts = git-remote-ipld source = git+https://github.com/ipfs-shipyard/git-remote-ipld.git b2sums = SKIP pkgname = git-remote-ipld-git - @@ -1,17 +1,21 @@ # Maintainer: @RubenKelevra # Contributor: Sameer Puri <purisame@spuri.io> +DEBUG=0 + _pkgname=git-remote-ipld pkgname=$_pkgname-git -pkgver=0.0.0.r0.g501d5f2ce -pkgrel=1 +pkgver=0.0.0.r0.g2f4756ae2 +pkgrel=2 epoch=1 pkgdesc='git IPLD remote helper' url="https://github.com/ipfs-shipyard/$_pkgname" -arch=('i686' 'x86_64' 'armv7h') -license=('MIT') -depends=('git') -makedepends=("go>=2:1.14.4-1" git 'go-ipfs') +arch=('i686' 'x86_64' 'armv7h' 'aarch64') +license=(MIT) + +depends=(glibc git go-ipfs) +makedepends=(go git) + provides=("$_pkgname") conflicts=("$_pkgname") source=("git+${url}.git") @@ -19,46 +23,81 @@ source=("git+${url}.git") b2sums=('SKIP') pkgver() { - cd "$srcdir/$_pkgname" - #VERSION=$(grep -E "^const CurrentVersionNumber = " version.go | awk '{ print $4 }' | sed 's/"//g') - VERSION=$(git tag | grep -vE "floodsub|sharding-pre" | grep -ve "-dev" | sed 's/-/~/g' | sort --version-sort --reverse | sed 's/~/-/g' | head -n1) - if [ -z "$VERSION" ]; then - VERSION="0.0.0" - COUNT=0 - else - COUNT=$(git rev-list "$VERSION.." --count) - fi - CHKSUM=$(git rev-list master | head -n1) - VERSION=$(echo "$VERSION" | sed 's/^v//' | sed 's/-//') - printf "%s.%s.%s" "$VERSION" "r$COUNT" "g${CHKSUM:0:9}" + cd "$srcdir/$_pkgname" + #VERSION=$(grep -E "^const CurrentVersionNumber = " version.go | awk '{ print $4 }' | sed 's/"//g') + VERSION=$(git tag | grep -vE "floodsub|sharding-pre" | grep -ve "-dev" | sed 's/-/~/g' | sort --version-sort --reverse | sed 's/~/-/g' | head -n1) + if [ -z "$VERSION" ]; then + VERSION="0.0.0" + COUNT=0 + else + COUNT=$(git rev-list "$VERSION.." --count) + fi + CHKSUM=$(git rev-list master | head -n1) + VERSION=$(echo "$VERSION" | sed 's/^v//' | sed 's/-//') + printf "%s.%s.%s" "$VERSION" "r$COUNT" "g${CHKSUM:0:9}" } prepare() { - cd "$srcdir/$_pkgname" - mkdir -p "${srcdir}/../go" - export GOPATH="${srcdir}/../go" - export PATH="$PATH:$GOPATH/bin" - # fix for broken version - chmod u+w -R "$GOPATH" - go get -d -v ./... + cd "$srcdir/.." + + mkdir -p "go" + export GOPATH="$(pwd)/go" + + # make sure GOPATH is set to writeable + chmod u+w -R "$GOPATH" + + cd "$srcdir/$_pkgname" + + export CGO_LDFLAGS="$LDFLAGS" + export CGO_CFLAGS="$CFLAGS" + export CGO_CPPFLAGS="$CPPFLAGS" + export CGO_CXXFLAGS="$CXXFLAGS" + export GOFLAGS="-buildmode=pie -modcacherw -trimpath" + + # dirty fix go1.18 + sed -i -r 's,^go 1\.[0-9]+,go 1.18,' go.mod + go mod tidy + go mod vendor } + build() { - cd "$srcdir/$_pkgname" - export GOPATH="${srcdir}/../go" - export PATH="$PATH:$GOPATH/bin" - export CGO_LDFLAGS="${LDFLAGS}" - export CGO_CFLAGS="${CFLAGS}" - export CGO_CPPFLAGS="${CPPFLAGS}" - export CGO_CXXFLAGS="${CXXFLAGS}" - make GOFLAGS="-buildmode=pie -trimpath -modcacherw" + cd "$srcdir/$_pkgname" + + export CGO_LDFLAGS="$LDFLAGS" + export CGO_CFLAGS="$CFLAGS" + export CGO_CPPFLAGS="$CPPFLAGS" + export CGO_CXXFLAGS="$CXXFLAGS" + export GOFLAGS="-buildmode=pie -trimpath -modcacherw" + if [ "$DEBUG" -eq 0 ]; then + export CGO_ENABLED=0 + # only run detection on x86_64 and if makepkg.conf contains no value + if [ "$CARCH" == "x86_64" ] && [ -z "$GOAMD64" ]; then + # detect cpu feature level + version_4="$(/lib/ld-linux-x86-64.so.2 --help | grep supported | grep x86-64-v4 | wc -l)" + version_3="$(/lib/ld-linux-x86-64.so.2 --help | grep supported | grep x86-64-v3 | wc -l)" + version_2="$(/lib/ld-linux-x86-64.so.2 --help | grep supported | grep x86-64-v2 | wc -l)" + + if [ "$version_4" -gt 0 ]; then + export GOAMD64="v4" + elif [ "$version_3" -gt 0 ]; then + export GOAMD64="v3" + elif [ "$version_2" -gt 0 ]; then + export GOAMD64="v2" + else + export GOAMD64="v1" + fi + fi + fi + + echo "using x86_64 optimization level: $GOAMD64" + + make } package() { - cd "$srcdir/$_pkgname" - install -Dm 755 cmd/$_pkgname/$_pkgname "${pkgdir}/usr/bin/git-remote-ipld" - install -Dm 644 -t "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE - install -Dm 644 -t "${pkgdir}/usr/share/doc/${pkgname}" README.md - # make sure the gopath is writeable - chmod u+w -R "$GOPATH" + cd "$srcdir/$_pkgname" + install -Dm 755 cmd/$_pkgname/$_pkgname "${pkgdir}/usr/bin/git-remote-ipld" + install -Dm 644 -t "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE + install -Dm 644 -t "${pkgdir}/usr/share/doc/${pkgname}" README.md } |