1SUMMARY="A Python binding to Poppler-Qt5"
2DESCRIPTION="A Python binding for libpoppler-qt5 that aims for completeness and for being \
3actively maintained.
4Using this module you can access the contents of PDF files inside PyQt5 applications."
5HOMEPAGE="https://github.com/frescobaldi/python-poppler-qt5/"
6COPYRIGHT="2009-2022 Wilbert Berendsen"
7LICENSE="GNU LGPL v2.1"
8REVISION="3"
9SOURCE_URI="https://pypi.python.org/packages/source/p/python-poppler-qt5/python-poppler-qt5-$portVersion.tar.gz"
10CHECKSUM_SHA256="b477e8841f0ea0e09fdab6f2f305cf38df977d9e142e5693a374605d75dd6fe0"
11SOURCE_DIR="python-poppler-qt5-$portVersion"
12PYTHON3_VERSION="3.10"
13
14ARCHITECTURES="all !x86_gcc2"
15SECONDARY_ARCHITECTURES="x86"
16
17PROVIDES="
18	python_poppler_qt5$secondaryArchSuffix = $portVersion
19	"
20REQUIRES="
21	haiku$secondaryArchSuffix
22	lib:libpoppler_qt5$secondaryArchSuffix
23	"
24PROVIDES_python310="
25	python_poppler_qt5${secondaryArchSuffix}_python310 = $portVersion
26	"
27REQUIRES_python310="
28	haiku$secondaryArchSuffix
29	python_poppler_qt5$secondaryArchSuffix == $portVersion base
30	pyqt5_python310
31	pyqt5_sip_python310
32	cmd:python$PYTHON3_VERSION
33	$REQUIRES
34	"
35
36if [ "$targetArchitecture" = "x86_gcc2" ]; then
37	PROVIDES_python310+="
38		python_poppler_qt5_python310 = $portVersion
39		"
40fi
41
42BUILD_REQUIRES="
43	haiku${secondaryArchSuffix}_devel
44	pyqt_builder_python310
45	pyqt5_python310
46	setuptools_python310
47	sip_python310 >= 6
48	devel:libpoppler_qt5$secondaryArchSuffix
49	"
50BUILD_PREREQUIRES="
51	cmd:python$PYTHON3_VERSION
52	cmd:gcc${secondaryArchSuffix}
53	cmd:make
54	cmd:ld${secondaryArchSuffix}
55	cmd:pkg_config$secondaryArchSuffix
56	cmd:sed
57	cmd:sip >= 6
58	cmd:qmake${secondaryArchSuffix} >= 5
59	"
60
61BUILD()
62{
63	OLDPYTHONPATH=$PYTHONPATH
64
65	local packageLinksDir=$(dirname $portPackageLinksDir)
66	local python3PackageName="${portName}_python310-$portFullVersion"
67
68	# GENERIC: all python_setuptools-based installs need this
69	python=$packageLinksDir/$python3PackageName/cmd~python$PYTHON3_VERSION/bin/python$PYTHON3_VERSION
70	pythonVersion=$($python --version 2>&1 | sed 's/Python //' | head -c4)
71	installLocation=$prefix/lib/python$pythonVersion/vendor-packages/
72	export PYTHONPATH=$installLocation:$OLDPYTHONPATH
73
74	# this seems to be not needed
75	#BINDINGS_DIR=$portPackageLinksDir/pyqt5_python310/lib/python$pythonVersion/vendor-packages/PyQt5/bindings/
76	#sed -i -e "s|BINDINGS_DIR|$BINDINGS_DIR|g" pyproject.toml
77
78	sip-build \
79		--no-make \
80		--target-dir=$installLocation \
81		--api-dir=$dataDir/sip/PyQt5
82
83	cd build
84
85	## BUILD HACK ##
86	# what is this for? is this needed at all? ".5" is probably not correct in our case anyway ...
87	#sed -i "s|libpopplerqt5.so|libpopplerqt5.so.5|g" popplerqt5/Makefile
88	## BUILD HACK ##
89
90	make $jobArgs
91}
92
93INSTALL()
94{
95	OLDPYTHONPATH=$PYTHONPATH
96
97	local packageLinksDir=$(dirname $portPackageLinksDir)
98	local python3PackageName="${portName}_python310-$portFullVersion"
99
100	# GENERIC: all python_setuptools-based installs need this
101	python=$packageLinksDir/$python3PackageName/cmd~python$PYTHON3_VERSION/bin/python$PYTHON3_VERSION
102	pythonVersion=$($python --version 2>&1 | sed 's/Python //' | head -c4)
103	installLocation=lib/python$pythonVersion/vendor-packages/
104	export PYTHONPATH=$installLocation:$OLDPYTHONPATH
105
106	mkdir -p $installLocation
107	cd build
108	make install INSTALL_ROOT=
109
110	$python -m compileall -d / $prefix/lib/python$pythonVersion
111	$python -O -m compileall -d / $prefix/lib/python$pythonVersion
112
113	packageEntries python310 \
114		$installLocation
115
116	rmdir $prefix/lib/python$pythonVersion
117
118	### PACKAGING HACK ###
119	rm -rf $prefix/packages
120	### PACKAGING HACK ###
121}
122