Add geogebra-4.1.120.0
[shuber-gentoo-overlay.git] / media-gfx / ipe / ipe-7.1.4.ebuild
1 # Distributed under the terms of the GNU General Public License v2
2 # $Header: $
3
4 EAPI=4
5 inherit eutils toolchain-funcs qt4-r2
6
7 DESCRIPTION="Drawing editor for creating figures in PDF or PS formats"
8 HOMEPAGE="http://ipe7.sourceforge.net/"
9 SRC_URI="mirror://sourceforge/ipe7/${PN}/7.1.0/${P}-src.tar.gz"
10
11 LICENSE="GPL-3"
12 SLOT="0"
13 KEYWORDS="~amd64 ~x86"
14 IUSE="highprec"
15
16 RDEPEND="app-text/texlive-core
17 >=dev-lang/lua-5.2
18 media-libs/freetype:2
19 x11-libs/cairo
20 dev-qt/qtcore:4
21 dev-qt/qtgui:4"
22 DEPEND="${RDEPEND}
23 virtual/pkgconfig"
24
25 S="${WORKDIR}/${P}/src"
26 COMMONDIR=/usr/share/ipe/common
27
28 search_urw_fonts() {
29 # colon-separated list of paths
30 local texmfdist="$(kpsewhich -var-value=TEXMFDIST)"
31 # according to TeX directory structure
32 local urwdir=fonts/type1/urw
33 # add colon as field separator
34 local IFS="${IFS}:" dir
35 for dir in ${texmfdist}; do
36 if [[ -d ${dir}/${urwdir} ]]; then
37 URWFONTDIR="${dir}/${urwdir}"
38 return 0
39 fi
40 done
41 return 1
42 }
43
44 src_prepare() {
45 sed -i \
46 -e 's/fpic/fPIC/' \
47 -e 's/moc-qt4/moc/' \
48 -e "s:\$(IPEPREFIX)/lib:\$(IPEPREFIX)/$(get_libdir):g" \
49 config.mak || die
50 sed -i -e 's/install -s/install/' common.mak || die
51
52 if use highprec; then
53 einfo "Adding patch for higher output precision"
54 epatch "${FILESDIR}"/${PN}-outputprecision.patch
55 fi
56 }
57
58 pkg_setup() {
59 if search_urw_fonts; then
60 einfo "URW fonts found in ${URWFONTDIR}"
61 else
62 ewarn "Could not find directory containing URW fonts"
63 ewarn "Ipe will not function properly without them."
64 fi
65 }
66
67 src_compile() {
68 emake \
69 CXX=$(tc-getCXX) \
70 IPEPREFIX="${EPREFIX}/usr" \
71 IPEDOCDIR="${EPREFIX}/usr/share/doc/${PF}/html" \
72 LUA_PACKAGE=lua
73 }
74
75 src_install() {
76 emake install \
77 IPEPREFIX="${EPREFIX}/usr" \
78 IPEDOCDIR="${EPREFIX}/usr/share/doc/${PF}/html" \
79 INSTALL_ROOT="${ED}"
80 dodoc ../{news,readme}.txt
81 doicon ipe/icons/ipe.png
82 make_desktop_entry ipe Ipe ipe
83 # Link style sheets
84 if [ -d $COMMONDIR/styles ]; then
85 einfo "Linking common style sheets from $COMMONDIR"
86 for f in $COMMONDIR/styles/*; do
87 einfo " Linking ${f##*/}"
88 dosym $f usr/share/ipe/${PV}/styles/${f##*/}
89 done
90
91 elog "Style sheets from $COMMONDIR/styles have been symlinked to"
92 elog "the style sheet directory of ${P}. If you add additional"
93 elog "style sheets later to $COMMONDIR/styles you may symlink"
94 elog "them by hand to '/usr/share/ipe/${PV}/styles/'."
95 fi
96 }