summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: de8f5b9be56993d1e292f5c52e7d54a7bc6fc3a7 (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
66
# Maintainer: Gergely Imreh <imrehg@gmail.com>
# This package is heavily inspired by go-ipfs-git, wich has the following contributors:
# Contributor: Jakub "Kubuxu" Sztandera <kubuxu@protonmail.ch>
# Contributor: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
# Contributor: kpcyrd <git@rxv.cc>
# Contributor: Ian Naval <ianonavy@gmail.com>

_pkgname=go-filecoin
pkgname=$_pkgname-git
pkgver=nightly_17481_fc53b4_0_gfc53b48c
pkgrel=1
pkgdesc='A decentralized storage network, full node implementation in Go'
_organization='filecoin-project'
url="https://github.com/$_organization/$_pkgname"
arch=('x86_64')
license=('MIT' 'Apache-2.0')
makedepends=('git' 'go>=1.11.2' 'pkgconf' 'clang' 'jq')
optdepends=('rustup: compiling proofs from scratch')
provides=("$_pkgname")
conflicts=("$_pkgname")
source=("git+${url}.git")

sha512sums=('SKIP')

pkgver() {
  cd "${srcdir}/${_pkgname}"
  git describe --long --tags | sed -e 's/-/_/g'
}

prepare() {
  # Get all the submodules as well
  cd "${srcdir}/${_pkgname}"

  # Set up go build environment
  local targetorg="${srcdir}/src/github.com/${_organization}"
  local targetrepo="${targetorg}/${_pkgname}"
  mkdir -p "${targetorg}"
  if [ ! -e "${targetrepo}" ]; then
    ln -sf "${srcdir}/${_pkgname}" "${targetrepo}"
  fi
}

build() {
  # Required for go get
  export GOPATH="$srcdir"
  export GOBIN="$srcdir/bin"
  export PATH=$PATH:$GOPATH/bin

  msg2 'Installing dependencies...'
  cd "$GOPATH/src/github.com/${_organization}/${_pkgname}"
  if ! command -v rustup > /dev/null; then
    echo "No rustup, will be using precompiled rust proofs and bls signatures."
    export FILECOIN_USE_PRECOMPILED_BLS_SIGNATURES=yes
    export FILECOIN_USE_PRECOMPILED_RUST_PROOFS=yes
  fi
  make deps

  msg2 'Building binary...'
  make all
}

package() {
  cd "${srcdir}/src/github.com/${_organization}/${_pkgname}"

  install -Dm 755 go-filecoin "${pkgdir}/usr/bin/go-filecoin"
}