summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3ab5274c4c5538d44bab5542be70a0d5001dd2ca (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
# Maintainer: robertfoster

_pkgname=fabric
pkgname=hyperledger-${_pkgname}
pkgver=1.1.0
pkgrel=2
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/tls
	cp -r sampleconfig/* $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=('3c9fcd96296a4f699f8f79fd96718b0f'
         'a0bafaaeb3be191ed2893662fe9a6fc7'
         '19a55d9a62f467235b51b2e4d7b3c523'
         'ac9701b648b4a9e0aea5d18268c06a30')