SUMMARY="A Lightweight IDE for Python & Scientific development"
DESCRIPTION="PyCharm is a Python IDE for professional developers by JetBrains"
HOMEPAGE="https://www.jetbrains.com/pycharm/"
COPYRIGHT="2020-2021 JetBrains s.r.o."
LICENSE="Apache v2"
REVISION="1"
SOURCE_URI="https://download.jetbrains.com/python/pycharm-community-$portVersion.tar.gz#noarchive"
CHECKSUM_SHA256="10331302819324794e70843a73bfedbc6023778e4374f57f80608983be4e7a11"
ADDITIONAL_FILES="PyCharm_Logo.hvif"

ARCHITECTURES="any"
DISABLE_SOURCE_PACKAGE="true"

PROVIDES="
	pycharm_community_bin = $portVersion
	app:pycharm = $portVersion
	"
REQUIRES="
	haiku
	java:environment == 11
	"

BUILD_PREREQUIRES="
	"

INSTALL()
{
	mkdir -p $appsDir
	tar xvf pycharm-community-$portVersion.tar.gz -C $appsDir
	mv $appsDir/pycharm-community-$portVersion $appsDir/pycharm

	rm -rf $appsDir/pycharm/jre64

	cat << EOF > $appsDir/pycharm/pycharm.sh
#!/bin/sh -l
export PATH=\$JDK11_HOME/bin:\$PATH
exec $appsDir/pycharm/bin/pycharm.sh
EOF
	chmod 755 $appsDir/pycharm/pycharm.sh
	echo "-Dide.no.platform.update=Haiku" >> $appsDir/pycharm/bin/pycharm.vmoptions
	echo "-Dide.no.platform.update=Haiku" >> $appsDir/pycharm/bin/pycharm64.vmoptions

	addattr -t icon -f $portDir/additional-files/PyCharm_Logo.hvif \
		"BEOS:ICON" "$appsDir/pycharm/pycharm.sh"

	addAppDeskbarSymlink $appsDir/pycharm/pycharm.sh 'PyCharm CE'
}
