summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: af2d97826d7277ce8fd29d8a55b1f6f1c5236db1 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Maintainer: Pavol Hluchy (Lopo) <lopo at losys dot eu>

pkgname=netbeans-nightly
pkgver=latest
pkgrel=10
pkgdesc='IDE for Java, HTML5, PHP, Groovy, C and C++'
license=('CDDL')
arch=('any')
url="http://netbeans.org"
depends=('java-environment' 'ttf-font' 'libxtst' 'giflib' 'atk')
makedepends=('gendesk' 'setconf')
optdepends=('php: for developing programs in php'
			'groovy: for developing programs in groovy'
			'lib32-glibc')
provides=('netbeans')
backup=("usr/share/$pkgname/etc/netbeans.conf")
install="netbeans.install"
options=(!strip)
source=('netbeans-nightly.png')
sha512sums=('243e5170718d24a15ab67a0f0491c1c50d5bb8bace08485eb73ce33988583aa7fa0ae9f3ad149c9aaeeb99d130e11888e76ac1474e725f3e57e89ae7b36b6040')
_webroot="http://bits.netbeans.org/download/trunk/nightly/latest"

prepare() {
	cd "${SRCDEST}"

	download_file "${_webroot}/js/build_info.js"
	download_file "${_webroot}/js/files.js"

	_zipname=`grep -e '^build_info\.ZIP_FILES_PREFIX\s' build_info.js \
			| awk 'BEGIN {FPAT="\".+\""} {gsub(/\"/, "", $NF); print}'`
	_file="${_zipname}.zip"
	_md5=`grep "zip/${_file}" files.js \
		| awk 'BEGIN {FPAT="\"[0-9a-z]+\""} {gsub(/\"/, "", $NF); print}'`
	case ${#_md5} in
		32)
			_alg=md5
			;;
		40)
			_alg=sha1
			;;
		56)
			_alg=sha224
			;;
		64)
			_alg=sha256
			;;
		96)
			_alg=sha384
			;;
		128)
			_alg=sha512
			;;
		*)
			msg "unbale to detect hash algorithm, hash: ${_md5}"
			return 1
			;;
	esac

	download_file "${_webroot}/zip/${_file}"
	verify_integrity_one "${_file}" ${_alg} "${_md5}" || return 1

	cd "$srcdir"
	ln -fs "${SRCDEST}/${_file}"
	extract_file "${_file}"
}

build() {
	msg2 "cleanup OS specific files"
	rm $(find -name '*\.exe' -or -name '*\.bat' -or -name '*\.dll')
	rm -r $(find -name 'MacOSX*' -or -name 'Windows*' -or -name 'SunOS*' -or -name 'FreeBSD*')
	rm -r $(find -name 'hpux*' -or -name 'mac*' -or -name 'solaris*' -or -name 'windows*')

	gendesk -f -n --pkgname "$pkgname" --pkgdesc "$pkgdesc" \
		--custom "StartupWMClass=NetBeans IDE Dev"
	setconf "netbeans/bin/netbeans" basedir "/usr/share/$pkgname"
#	setconf -a netbeans/etc/netbeans.conf netbeans_jdkhome '"/usr/lib/jvm/default"'
}

package() {
	mkdir -p "$pkgdir"/usr/{bin,share/applications}

	# Resources
	cp -r netbeans "$pkgdir/usr/share/$pkgname"

	# Desktop shortcut and icon
	install -Dm644 "$pkgname.desktop" "$pkgdir/usr/share/applications/$pkgname.desktop"
	install -Dm644 netbeans-nightly.png "$pkgdir/usr/share/pixmaps/$pkgname.png"

	ln -fs "/usr/share/$pkgname/bin/netbeans" "$pkgdir/usr/bin/$pkgname"
}

# vim:set ts=4 sw=4 ai: