summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b13e6f51de9364b71896782509a2c22beffa3515 (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
55
56
57
58
59
60
61
62
63
64
65
# Maintainer: robertfoster

_pkgname=fabric
pkgname=hyperledger-${_pkgname}
pkgver=1.4.0
pkgrel=1
pkgdesc="A platform for distributed ledger solutions, underpinned by a modular architecture delivering high degrees of confidentiality, resiliency, flexibility and scalability"
arch=(armv6h armv7h arm aarch64 i686 x86_64)
url="https://github.com/hyperledger/fabric"
license=('APACHE')
groups=('hyperledger')
depends=('go')
makedepends=('git' 'docker')
install=$pkgname.install
source=("https://github.com/hyperledger/fabric/archive/v$pkgver.tar.gz"
	${_pkgname}-peer.conf
	${_pkgname}-peer.service
arm-support.patch)

export GOOS=linux
case "$CARCH" in
	x86_64) export GOARCH=amd64 ;;
	i686) export GOARCH=386 GO386=387 ;;
	arm) export GOARCH=arm GOARM=5 ;;
	armv6h) export GOARCH=arm GOARM=6 ;;
	armv7h) export GOARCH=arm GOARM=7 ;;
	aarch64) export GOARCH=arm64 ;;
esac

prepare() {
	cd $srcdir/${_pkgname}-$pkgver
	patch -Np1 -i ../arm-support.patch
	cd ..
	export GOPATH="$PWD"/.gopath
	mkdir -p "$GOPATH"/src/github.com/hyperledger
	ln -sf "$PWD"/fabric-$pkgver "$GOPATH"/src/github.com/hyperledger/fabric
}

build() {
	export GOPATH="$PWD"/.gopath
	cd "$GOPATH"/src/github.com/hyperledger/fabric
	make release/linux-$GOARCH
}

package() {
	cd $srcdir/${_pkgname}-$pkgver
	install -Dm 644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
	install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" README.md

	cp -r release/linux-$GOARCH/bin "$pkgdir/usr"
	install -dm 755 $pkgdir/etc/hyperledger/fabric/msp
	install -dm 755 $pkgdir/etc/hyperledger/fabric/tls
	cp -r sampleconfig/*.yaml $pkgdir/etc/hyperledger/fabric

	msg2 "Install systemd service"
	install -Dm644 $srcdir/${_pkgname}-peer.service $pkgdir/usr/lib/systemd/system/${_pkgname}-peer.service

	msg2 "Install conf file"
	install -Dm644 $srcdir/${_pkgname}-peer.conf $pkgdir/usr/lib/environment.d/${_pkgname}-peer.conf
}

md5sums=('b67bfa59e3c4bc33e1cad578db19fd46'
	'a0bafaaeb3be191ed2893662fe9a6fc7'
	'19a55d9a62f467235b51b2e4d7b3c523'
'cb61f0911c6bb15b8f1fdc5ab1802c38')