summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 95b6157911cf91700f6dba78a7d41f99db212245 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Maintainer: Moses Narrow <moe_narrow@use.startmail.com>
# Maintainer: Rudi [KittyCash] <rudi@skycoinmail.com>
_projectname=skycoin
pkgname=skycoin-explorer
_pkgname=${pkgname}
_githuborg=${_projectname}
pkgdesc="Skycoin Blockchain Explorer: https://explorer.skycoin.com/"
pkgver='autogenerated'
#pkgver='autogenerated'
pkgrel=4
#pkgrel=4
_pkggopath="github.com/${_githuborg}/${_pkgname}"
arch=('any')
url="https://${_pkggopath}"
license=()
makedepends=(git go skycoin-keyring) # npm node-gyp angular-cli
source=("git+${url}.git#branch=${BRANCH:-master}")
sha256sums=('SKIP')
validpgpkeys=('DE08F924EEE93832DABC642CA8DC761B1C0C0CFC')  # Moses Narrow <moe_narrow@use.startmail.com>
#                           '98F934F04F9334B81DFA3398913BBD5206B19620') #iketheadore skycoin <luxairlake@protonmail.com>

export GOOS=linux
export CGO_ENABLED=0

case "$CARCH" in
  x86)      export GOARCH="386" GO386="387" ;;
  x86_64)   export GOARCH="amd64" ;;
  arm*)     export GOARCH="arm" ;;
  armel)    export GOARCH="arm" GOARM="5" ;;
  armhf)    export GOARCH="arm" GOARM="6" ;;
  armv7)    export GOARCH="arm" GOARM="7" ;;
  armv8)    export GOARCH="arm64" ;;
  aarch64)  export GOARCH="arm64" ;;
  mips)     export GOARCH="mips" ;;
  mips64)   export GOARCH="mips64" ;;
  mips64el) export GOARCH="mips64le" ;;
  mipsel)   export GOARCH="mipsle" ;;
  *)        return 1 ;;
esac

prepare() {
  #verify PKGBUILD signature
  gpg --verify ../PKGBUILD.sig ../PKGBUILD
}

pkgver() {
  cd "${srcdir}/${_pkgname}"
  local date=$(git log -1 --format="%cd" --date=short | sed s/-//g)
  local count=$(git rev-list --count HEAD)
  local commit=$(git rev-parse --short HEAD)
  echo "${date}.${count}_${commit}"
}


build () {
#  msg2 'installing go dependencies'
  export GOPATH="${srcdir}"/go
  export GOBIN=${GOPATH}/bin

  mkdir -p ${srcdir}/go/src/${_pkggopath//${_pkgname}/} ${srcdir}/go/bin

  ln -rTsf ${srcdir}/${_pkgname} ${srcdir}/go/src/${_pkggopath}
  cd ${srcdir}/go/src/${_pkggopath}/
  #git checkout develop
  #git submodule --quiet update --init --recursive
  #rm -rf Gopkg.toml
  #rm -rf Gopkg.lock
  go install \
  -gcflags "all=-trimpath=${GOPATH}" \
  -asmflags "all=-trimpath=${GOPATH}" \
  -ldflags "-extldflags ${LDFLAGS}" \
  -v ./...
  #build the UI
  #npm install
  #npm audit fix
  #npm install --save-dev @angular-devkit/build-angular
  #make build-ng
 #npm install
 #npm run build


#  cd ${srcdir}/go
#  echo -e '[Unit]
# Description=Skycoin Node service
# After=network.target
# After=network-online.target

# [Service]
# Type=oneshot
# ExecStart=/usr/bin/skycoin-explorer-nohup
# RemainAfterExit=yes
# ExecStop=/usr/bin/skycoin-halt
# TryExec=/usr/bin/skycoin

# [Install]
# WantedBy=multi-user.target ' > ${pkgname}.service
}


package() {
#  options=(!strip staticlibs)
  #create directory trees
  mkdir -p ${pkgdir}/usr/bin
  mkdir -p ${pkgdir}/opt/${_pkgname}/bin
  #mkdir -p ${pkgdir}/usr/lib/${projectname}/${pkgname}/
  #install binaries & symlink to /usr/bin
  msg2 'installing binaries'
  _skybins="${srcdir}"/go/bin
  _potentialnameconflicts=$( ls --ignore=skycoin* "$_skybins")
  cd ${_skybins}
  for i in ${_potentialnameconflicts}; do
    mv ${_skybins}/${i} ${_skybins}/skycoin-${i}
  done
  #create the launcher script
#  echo -e '#!/bin/bash
#launch skycoin explorer more easily
#export GOBIN=/usr/lib/skycoin/go/bin
#export GOPATH=/usr/lib/skycoin/go
#export GOBIN=$GOPATH/bin
#nohup skycoin -gui-dir=/usr/lib/skycoin/skycoin/src/gui/static/ -launch-browser=true -enable-all-api-sets=true -enable-gui=true -rpc-interface=false -log-level=debug > /dev/null 2>&1 &cd /usr/lib/skycoin/skycoin-explorer \n echo "Please enter the port that skycoin wallet is running on:" \n read port \n SKYCOIN_ADDR=http://127.0.0.1:$port skycoin-explorer' > ${pkgname}-launch
#  chmod +x ${pkgname}-launch
#  echo -e '#!/bin/bash
#launch skycoin explorer more easily
#export GOBIN=/usr/lib/skycoin/go/bin
#export GOPATH=/usr/lib/skycoin/go
#export GOBIN=$GOPATH/bin
#nohup skycoin -gui-dir=/usr/lib/skycoin/skycoin/src/gui/static/ -launch-browser=true -enable-all-api-sets=true -enable-gui=true -rpc-interface=false -log-level=debug > /dev/null 2>&1 &cd /usr/lib/skycoin/skycoin-explorer \n  SKYCOIN_ADDR=http://127.0.0.1:6420 nohup skycoin-explorer > /dev/null 2>&1 &cd' > ${pkgname}-nohup
#  chmod +x ${pkgname}-nohup
  _skycoinbins=$( ls "$_skybins")
  for i in ${_skycoinbins}; do
    install -Dm755 ${srcdir}/go/bin/${i} ${pkgdir}/opt/${_pkgname}/go/bin/${i}
    ln -rTsf ${pkgdir}/opt/${_pkgname}/bin/${i} ${pkgdir}/usr/bin/${i}
    chmod 755 ${pkgdir}/usr/bin/${i}
  done
#  rm -rf ${srcdir}/${pkgname}/.git
#  cp -r ${srcdir}/${pkgname}/ ${pkgdir}/usr/lib/${projectname}/
#  install -Dm644 ${srcdir}/go/${pkgname}.service ${pkgdir}/usr/lib/systemd/system/${pkgname}.service

}