# Contributor: André Klitzing <aklitzing@gmail.com>
# Maintainer: André Klitzing <aklitzing@gmail.com>
pkgname=geth
pkgver=1.15.5
pkgrel=2
pkgdesc="Official Go implementation of the Ethereum protocol"
url="https://geth.ethereum.org/"
arch="all !loongarch64"
license="LGPL-3.0-or-later"
makedepends="go linux-headers"
subpackages="$pkgname-tools"
checkdepends="fuse"
options="!check chmod-clean net"
source="$pkgname-$pkgver.tar.gz::https://github.com/ethereum/go-ethereum/archive/v$pkgver.tar.gz"
builddir="$srcdir/go-ethereum-$pkgver"

# secfixes:
#   1.10.22-r0:
#     - CVE-2022-37450

export GOROOT=/usr/lib/go
export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	make all
}

check() {
	make test
}

package() {
	install -Dm755 -t "$pkgdir"/usr/bin \
		build/bin/geth \
		build/bin/abigen \
		build/bin/clef \
		build/bin/evm \
		build/bin/rlpdump
}

tools() {
	pkgdesc="$pkgdesc (extra tools: abigen, clef, evm, rlpdump)"

	amove usr/bin/abigen
	amove usr/bin/clef
	amove usr/bin/evm
	amove usr/bin/rlpdump
}

sha512sums="
1a04846be9b89c6766f0b6eda1a7a56bd6029d2f043e63d0c2052b3de6c22776363db603283b44eadfe50445042694279686991d027025b69a2aaa618f9c3fed  geth-1.15.5.tar.gz
"
