summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1fb0f8c23c54a0aa3ff9d474c7b54c55173a1c9b (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
# Maintainer: Simon Legner <Simon.Legner@gmail.com>
pkgname=bazel-git
pkgver=r858.18629fb
pkgrel=1
pkgdesc="Correct, reproducible, and fast builds for everyone"
arch=('i686' 'x86_64')
url="http://bazel.io/"
license=('Apache')
depends=('java-environment=8' 'libarchive' 'gcc-libs-multilib' 'zip' 'unzip')
makedepends=('git' 'protobuf')
install=bazel.install
options=('!strip')

_gitroot=https://github.com/google/bazel.git
_gitname=bazel

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

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

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

  msg "GIT checkout done or server timeout"
  msg "Starting build..."

  rm -rf "$srcdir/$_gitname-build"
  git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build"
  cd "$srcdir/$_gitname-build"

  #
  # BUILD HERE
  #
  ./compile.sh
  ./output/bazel build scripts:bazel-complete.bash
}

package() {
  install -Dm755 "$srcdir/$_gitname-build/output/bazel" "$pkgdir/usr/bin/bazel"
  install -Dm755 "$srcdir/$_gitname-build/bazel-bin/scripts/bazel-complete.bash" "$pkgdir/etc/bash_completion.d/bazel-complete.bash"
  mkdir -p "$pkgdir/opt/bazel/base_workspace"
  for d in examples third_party tools; do
    cp -r "$srcdir/$_gitname-build/$d" "$pkgdir/opt/bazel/"
    cd "$pkgdir/opt/bazel/base_workspace"
    ln -s "/opt/bazel/$d" ./
  done
}

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