SUMMARY="Pure python plotting library with matlab like syntax"
DESCRIPTION="Matplotlib is a plotting library for the Python programming \
language and its numerical mathematics extension NumPy. It provides an \
object-oriented API for embedding plots into applications using \
general-purpose  GUI toolkits like Tkinter, wxPython, Qt, or GTK+. There is \
also a procedural \"pylab\" interface, designed to closely resemble that of \
MATLAB, though its use is discouraged."
HOMEPAGE="https://matplotlib.org/"
COPYRIGHT="2002 - 2012 John Hunter, Darren Dale, Eric Firing, Michael \
Droettboom and the Matplotlib development team \
2012 - 2021 The Matplotlib development team"
LICENSE="Matplotlib
	Adobe
	BitstreamVera
	BSD (3-clause)
	MIT
	SIL Open Font License v1.1
	CC0 1.0 Universal
	AMS
	Anti-Grain Geometry
	BaKoMa
	ColorBrewer
	Qhull
	STIX
	yorick"
REVISION="2"
SOURCE_URI="https://github.com/matplotlib/matplotlib/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="ce7cebd3df11a032fff9b3a32029f49f0fc7c322f556f26ea9ef812d6e43cb21"
SOURCE_FILENAME="matplotlib-$portVersion.tar.gz"
SOURCE_DIR="matplotlib-$portVersion"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	$portName = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	pyqt5$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	"

pythonPackage="python38"
pythonVersion="3.8"

PROVIDES_python38="
	${portName}_$pythonPackage = $portVersion
	"
REQUIRES_python38="
	cmd:python$pythonVersion
	matplotlib$secondaryArchSuffix
	dateutil_$pythonPackage
	numpy${secondaryArchSuffix}_$pythonPackage
	pillow${secondaryArchSuffix}_$pythonPackage
	kiwisolver${secondaryArchSuffix}_$pythonPackage
	pytz_$pythonPackage
	six_$pythonPackage
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libpng16$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	numpy${secondaryArchSuffix}_$pythonPackage
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:python$pythonVersion
	setuptools_$pythonPackage
	"

INSTALL()
{
cat > setup.cfg << EOF
[libs]
enable_lto = True
system_freetype = True
system_qhull = False

[packages]
sample_data = True

[gui_support]
macosx = False

[rc_options]
backend = Qt5Agg
EOF

	python=python$pythonVersion
	installLocation=$prefix/lib/$python/vendor-packages/
	export PYTHONPATH=$installLocation:$PYTHONPATH
	mkdir -p $installLocation
	rm -rf build
	$python setup.py build install \
		--root=/ --prefix=$prefix

	packageEntries  $pythonPackage \
		$prefix/lib/python*
}
