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