Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 1 | inherit pythonnative python-dir |
| 2 | |
| 3 | export STAGING_INCDIR |
| 4 | export STAGING_LIBDIR |
| 5 | export BUILD_SYS |
| 6 | export HOST_SYS |
| 7 | |
| 8 | RDEPENDS_${PN}-python += "python" |
| 9 | PACKAGECONFIG_${PN}-python[xen] = ",,,xen-python" |
| 10 | |
| 11 | PACKAGES += "${PN}-python-staticdev ${PN}-python-dev ${PN}-python-dbg ${PN}-python" |
| 12 | |
| 13 | FILES_${PN}-python-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a" |
| 14 | FILES_${PN}-python-dev += "${PYTHON_SITEPACKAGES_DIR}/*.la" |
| 15 | FILES_${PN}-python-dbg += "${PYTHON_SITEPACKAGES_DIR}/.debug/" |
| 16 | FILES_${PN}-python = "${bindir}/* ${libdir}/* ${libdir}/${PYTHON_DIR}/*" |
| 17 | |
| 18 | SRC_URI += "http://libvirt.org/sources/python/libvirt-python-${PV}.tar.gz;name=libvirt_python" |
| 19 | SRC_URI += "file://libvirt_api_xml_path.patch;patchdir=../libvirt-python-${PV}" |
| 20 | |
Patrick Williams | e69d235 | 2017-02-23 20:56:04 -0600 | [diff] [blame] | 21 | SRC_URI[libvirt_python.md5sum] = "4dbd7ef9ee9c4dea5887b5b31eb04529" |
| 22 | SRC_URI[libvirt_python.sha256sum] = "a0508a57637fd18a3584fb9d2322fb172f65708c9db16e0438a70eb0f36fa5c2" |
Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 23 | |
| 24 | export LIBVIRT_API_PATH = "${S}/docs/libvirt-api.xml" |
| 25 | export LIBVIRT_CFLAGS = "-I${S}/include" |
| 26 | export LIBVIRT_LIBS = "-L${B}/src/.libs -lvirt -ldl" |
| 27 | export LDFLAGS="-L${B}/src/.libs" |
| 28 | |
| 29 | LIBVIRT_INSTALL_ARGS = "--root=${D} \ |
| 30 | --prefix=${prefix} \ |
| 31 | --install-lib=${PYTHON_SITEPACKAGES_DIR} \ |
| 32 | --install-data=${datadir}" |
| 33 | |
| 34 | python __anonymous () { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 35 | pkgconfig = d.getVar('PACKAGECONFIG') |
Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 36 | if ('python') in pkgconfig.split(): |
| 37 | d.setVar('LIBVIRT_PYTHON_ENABLE', '1') |
| 38 | else: |
| 39 | d.setVar('LIBVIRT_PYTHON_ENABLE', '0') |
| 40 | } |
| 41 | |
| 42 | do_compile_append() { |
| 43 | if [ "${LIBVIRT_PYTHON_ENABLE}" = "1" ]; then |
Patrick Williams | e69d235 | 2017-02-23 20:56:04 -0600 | [diff] [blame] | 44 | cd ${WORKDIR}/${BPN}-python-${PV} && \ |
Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 45 | ${STAGING_BINDIR_NATIVE}/python-native/python setup.py build |
| 46 | fi |
| 47 | } |
| 48 | |
| 49 | do_install_append() { |
| 50 | if [ "${LIBVIRT_PYTHON_ENABLE}" = "1" ]; then |
Patrick Williams | e69d235 | 2017-02-23 20:56:04 -0600 | [diff] [blame] | 51 | cd ${WORKDIR}/${BPN}-python-${PV} && \ |
Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 52 | ${STAGING_BINDIR_NATIVE}/python-native/python setup.py install \ |
| 53 | --install-lib=${D}/${PYTHON_SITEPACKAGES_DIR} ${LIBVIRT_INSTALL_ARGS} |
| 54 | fi |
| 55 | } |