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