toolchain-autoconf.eclass 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # @ECLASS: toolchain-autoconf.eclass
  4. # @MAINTAINER:
  5. # <base-system@gentoo.org>
  6. # @BLURB: Common code for sys-devel/autoconf ebuilds
  7. # @DESCRIPTION:
  8. # This eclass contains the common phase functions migrated from
  9. # sys-devel/autoconf eblits.
  10. if [[ -z ${_TOOLCHAIN_AUTOCONF_ECLASS} ]]; then
  11. inherit eutils
  12. EXPORT_FUNCTIONS src_prepare src_configure src_install
  13. toolchain-autoconf_src_prepare() {
  14. find -name Makefile.in -exec sed -i '/^pkgdatadir/s:$:-@VERSION@:' {} + || die
  15. [[ ${#PATCHES[@]} -gt 0 ]] && epatch "${PATCHES[@]}"
  16. }
  17. toolchain-autoconf_src_configure() {
  18. # Disable Emacs in the build system since it is in a separate package.
  19. export EMACS=no
  20. econf --program-suffix="-${PV}" || die
  21. # econf updates config.{sub,guess} which forces the manpages
  22. # to be regenerated which we dont want to do #146621
  23. touch man/*.1
  24. }
  25. # slot the info pages. do this w/out munging the source so we don't have
  26. # to depend on texinfo to regen things. #464146 (among others)
  27. slot_info_pages() {
  28. [[ ${SLOT} == "0" ]] && return
  29. pushd "${ED}"/usr/share/info >/dev/null || die
  30. rm -f dir || die
  31. # Rewrite all the references to other pages.
  32. # before: * aclocal-invocation: (automake)aclocal Invocation. Generating aclocal.m4.
  33. # after: * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation. Generating aclocal.m4.
  34. local p pages=( *.info ) args=()
  35. for p in "${pages[@]/%.info}" ; do
  36. args+=(
  37. -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|"
  38. -e "s:(${p}):(${p}-${SLOT}):g"
  39. )
  40. done
  41. sed -i "${args[@]}" * || die
  42. # Rewrite all the file references, and rename them in the process.
  43. local f d
  44. for f in * ; do
  45. d=${f/.info/-${SLOT}.info}
  46. mv "${f}" "${d}" || die
  47. sed -i -e "s:${f}:${d}:g" * || die
  48. done
  49. popd >/dev/null || die
  50. }
  51. toolchain-autoconf_src_install() {
  52. default
  53. slot_info_pages
  54. }
  55. _TOOLCHAIN_AUTOCONF_ECLASS=1
  56. fi