summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d153ef551ff9caddbe3493462914750c293c44e2 (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
# Maintainer: Dimitris Kiziridis <ragouel at outlook dot com>

pkgname=cloudforest-git
pkgver=r430.d014dc3
pkgrel=1
pkgdesc="Fast, flexible, multi-threaded ensembles of decision trees for machine learning in pure Go"
arch=('x86_64')
url='https://github.com/ryanbressler/CloudForest'
license=('custom')
conflicts=('cloudforest' 'cloudforest-bin')
provides=('leafcount'
          'growforest'
          'applyforest'
          'nfold'
          'toafm')
makedepends=('git' 'go')
source=("git+${url}")
md5sums=('SKIP')

pkgver() {
  cd "${srcdir}/CloudForest"
   ( set -o pipefail
    git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
  ) 
}

prepare() {
  cd "${srcdir}/CloudForest"
  mkdir -p $srcdir/go
  export GOPATH="${srcdir}"/go
  export PATH=$PATH:$GOPATH/bin
  go get -d -v ./...
}

build() {
  export GOPATH="${srcdir}"/go
  export PATH=$PATH:$GOPATH/bin
  cd "${srcdir}/CloudForest/leafcount"
  go build -v -o ${srcdir}/leafcount
  cd "${srcdir}/CloudForest/growforest"
  go build -v -o ${srcdir}/growforest
  cd "${srcdir}/CloudForest/applyforest"
  go build -v -o ${srcdir}/applyforest
  cd "${srcdir}/CloudForest/utils/nfold"
  go build -v -o ${srcdir}/nfold
  cd "${srcdir}/CloudForest/utils/toafm"
  go build -v -o ${srcdir}/toafm
}

package() {
  cd "${srcdir}/CloudForest"
  install -Dm755 ${srcdir}/leafcount "${pkgdir}/usr/bin/leafcount"
  install -Dm755 ${srcdir}/growforest "${pkgdir}/usr/bin/growforest"
  install -Dm755 ${srcdir}/applyforest "${pkgdir}/usr/bin/applyforest"
  install -Dm755 ${srcdir}/nfold "${pkgdir}/usr/bin/nfold"
  install -Dm755 ${srcdir}/toafm "${pkgdir}/usr/bin/toafm"
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/cloudforest/LICENSE"
  mkdir -p "${pkgdir}/usr/share/cloudforest/data"
  cp -a data/* "${pkgdir}/usr/share/cloudforest/data"
  chmod 644 "${pkgdir}/usr/share/cloudforest/data"/*
  go clean -modcache #Remove go libraries
}