summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 301f9bf48117ab94e33cfa3ccf4f31ab43bc09ee (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: Scott Lawrence <bytbox@gmail.com>
pkgname=sloc-git
pkgver=20180815
pkgrel=1
pkgdesc="Simply counts source lines of code"
arch=('i686' 'x86_64')
url="https://github.com/bytbox/sloc"
license=('MIT')
depends=()
optdepends=('perl-datetime' 'perl-json' 'perl-switch' 'gnuplot')
makedepends=('go')
provides=()
conflicts=()
replaces=()
options=()
install=
changelog=
source=()
noextract=()
md5sums=() #generate with 'makepkg -g'

_gitroot=https://github.com/bytbox/sloc
_gitname=sloc

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

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

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

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

  msg2 "Generating man page"
  cd "$srcdir/$_gitname-build"
  ./gen-man.sh

  msg2 "Building sloc"
  cd "$srcdir/$_gitname-build/sloc"
  go build -o sloc
}

package() {
  cd "$srcdir/$_gitname-build"
  install -D -m755 sloc/sloc "${pkgdir}/usr/bin/sloc"
  install -D -m755 reposloc "${pkgdir}/usr/bin/reposloc"
  install -D -m644 reposloc.1 "${pkgdir}/usr/share/man/man1/reposloc.1"
}

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