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