media-gfx/cgal-ipelets: Add cgal-ipelets-5.2.2-r1
[shuber-gentoo-overlay.git] / media-gfx / ipe / ipe-7.2.24.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 )
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://github.com/otfried/ipe/releases/download/v${PV}/${PN}-${PV}-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="
23 app-text/texlive-core
24 media-libs/freetype:2
25 x11-libs/cairo
26 dev-qt/qtcore:5
27 dev-qt/qtwidgets:5
28 sci-libs/gsl
29 media-libs/libjpeg-turbo
30 media-libs/libpng
31 sys-libs/zlib
32 media-libs/libspiro
33 "
34 DEPEND="${RDEPEND}
35 ${LUA_DEPS}"
36
37 BDEPEND="virtual/pkgconfig"
38
39 S="${WORKDIR}/${P}/src"
40 COMMONDIR=/usr/share/ipe/common
41
42 search_urw_fonts() {
43 # colon-separated list of paths
44 local texmfdist="$(kpsewhich -var-value=TEXMFDIST)"
45 # according to TeX directory structure
46 local urwdir=fonts/type1/urw
47 # add colon as field separator
48 local IFS="${IFS}:" dir
49 for dir in ${texmfdist}; do
50 if [[ -d ${dir}/${urwdir} ]]; then
51 URWFONTDIR="${dir}/${urwdir}"
52 return 0
53 fi
54 done
55 return 1
56 }
57
58 src_prepare() {
59 sed -i \
60 -e 's/fpic/fPIC/' \
61 -e 's_moc_/usr/lib64/qt5/bin/moc_' \
62 -e "s:\$(IPEPREFIX)/lib:\$(IPEPREFIX)/$(get_libdir):g" \
63 config.mak || die
64 sed -i -e 's/install -s/install/' common.mak || die
65
66 if use highprec; then
67 eapply "${FILESDIR}"/${PN}-outputprecision.patch
68 fi
69
70 eapply_user
71 }
72
73 pkg_setup() {
74 lua-single_pkg_setup
75 if search_urw_fonts; then
76 einfo "URW fonts found in ${URWFONTDIR}"
77 else
78 ewarn "Could not find directory containing URW fonts"
79 ewarn "Ipe will not function properly without them."
80 fi
81 }
82
83 src_compile() {
84 emake \
85 CXX=$(tc-getCXX) \
86 IPEPREFIX="${EPREFIX}/usr" \
87 IPEDOCDIR="${EPREFIX}/usr/share/doc/${PF}/html"
88 }
89
90 src_install() {
91 emake install \
92 IPEPREFIX="${EPREFIX}/usr" \
93 IPEDOCDIR="${EPREFIX}/usr/share/doc/${PF}/html" \
94 INSTALL_ROOT="${ED}" \
95 LUA_VERSION="$(lua_get_version)"
96 dodoc ../{news,readme}.txt
97 doicon ipe/icons/ipe.png
98 make_desktop_entry ipe Ipe ipe
99 # Link style sheets
100 if [ -d $COMMONDIR/styles ]; then
101 einfo "Linking common style sheets from $COMMONDIR"
102 for f in $COMMONDIR/styles/*; do
103 einfo " Linking ${f##*/}"
104 dosym $f usr/share/ipe/${PV}/styles/${f##*/}
105 done
106
107 elog "Style sheets from $COMMONDIR/styles have been symlinked to"
108 elog "the style sheet directory of ${P}. If you add additional"
109 elog "style sheets later to $COMMONDIR/styles you may symlink"
110 elog "them by hand to '/usr/share/ipe/${PV}/styles/'."
111 fi
112 }