enlightenment.eclass 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. # Copyright 1999-2014 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # @ECLASS: enlightenment.eclass
  4. # @MAINTAINER:
  5. # enlightenment@gentoo.org
  6. # @BLURB: simplify enlightenment package management
  7. if [[ -z ${_ENLIGHTENMENT_ECLASS} ]]; then
  8. _ENLIGHTENMENT_ECLASS=1
  9. inherit eutils libtool
  10. # @ECLASS-VARIABLE: E_PYTHON
  11. # @DEFAULT_UNSET
  12. # @DESCRIPTION:
  13. # if defined, the package is based on Python/distutils
  14. # @ECLASS-VARIABLE: E_CYTHON
  15. # @DEFAULT_UNSET
  16. # @DESCRIPTION:
  17. # if defined, the package is Cython bindings (implies E_PYTHON)
  18. # @ECLASS-VARIABLE: E_ECONF
  19. # @DESCRIPTION:
  20. # Array of flags to pass to econf (obsoletes MY_ECONF)
  21. E_ECONF=()
  22. # E_STATE's:
  23. # release [default]
  24. # SRC_URI $P.tar.gz
  25. # S $WORKDIR/$P
  26. #
  27. # snap $PV has .200##### datestamp or .### counter
  28. # SRC_URI $P.tar.bz2
  29. # S $WORKDIR/$P
  30. #
  31. # live $PV has a 9999 marker
  32. # KEYWORDS ""
  33. # SRC_URI svn/etc... up
  34. # S $WORKDIR/$E_S_APPEND
  35. #
  36. # Overrides:
  37. # KEYWORDS EKEY_STATE
  38. # SRC_URI EURI_STATE
  39. # S EURI_STATE
  40. E_LIVE_SERVER_DEFAULT_SVN="http://svn.enlightenment.org/svn/e/trunk"
  41. E_LIVE_SERVER_DEFAULT_GIT="git://git.enlightenment.org"
  42. E_STATE="release"
  43. if [[ ${PV} == *9999* ]] ; then
  44. if [[ ${EGIT_URI_APPEND} ]] ; then
  45. E_LIVE_SERVER=${E_LIVE_SERVER:-${E_LIVE_SERVER_DEFAULT_GIT}}
  46. EGIT_URI_APPEND=${EGIT_URI_APPEND:-${PN}}
  47. EGIT_PROJECT="enlightenment/${EGIT_SUB_PROJECT}/${EGIT_URI_APPEND}"
  48. EGIT_REPO_URI=${EGIT_SERVER:-${E_LIVE_SERVER_DEFAULT_GIT}}/${EGIT_SUB_PROJECT}/${EGIT_URI_APPEND}.git
  49. E_S_APPEND=${EGIT_URI_APPEND}
  50. E_LIVE_SOURCE="git"
  51. inherit git-2
  52. else
  53. E_LIVE_SERVER=${E_LIVE_SERVER:-${E_LIVE_SERVER_DEFAULT_SVN}}
  54. ESVN_URI_APPEND=${ESVN_URI_APPEND:-${PN}}
  55. ESVN_PROJECT="enlightenment/${ESVN_SUB_PROJECT}"
  56. ESVN_REPO_URI=${ESVN_SERVER:-${E_LIVE_SERVER_DEFAULT_SVN}}/${ESVN_SUB_PROJECT}/${ESVN_URI_APPEND}
  57. E_S_APPEND=${ESVN_URI_APPEND}
  58. E_LIVE_SOURCE="svn"
  59. inherit subversion
  60. fi
  61. E_STATE="live"
  62. WANT_AUTOTOOLS="yes"
  63. elif [[ -n ${E_SNAP_DATE} ]] ; then
  64. E_STATE="snap"
  65. else
  66. E_STATE="release"
  67. fi
  68. # Parse requested python state
  69. : ${E_PYTHON:=${E_CYTHON}}
  70. if [[ -n ${E_PYTHON} ]] ; then
  71. PYTHON_DEPEND="2"
  72. inherit python
  73. fi
  74. if [[ ${WANT_AUTOTOOLS} == "yes" ]] ; then
  75. WANT_AUTOCONF=${E_WANT_AUTOCONF:-latest}
  76. WANT_AUTOMAKE=${E_WANT_AUTOMAKE:-latest}
  77. inherit autotools
  78. fi
  79. ENLIGHTENMENT_EXPF="src_unpack src_compile src_install"
  80. case "${EAPI:-0}" in
  81. 2|3|4|5) ENLIGHTENMENT_EXPF+=" src_prepare src_configure" ;;
  82. *) ;;
  83. esac
  84. EXPORT_FUNCTIONS ${ENLIGHTENMENT_EXPF}
  85. DESCRIPTION="A DR17 production"
  86. HOMEPAGE="http://www.enlightenment.org/"
  87. if [[ -z ${SRC_URI} ]] ; then
  88. case ${EURI_STATE:-${E_STATE}} in
  89. release) SRC_URI="mirror://sourceforge/enlightenment/${P}.tar.gz";;
  90. snap) SRC_URI="http://download.enlightenment.org/snapshots/${E_SNAP_DATE}/${P}.tar.bz2";;
  91. live) SRC_URI="";;
  92. esac
  93. fi
  94. LICENSE="BSD"
  95. SLOT="0"
  96. IUSE="nls doc"
  97. DEPEND="doc? ( app-doc/doxygen )
  98. ${E_PYTHON:+>=dev-python/setuptools-0.6_rc9}
  99. ${E_CYTHON:+>=dev-python/cython-0.12.1}"
  100. RDEPEND="nls? ( sys-devel/gettext )"
  101. case ${EURI_STATE:-${E_STATE}} in
  102. release) S=${WORKDIR}/${P};;
  103. snap) S=${WORKDIR}/${P};;
  104. live) S=${WORKDIR}/${E_S_APPEND};;
  105. esac
  106. enlightenment_src_unpack() {
  107. if [[ ${E_STATE} == "live" ]] ; then
  108. case ${E_LIVE_SOURCE} in
  109. svn) subversion_src_unpack;;
  110. git) git-2_src_unpack;;
  111. *) die "eek!";;
  112. esac
  113. else
  114. unpack ${A}
  115. fi
  116. if ! has src_prepare ${ENLIGHTENMENT_EXPF} ; then
  117. cd "${S}" || die
  118. enlightenment_src_prepare
  119. fi
  120. }
  121. enlightenment_src_prepare() {
  122. epatch_user
  123. [[ -s gendoc ]] && chmod a+rx gendoc
  124. if [[ ${WANT_AUTOTOOLS} == "yes" ]] ; then
  125. [[ -d po ]] && eautopoint -f
  126. # autotools require README, when README.in is around, but README
  127. # is created later in configure step
  128. [[ -f README.in ]] && touch README
  129. export SVN_REPO_PATH=${ESVN_WC_PATH}
  130. eautoreconf
  131. fi
  132. epunt_cxx
  133. elibtoolize
  134. }
  135. enlightenment_src_configure() {
  136. # gstreamer sucks, work around it doing stupid stuff
  137. export GST_REGISTRY="${S}/registry.xml"
  138. has static-libs ${IUSE} && E_ECONF+=( $(use_enable static-libs static) )
  139. econf ${MY_ECONF} "${E_ECONF[@]}"
  140. }
  141. enlightenment_src_compile() {
  142. has src_configure ${ENLIGHTENMENT_EXPF} || enlightenment_src_configure
  143. V=1 emake || die
  144. if use doc ; then
  145. if [[ -x ./gendoc ]] ; then
  146. ./gendoc || die
  147. elif emake -j1 -n doc >&/dev/null ; then
  148. V=1 emake doc || die
  149. fi
  150. fi
  151. }
  152. enlightenment_src_install() {
  153. V=1 emake install DESTDIR="${D}" || die
  154. find "${D}" '(' -name CVS -o -name .svn -o -name .git ')' -type d -exec rm -rf '{}' \; 2>/dev/null
  155. for d in AUTHORS ChangeLog NEWS README TODO ${EDOCS}; do
  156. [[ -f ${d} ]] && dodoc ${d}
  157. done
  158. use doc && [[ -d doc ]] && dohtml -r doc/*
  159. if has static-libs ${IUSE} ; then
  160. use static-libs || find "${D}" -name '*.la' -exec rm -f {} +
  161. fi
  162. }
  163. fi