a470b9030422475a465af6cf8bae5c9f8ca32883
[shuber-gentoo-overlay.git] / media-gfx / ipe / ipe-7.0.13.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="seamonkey highprec"
18
19 DEPEND="
20 app-text/texlive-core
21 >=dev-lang/lua-5.1
22 >=media-libs/freetype-2.1.8
23 sys-libs/zlib
24 >=x11-libs/cairo-1.8.0
25 >=x11-libs/qt-core-4.5:4
26 >=x11-libs/qt-gui-4.5:4
27 "
28
29 RDEPEND="${DEPEND}
30 !seamonkey? ( || ( www-client/firefox
31 www-client/firefox-bin ) )
32 seamonkey? ( || ( www-client/seamonkey
33 www-client/seamonkey-bin ) )"
34
35 S=${S}/src
36 COMMONDIR=/usr/share/ipe/common
37
38
39 search_urw_fonts() {
40 local texmfdist="$(kpsewhich -var-value=TEXMFDIST)" # colon-separated list of paths
41 local urwdir=fonts/type1/urw # according to TeX directory structure
42 local IFS="${IFS}:" # add colon as field separator
43 for dir in ${texmfdist}; do
44 if [[ -d "${dir}/${urwdir}" ]]; then
45 URWFONTDIR="${dir}/${urwdir}"
46 return 0
47 fi
48 done
49
50 return 1
51 }
52
53 src_prepare() {
54 if use highprec; then
55 einfo "Adding patch for higher output precision"
56 epatch "${FILESDIR}"/${PN}-outputprecision.patch
57 fi
58 }
59
60 pkg_setup() {
61 if search_urw_fonts; then
62 einfo "URW fonts found in ${URWFONTDIR}."
63 else
64 ewarn "Could not find directory containing URW fonts. Ipe will not"
65 ewarn "function properly without them."
66 fi
67 }
68
69 src_compile() {
70 # Ipe's default browser is Firefox
71 local myconf
72 use seamonkey && myconf="IPEBROWSER=seamonkey"
73 # fix detection of lua
74 sed -i -e 's/lua5.1/lua/g' config.mak || die
75 # don't strip installed binaries
76 sed -i -e 's/install -s/install/' common.mak || die
77 # use moc instead of moc-qt4
78 sed -i -e 's/moc-qt4/moc/' config.mak || die
79
80 # -j1, since there are no deps in the Makefiles on libipe
81 emake -j1 CXX=$(tc-getCXX) $myconf IPEPREFIX="/usr" \
82 IPEDOCDIR="/usr/share/doc/${PF}" || die "emake failed"
83 }
84
85 src_install() {
86 emake install IPEPREFIX="/usr" IPEDOCDIR="/usr/share/doc/${PF}" \
87 INSTALL_ROOT="${D}" || die "emake install failed"
88 dodoc ../{news,readme}.txt || die
89
90 # Link style sheets
91 if [ -d $COMMONDIR/styles ]; then
92 einfo "Linking common style sheets from $COMMONDIR"
93 for f in $COMMONDIR/styles/*; do
94 einfo " Linking ${f##*/}"
95 dosym $f usr/share/ipe/${PV}/styles/${f##*/}
96 done
97
98 elog "Style sheets from $COMMONDIR/styles have been symlinked to"
99 elog "the style sheet directory of ${P}. If you add additional"
100 elog "style sheets later to $COMMONDIR/styles you may symlink"
101 elog "them by hand to '/usr/share/ipe/${PV}/styles/'."
102 fi
103 }
104