openbabel-python-2.3.2.ebuild 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. PYTHON_COMPAT=( python2_7 python3_4 )
  5. inherit cmake-utils eutils multilib python-r1
  6. DESCRIPTION="Python bindings for OpenBabel (including Pybel)"
  7. HOMEPAGE="http://openbabel.sourceforge.net/"
  8. SRC_URI="mirror://sourceforge/openbabel/openbabel-${PV}.tar.gz"
  9. KEYWORDS="amd64 ~arm ppc x86 ~amd64-linux ~x86-linux"
  10. SLOT="0"
  11. LICENSE="GPL-2"
  12. IUSE=""
  13. REQUIRED_USE="${PYTHON_REQUIRED_USE}"
  14. RDEPEND="${PYTHON_DEPS}
  15. ~sci-chemistry/openbabel-${PV}
  16. sys-libs/zlib"
  17. DEPEND="${RDEPEND}
  18. >=dev-lang/swig-2"
  19. S="${WORKDIR}"/openbabel-${PV}
  20. PATCHES=(
  21. "${FILESDIR}"/${P}-testpybel.patch
  22. "${FILESDIR}"/${P}-bindings_only.patch
  23. "${FILESDIR}"/${P}-swig-3.0.3.patch
  24. )
  25. src_prepare() {
  26. cmake-utils_src_prepare
  27. sed \
  28. -e "s:\"\.\.\":\"${EPREFIX}/usr\":g" \
  29. -i test/testbabel.py || die
  30. swig -python -c++ -small -O -templatereduce -naturalvar \
  31. -I"${EPREFIX}/usr/include/openbabel-2.0" \
  32. -o scripts/python/openbabel-python.cpp \
  33. -DHAVE_EIGEN \
  34. -outdir scripts/python \
  35. scripts/openbabel-python.i \
  36. || die "Regeneration of openbabel-python.cpp failed"
  37. sed \
  38. -e '/__GNUC__/s:== 4:>= 4:g' \
  39. -i include/openbabel/shared_ptr.h || die
  40. }
  41. src_configure() {
  42. my_impl_src_configure() {
  43. local mycmakeargs=(
  44. -DCMAKE_INSTALL_RPATH=
  45. -DBINDINGS_ONLY=ON
  46. -DBABEL_SYSTEM_LIBRARY="${EPREFIX}/usr/$(get_libdir)/libopenbabel.so"
  47. -DOB_MODULE_PATH="${EPREFIX}/usr/$(get_libdir)/openbabel/${PV}"
  48. -DLIB_INSTALL_DIR="${D}$(python_get_sitedir)"
  49. -DPYTHON_BINDINGS=ON
  50. -DPYTHON_EXECUTABLE=${PYTHON}
  51. -DPYTHON_INCLUDE_DIR="$(python_get_includedir)"
  52. -DPYTHON_INCLUDE_PATH="$(python_get_includedir)"
  53. -DPYTHON_LIBRARY="$(python_get_library_path)"
  54. -DENABLE_TESTS=ON
  55. )
  56. cmake-utils_src_configure
  57. }
  58. python_foreach_impl my_impl_src_configure
  59. }
  60. src_compile() {
  61. python_foreach_impl cmake-utils_src_make bindings_python
  62. }
  63. src_test() {
  64. python_foreach_impl cmake-utils_src_test -R py
  65. }
  66. src_install() {
  67. my_impl_src_install() {
  68. cd "${BUILD_DIR}" || die
  69. cmake -DCOMPONENT=bindings_python -P cmake_install.cmake
  70. python_optimize
  71. }
  72. python_foreach_impl my_impl_src_install
  73. }