summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 05095427a173ce5074afb64bf35223f6a43ed5a8 (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
# Maintainer: Kevin MacMartin <prurigro@gmail.com>

_pkgname=tidy-html5
pkgname=$_pkgname-bbatsche
pkgver=20140907.r122.3b68968
pkgrel=2
pkgdesc='Experimental fork of Tidy for HTML5 documents (bbatsche fork)'
url='https://github.com/bbatsche/tidy-html5'
license=('custom')
arch=('i686' 'x86_64' 'arm' 'armv6h' 'armv7h')
depends=('glibc')
makedepends=('git')
provides=('tidyhtml')
replaces=('tidyhtml')
conflicts=('tidyhtml')

source=('git+https://github.com/bbatsche/tidy-html5.git')
sha512sums=('SKIP')

pkgver() {
  cd $_pkgname
  printf "%s.r%s.%s" "$(git show -s --format=%ci master | sed 's/\ .*//g;s/-//g')" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  # This configures the Makefile's install location, which doesn't respond to DESTDIR
  sed -i 's|/usr/local|'"$pkgdir"'/usr|g' ${_pkgname}/build/gmake/Makefile
}

build() {
  cd $_pkgname

  # Build tidy command line tool
  make -C build/gmake/

  # Build libtidy shared library
  sh build/gnuauto/setup.sh
  ./configure \
    --prefix=/usr \
    --mandir=/usr/share/man/man1
  make
}

package() {
  cd $_pkgname

  # Install tidy command line tool
  make DESTDIR="$pkgdir" install -C build/gmake/

  # Install the libtidy shared library
  make DESTDIR="$pkgdir" install

  # Fix manpage location
  install -d "$pkgdir"/usr/share/man/man1
  mv "$pkgdir"/usr/man/man1/tidy.1 "$pkgdir"/usr/share/man/man1/tidy.1
  rmdir "$pkgdir"/usr/man{/man1,}

  # Install the license
  install -Dm644 license.html "$pkgdir"/usr/share/licenses/$pkgname/license.html

  # Install the documentation
  for doc in index.html README.html quickref.html tidy.css; do
    install -Dm644 $doc "$pkgdir"/usr/share/doc/$_pkgname/$doc
  done
}