gnome-python-common-r1.eclass 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. # Copyright 1999-2014 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # @ECLASS: gnome-python-common-r1.eclass
  4. # @MAINTAINER:
  5. # GNOME team <gnome@gentoo.org>
  6. # @AUTHOR:
  7. # Author: Michał Górny <mgorny@gentoo.org>
  8. # Based on the work of: Arun raghaven <ford_prefect@gentoo.org>
  9. # which in turn was based on the work of Jim Ramsay <lack@gentoo.org>
  10. # @BLURB: Common functionality for building gnome-python* bindings
  11. # @DESCRIPTION:
  12. # This eclass provides python-r1 support for the GNOME2 library Python
  13. # bindings.
  14. : ${GNOME_ORG_MODULE:=gnome-python}
  15. : ${GNOME_TARBALL_SUFFIX:=bz2}
  16. : ${GNOME2_LA_PUNT:=yes}
  17. : ${GCONF_DEBUG:=no}
  18. # @ECLASS-VARIABLE: G_PY_BINDINGS
  19. # @DESCRIPTION:
  20. # The actual '--enable-<binding>' name. If multiple bindings are to
  21. # be enabled, must be an array.
  22. : ${G_PY_BINDINGS:=${PN%-python}}
  23. # @ECLASS-VARIABLE: EXAMPLES
  24. # @DEFAULT_UNSET
  25. # @DESCRIPTION:
  26. # The set of example files to be installed if the 'examples' USE flag
  27. # is set.
  28. case "${EAPI:-0}" in
  29. 0|1|2|3|4)
  30. die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
  31. ;;
  32. 5)
  33. ;;
  34. *)
  35. die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
  36. ;;
  37. esac
  38. inherit eutils gnome2 python-r1
  39. EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
  40. HOMEPAGE="http://pygtk.org/"
  41. RESTRICT="${RESTRICT} test"
  42. DOCS="AUTHORS ChangeLog NEWS README"
  43. if [[ ${GNOME_ORG_MODULE} != "gnome-python" ]]; then
  44. DOCS="${DOCS} MAINTAINERS"
  45. fi
  46. RDEPEND="~dev-python/${GNOME_ORG_MODULE}-base-${PV}
  47. ${PYTHON_DEPS}"
  48. DEPEND="${RDEPEND}
  49. virtual/pkgconfig"
  50. REQUIRED_USE=${PYTHON_REQUIRED_USE}
  51. gnome-python-common-r1_src_prepare() {
  52. gnome2_src_prepare
  53. # The .pc file is installed by respective gnome-python*-base package
  54. sed -i '/^pkgconfig_DATA/d' Makefile.in || die "sed failed"
  55. sed -i '/^pkgconfigdir/d' Makefile.in || die "sed failed"
  56. #
  57. # python_copy_sources
  58. }
  59. gnome-python-common-r1_src_configure() {
  60. local myconf=(
  61. --disable-allbindings
  62. "${G_PY_BINDINGS[@]/#/--enable-}"
  63. )
  64. ECONF_SOURCE=${S} \
  65. python_foreach_impl \
  66. gnome2_src_configure "${myconf[@]}" "${@}"
  67. }
  68. gnome-python-common-r1_src_compile() {
  69. python_foreach_impl default
  70. }
  71. gnome-python-common-r1_src_test() {
  72. python_foreach_impl default
  73. }
  74. # Do a regular gnome2 src_install and then install examples if required.
  75. # Set the variable EXAMPLES to provide the set of examples to be installed.
  76. # (to install a directory recursively, specify it with a trailing '/' - for
  77. # example, foo/bar/)
  78. gnome-python-common-r1_src_install() {
  79. python_foreach_impl gnome2_src_install
  80. if in_iuse examples && use examples; then
  81. docinto examples
  82. dodoc -r "${EXAMPLES[@]}"
  83. fi
  84. }