gpe.eclass 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. # Copyright 1999-2012 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # @ECLASS: gpe.eclass
  4. # @MAINTAINER:
  5. # gpe@gentoo.org
  6. # @AUTHOR:
  7. # Original Authors:
  8. # Rene Wagner <rw@handhelds.org>
  9. # Ned Ludd <solar@gentoo.org>
  10. # Angelo Arrifano <miknix@gentoo.org>
  11. # EAPI->EAPI2 patch: loki_val
  12. # multiple suggestions: Betelgeuse
  13. # Based on gnome2.eclass and gpe.bbclass (the latter from OpenEmbedded)
  14. # @BLURB: Provides common functionality for the G Palmtop Environment.
  15. inherit libtool toolchain-funcs
  16. case "${EAPI:-0}" in
  17. 0|1)
  18. EXPORT_FUNCTIONS src_unpack src_compile src_install
  19. ;;
  20. *)
  21. EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install
  22. ;;
  23. esac
  24. # @ECLASS-VARIABLE: ELTCONF
  25. # @DESCRIPTION:
  26. # Extra options passed to elibtoolize on gnome2 eclass.
  27. ELTCONF=""
  28. # @ECLASS-VARIABLE: GPE_DOCS
  29. # @DESCRIPTION:
  30. # Documentation files to be installed with dodoc.
  31. GPE_DOCS=""
  32. [[ -z "${GPE_MIRROR}" ]] && GPE_MIRROR="http://gpe.linuxtogo.org/download/source"
  33. [[ -z "${GPE_TARBALL_SUFFIX}" ]] && GPE_TARBALL_SUFFIX="gz"
  34. SRC_URI="${GPE_MIRROR}/${P}.tar.${GPE_TARBALL_SUFFIX}"
  35. HOMEPAGE="http://gpe.linuxtogo.org"
  36. IUSE="nls"
  37. GPECONF="${GPECONF} --enable-debug=no --disable-debug"
  38. RDEPEND=""
  39. DEPEND="
  40. >=dev-util/intltool-0.29
  41. virtual/pkgconfig"
  42. # @FUNCTION: gpe_src_unpack
  43. # @DESCRIPTION:
  44. # Unpacks and applies some required patches for GPE.
  45. gpe_src_unpack() {
  46. unpack ${A}
  47. cd "${S}"
  48. has "${EAPI:-0}" 0 1 && gpe_src_prepare "$@"
  49. }
  50. # Do not call, use gpe_src_unpack() instead.
  51. gpe_src_prepare() {
  52. # let portage handle stripping.
  53. # sort is needed, see #272161 .
  54. for file in $(find . -name 'Makefile*' | sort) ; do
  55. sed -i -e s/'install -s'/'install'/g \
  56. -e s/'install -Ds'/'install -D'/g \
  57. -e 's/$(INSTALL) -s/$(INSTALL) /g' \
  58. -e 's;strip ;#strip ;g' \
  59. ${file} \
  60. ||die "Sedding ${file} failed."
  61. done
  62. [[ -f configure ]] && elibtoolize
  63. }
  64. # @FUNCTION: gpe_src_configure
  65. # @DESCRIPTION:
  66. # Configures a GPE package in a cross-compile aware environment.
  67. gpe_src_configure() {
  68. tc-export CC
  69. [[ -f configure ]] && econf "$@" ${GPECONF}
  70. }
  71. # @FUNCTION: gpe_src_compile
  72. # @DESCRIPTION:
  73. # (Cross-)Compiles a GPE package.
  74. gpe_src_compile() {
  75. tc-export CC
  76. has "${EAPI:-0}" 0 1 && gpe_src_configure "$@"
  77. emake PREFIX=/usr || die "emake failed"
  78. }
  79. # @FUNCTION: gpe_src_install
  80. # @DESCRIPTION:
  81. # Installs a GPE package in the correct way.
  82. gpe_src_install() {
  83. local use_nls=yes
  84. use nls || use_nls=no
  85. if [ -f configure ]; then
  86. einstall "$@" || die "einstall failed"
  87. else
  88. emake STRIP=true DESTDIR=${D} PREFIX=/usr \
  89. ENABLE_NLS=${use_nls} "$@" install || die "emake install failed"
  90. fi
  91. use nls || rm -rf ${D}/usr/share/locale
  92. # manual document installation
  93. if [[ "${GPE_DOCS}" ]]; then
  94. dodoc ${GPE_DOCS} || die "dodoc failed"
  95. fi
  96. }