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