summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 44112c5732ecce58b0547a2eb7d836bdc1b12e1c (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 : Daniel Bermond < gmail-com: danielbermond >

pkgname=slimit2
_srcname=slimit
pkgver=0.8.1
pkgrel=4
pkgdesc='A JavaScript minifier written in Python (uses python2)'
arch=('any')
url='https://github.com/rspivak/slimit/'
license=('MIT')
depends=('python2' 'python2-ply' 'python2-setuptools')
makedepends=('python2-sphinx')
source=("${_srcname}-${pkgver}.tar.gz"::"https://github.com/rspivak/slimit/archive/0.8.1.tar.gz")
sha256sums=('015fc1917c0eff834514fcedd4251275a3dacb10df1b49549277fe5e19de1ddf')

prepare() {
    cd "${_srcname}-${pkgver}/docs"
    
    sed -i '/sphinx-build/s/$/2/' Makefile
}

build() {
    cd "${_srcname}-${pkgver}"
    python2 setup.py build
    cd docs
    make html man
}

check() {
    cd "${_srcname}-${pkgver}"
    python2 setup.py test
}

package() {
    cd "${_srcname}-${pkgver}"
    
    # directories creation
    mkdir -p "${pkgdir}/usr/share/doc/${pkgname}"
    mkdir -p "${pkgdir}/usr/share/licenses/${pkgname}"
    mkdir -p "${pkgdir}/usr/share/man/man1"
    
    # main python install
    python2 setup.py install --prefix="/usr" --root="$pkgdir" --skip-build --optimize='1'
    install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
    mv "$pkgdir"/usr/bin/slimit{,2}
    
    # html docs
    cd docs/build/html
    cp -a * "${pkgdir}/usr/share/doc/${pkgname}"
    
    # man page
    cd ../man
    install -D -m644 "${_srcname}.1" "${pkgdir}/usr/share/man/man1/${_srcname}2.1"
    
    # license
    cd "${srcdir}/${_srcname}-${pkgver}"
    install -D -m644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}