summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: fae6825f6bb2673f5eba9e65eb5f20f6adcfa1ee (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
# Maintainer: zfo <zfoofz1@gmail.com>
pkgname=bigdatascript-git
_pkgname=bigdatascript
pkgver=r1.19cfd00
pkgrel=1
pkgdesc="BigDataScript: Scripting language for big data"
url="https://github.com/pcingola/BigDataScript"
arch=('i686' 'x86_64')
license=('APACHE')
makedepends=('git' 'go' 'jdk' 'apache-ant')
source=()
md5sums=()

_gitroot=https://github.com/pcingola/bigdatascript
_gitname=bigdatascript

update_git(){
  cd "$srcdir"
  msg "Connecting to GIT server...."

  if [[ -d "$_gitname" ]]; then
    cd "$_gitname" && git pull origin >&2
    msg "The local files are updated."
  else
    git clone --depth 1 "$_gitroot" "$_gitname" >&2
  fi

  msg "GIT checkout done or server timeout"
}

pkgver() {
  update_git
  cd "${srcdir}/${_gitname}"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

function realpath { echo $(cd $(dirname $1); pwd)/$(basename $1); }

build() {
  cd "${srcdir}/${_gitname}"
  export BDS_HOME="$(realpath ../bds_home)"

  # wrap ant to build everything locally
  mkdir -p $BDS_HOME/.bds
  ant -Duser.home="$BDS_HOME"
  cp $BDS_HOME/.bds/bds.jar $BDS_HOME/bds.jar 
  rm -rf $BDS_HOME/.bds
  
  # now run the rest of the install script
  tail -n +21 scripts/install.sh | exec bash
}

package() {
  cd "$srcdir"/bds_home
  install -Dm0755 bds "${pkgdir}/usr/bin/bds"
  install -d "${pkgdir}/usr/local/bds"
  for file in $(find include -type f -name *.bds); do
      install -m 644 -D ${file} ${pkgdir}/usr/local/bds/${file#include}
  done
}

# vim:set ts=2 sw=2 et: