noweb-2.11b-r4.ebuild 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # Copyright 1999-2014 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=3
  4. inherit eutils toolchain-funcs elisp-common
  5. DESCRIPTION="a literate programming tool, lighter than web"
  6. HOMEPAGE="http://www.eecs.harvard.edu/~nr/noweb/"
  7. SRC_URI="http://www.eecs.harvard.edu/~nr/noweb/dist/${P}.tgz"
  8. LICENSE="noweb emacs? ( GPL-2 )"
  9. SLOT="0"
  10. KEYWORDS="alpha amd64 hppa ia64 ppc ppc64 sparc x86 ~ppc-macos ~x64-macos ~x86-macos"
  11. IUSE="emacs examples"
  12. DEPEND="virtual/tex-base
  13. dev-lang/icon
  14. sys-apps/debianutils
  15. emacs? ( virtual/emacs )"
  16. RDEPEND=${DEPEND}
  17. S=${WORKDIR}/${P}/src
  18. SITEFILE=50${PN}-gentoo.el
  19. src_prepare() {
  20. # glibc2.10 compat (bug 270757)
  21. # mkdir d && cp -r c/* d/
  22. sed "s:getline (:getline_nonlibc (:" -i c/getline.{c,h} || die
  23. sed "s:getline(:getline_nonlibc(:" -i c/{notangle.c,getline.c,finduses.c} || die
  24. # diff -u d/ c/
  25. epatch "${FILESDIR}"/${PN}-2.9-security.patch
  26. # dont run texhash...
  27. sed -i -e "s/texhash/true/" Makefile
  28. # dont strip...
  29. sed -i -e "s/strip/true/" Makefile
  30. cd "${WORKDIR}/${P}"
  31. epatch "${FILESDIR}"/${P}-recmake.patch
  32. epatch "${FILESDIR}"/${P}-ldflags.patch
  33. }
  34. src_compile() {
  35. # noweb tries to use notangle and noweb; see bug #50429
  36. ( cd c; emake ICONC="icont" CC="$(tc-getCC)" CFLAGS="${CFLAGS}" LIBSRC="icon" ) || die
  37. export PATH="${PATH}:${T}"
  38. emake ICONC="icont" CC="$(tc-getCC)" BIN="${T}" LIB="${T}" LIBSRC="icon" install-code \
  39. || die "make temporal install failed."
  40. emake ICONC="icont" CC="$(tc-getCC)" CFLAGS="${CFLAGS}" LIBSRC="icon" || die "make failed"
  41. # Set awk to awk not nawk
  42. ./awkname awk
  43. if use emacs; then
  44. elisp-compile elisp/noweb-mode.el || die "elisp-compile failed"
  45. fi
  46. }
  47. src_install () {
  48. # It needs the directories to exist first...
  49. dodir /usr/bin
  50. dodir /usr/libexec/${PN}
  51. dodir /usr/share/man
  52. dodir /usr/share/texmf-site/tex/inputs
  53. emake ICONC="icont" \
  54. BIN="${ED}/usr/bin" \
  55. LIBSRC="icon" \
  56. LIBNAME="${EPREFIX}/usr/libexec/${PN}" \
  57. LIB="${ED}/usr/libexec/${PN}" \
  58. MAN="${ED}/usr/share/man" \
  59. TEXNAME="${EPREFIX}/usr/share/texmf-site/tex/inputs" \
  60. TEXINPUTS="${ED}/usr/share/texmf-site/tex/inputs" \
  61. install || die "make install failed"
  62. cd "${WORKDIR}/${P}"
  63. if use examples; then
  64. insinto /usr/share/doc/${PF}/examples
  65. doins examples/*
  66. fi
  67. dodoc CHANGES README
  68. if use emacs; then
  69. elisp-install ${PN} src/elisp/noweb-mode.{el,elc} \
  70. || die "elisp-install failed"
  71. elisp-site-file-install "${FILESDIR}/${SITEFILE}" \
  72. || die "elisp-site-file-install failed"
  73. fi
  74. }
  75. pkg_postinst() {
  76. use emacs && elisp-site-regen
  77. einfo "Running texhash to complete installation.."
  78. texhash
  79. }
  80. pkg_postrm() {
  81. use emacs && elisp-site-regen
  82. }