summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f1274d71e911050954c6eb6b22fb5b03beaf1682 (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
# Maintainer: Daichi Shinozaki <dsdseg@gmail.com>
# Contributor: Bruno Vieira <mail@bmpvieira.com>
# Contributor: Andy Weidenbaum <archbaum@gmail.com>

pkgname=casperjs-git
pkgver=20150602
pkgrel=2
pkgdesc="Navigation scripting & testing utility for PhantomJS and SlimerJS"
arch=('i686' 'x86_64')
depends=('nodejs' 'python2')
makedepends=('git' 'npm' 'python2-sphinx')
optdepends=('slimerjs: run your tests against Gecko (Firefox) instead of Webkit (just add –engine=slimerjs to your command line options)')
url="https://github.com/n1k0/casperjs"
license=('MIT')
source=(git+https://github.com/n1k0/casperjs)
sha256sums=('SKIP')
options=('!strip')
provides=('casperjs')
conflicts=('casperjs')
_pkgname=${pkgname%-git}

pkgver() {
  cd $_pkgname
  git log -1 --format="%cd" --date=short | sed "s|-||g"
}

build() {
  cd $_pkgname

  msg 'Fetching NPM dependencies...'
  npm install --python=python2

  msg 'Building man pages...'
  make build -C docs/
}

package() {
  cd $_pkgname

  msg 'Installing license...'
  install -Dm 644 LICENSE.md "$pkgdir/usr/share/licenses/${pkgname%-git}/LICENSE.md"

  msg 'Installing documentation...'
  install -dm 755 "$pkgdir/usr/share/doc/${pkgname%-git}"
  find docs/_build/ -mindepth 1 -maxdepth 1 -type f -name "*.html" -exec \
    cp -dpr --no-preserve=ownership '{}' "$pkgdir/usr/share/doc/${pkgname%-git}" \;
  cp -dpr --no-preserve=ownership docs CHANGELOG.md CONTRIBUTING.md README.md \
    "$pkgdir/usr/share/doc/${pkgname%-git}"

  msg 'Installing...'
  install -dm 755 "$pkgdir/opt/$_pkgname"
  install -dm 755 $pkgdir/{usr/share,opt}/$_pkgname
  find . -mindepth 1 -maxdepth 1 -exec \
    cp -dpr --no-preserve=ownership '{}' "$pkgdir/opt/$_pkgname" \;

  mkdir -m755 -p $pkgdir/usr/bin
  mkdir -m755 -p $pkgdir/opt/casperjs/bin
  
  install -m755 bin/* "$pkgdir"/opt/casperjs/bin
  install -m755 package.json "$pkgdir"/opt/casperjs/
  ln -sf /opt/$_pkgname/bin/$_pkgname $pkgdir/usr/bin/$_pkgname

  msg 'Cleaning up pkgdir...'
  find "$pkgdir" -type d -name .git -exec rm -r '{}' +
  find "$pkgdir" -type f -name .gitignore -exec rm -r '{}' +
}