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