aboutsummaryrefslogtreecommitdiffstats
path: root/community/py-yuicompressor/APKBUILD
blob: 105bfc9be89fc3e30dd5466953fe1af7f2d25f57 (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
# Contributor: Stuart Cardall <developer@it-offshore.co.uk>
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
pkgname=py-yuicompressor
_pkgname=${pkgname#py-}
pkgver=2.4.8
pkgrel=1
pkgdesc="YUI Compressor is a JavaScript and CSS minifier written in Java."
url="https://pypi.python.org/pypi/yuicompressor"
arch="noarch"
license="BSD"
depends="openjdk8-jre-base"
makedepends="python2-dev python3-dev py-setuptools"
subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3"
source="$pkgname-$pkgver.tar.gz::https://github.com/sprat/yuicompressor/archive/$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	cd "$builddir"
	python2 setup.py build
	python3 setup.py build
}

package() {
	mkdir -p "$pkgdir"/usr/bin

	# Create unsuffixed symlink for executable from py3 subpackage.
	ln -s yuicompressor-3 "$pkgdir"/usr/bin/yuicompressor
}

_py2() {
	_py python2
}

_py3() {
	_py python3
}

_py() {
	local python="$1"
	local pyver="${1:6:1}"
	pkgdesc="$pkgdesc (for $python)"
	depends="$depends $python"  ## remove if arch isn't noarch
	install_if="$pkgname=$pkgver-r$pkgrel $python"

	cd "$builddir"
	$python setup.py install --prefix=/usr --root="$subpkgdir"

	# Add version suffix to executable files.
	local path; for path in "$subpkgdir"/usr/bin/*; do
		mv "$path" "$path-$pyver"
	done
}

sha512sums="8e5dc2d2a4bea68961cbccad0cf6c5411f607f75b1b1b6f351560d6fa9862a124a5d277f7bf8b62261439e45fd32441cd4555b7c902b6bc48df3d5357e43505e  py-yuicompressor-2.4.8.tar.gz"