Add ipe-7.1.7
[shuber-gentoo-overlay.git] / media-gfx / ipe / ipe-7.1.1.ebuild
1 # Copyright 1999-2010 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI="2"
6 inherit eutils toolchain-funcs qt4-r2
7
8 DESCRIPTION="A drawing editor which creates figures for inclusion in LaTeX documents and makes PDF presentations."
9 HOMEPAGE="http://ipe7.sourceforge.net/"
10 SRC_URI="mirror://sourceforge/ipe7/ipe/${P}-src.tar.gz"
11
12 LICENSE="GPL-3"
13 SLOT="0"
14 KEYWORDS="~amd64 ~x86"
15 RESTRICT="mirror"
16 # highprec: applies patch in order to write coordinates with higher precision
17 IUSE="highprec"
18
19 DEPEND="
20 app-text/texlive-core
21 >=dev-lang/lua-5.1
22 media-libs/freetype:2
23 sys-libs/zlib
24 >=x11-libs/cairo-1.8.0
25 x11-libs/qt-core:4
26 x11-libs/qt-gui:4
27 "
28
29 S=${S}/src
30 COMMONDIR=/usr/share/ipe/common
31
32
33 search_urw_fonts() {
34 local texmfdist="$(kpsewhich -var-value=TEXMFDIST)" # colon-separated list of paths
35 local urwdir=fonts/type1/urw # according to TeX directory structure
36 local IFS="${IFS}:" # add colon as field separator
37 for dir in ${texmfdist}; do
38 if [[ -d "${dir}/${urwdir}" ]]; then
39 URWFONTDIR="${dir}/${urwdir}"
40 return 0
41 fi
42 done
43
44 return 1
45 }
46
47 src_prepare() {
48 if use highprec; then
49 einfo "Adding patch for higher output precision"
50 epatch "${FILESDIR}"/${PN}-outputprecision.patch
51 fi
52 }
53
54 pkg_setup() {
55 if search_urw_fonts; then
56 einfo "URW fonts found in ${URWFONTDIR}."
57 else
58 ewarn "Could not find directory containing URW fonts. Ipe will not"
59 ewarn "function properly without them."
60 fi
61 }
62
63 src_compile() {
64 # fix detection of lua
65 sed -i -e 's/lua5.1/lua/g' config.mak || die
66 # don't strip installed binaries
67 sed -i -e 's/install -s/install/' common.mak || die
68 # use moc instead of moc-qt4
69 sed -i -e 's/moc-qt4/moc/' config.mak || die
70
71 # -j1, since there are no deps in the Makefiles on libipe
72 emake -j1 CXX=$(tc-getCXX) IPEPREFIX="/usr" \
73 IPEDOCDIR="/usr/share/doc/${PF}" || die "emake failed"
74 }
75
76 src_install() {
77 emake install IPEPREFIX="/usr" IPEDOCDIR="/usr/share/doc/${PF}" \
78 INSTALL_ROOT="${D}" || die "emake install failed"
79 dodoc ../{news,readme}.txt || die
80
81 # Link style sheets
82 if [ -d $COMMONDIR/styles ]; then
83 einfo "Linking common style sheets from $COMMONDIR"
84 for f in $COMMONDIR/styles/*; do
85 einfo " Linking ${f##*/}"
86 dosym $f usr/share/ipe/${PV}/styles/${f##*/}
87 done
88
89 elog "Style sheets from $COMMONDIR/styles have been symlinked to"
90 elog "the style sheet directory of ${P}. If you add additional"
91 elog "style sheets later to $COMMONDIR/styles you may symlink"
92 elog "them by hand to '/usr/share/ipe/${PV}/styles/'."
93 fi
94 }
95