SUMMARY="An IDE for Java"
DESCRIPTION="NetBeans IDE lets you quickly and easily develop Java desktop, \
mobile, and web applications, as well as HTML5 applications with HTML, \
JavaScript, and CSS. The IDE also provides a great set of tools for PHP and \
C/C++ developers.
It is free and open source and has a large community of users and developers \
around the world."
HOMEPAGE="https://netbeans.org/"
COPYRIGHT="1997,2016 Oracle and/or its affiliates"
LICENSE="NetBeans"
REVISION="1"
buildVersion="$portVersion-201609300101"
SOURCE_URI="https://download.netbeans.org/netbeans/$portVersion/final/zip/netbeans-$buildVersion.zip#noarchive"
CHECKSUM_SHA256="ad9888334b9a6c1f1138dcb2eccc8ce4921463e871e46def4ecc617538160948"
ADDITIONAL_FILES="netbeans-ide.hvif"

ARCHITECTURES="any"
DISABLE_SOURCE_PACKAGE="true"

PROVIDES="
	netbeans_bin = $portVersion
	app:netbeans = $portVersion
	"
REQUIRES="
	haiku
	java:environment == 8
	"

BUILD_PREREQUIRES="
	cmd:find
	cmd:unzip
	cmd:xargs
	"

INSTALL()
{
	mkdir -p $appsDir
	cd $appsDir
	unzip $sourceDir/netbeans-$buildVersion.zip

	cd netbeans
	rm -rf profiler {cnd,dlight,ide}/bin \
		platform/modules/lib/{amd64,i386,x86}
	find . -name "*.dll" -o -name "*.exe" -o -name "*.cmd" \
		-o -name "*.bat" -o -name ".lastModified" | xargs rm

	cat << EOF > $appsDir/netbeans/netbeans.sh
#!/bin/sh -l
export PATH=\$JDK8_HOME/bin:\$PATH
exec $appsDir/netbeans/bin/netbeans
EOF
	chmod 755 $appsDir/netbeans/netbeans.sh

	addattr -t icon -f $portDir/additional-files/netbeans-ide.hvif \
		"BEOS:ICON" "$appsDir/netbeans/netbeans.sh"
	addAppDeskbarSymlink $appsDir/netbeans/netbeans.sh 'NetBeans'
}
