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