dev-python/numpydoc: arm64 keyworded (bug #721130)
[gentoo.git] / media-gfx / asymptote / asymptote-2.62.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 PYTHON_COMPAT=( python3_{6,7} )
7
8 inherit autotools elisp-common latex-package python-r1
9
10 DESCRIPTION="A vector graphics language that provides a framework for technical drawing"
11 HOMEPAGE="http://asymptote.sourceforge.net/"
12 SRC_URI="mirror://sourceforge/asymptote/${P}.src.tgz"
13
14 LICENSE="GPL-3"
15 SLOT="0"
16 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos"
17 IUSE="+boehm-gc doc emacs examples fftw gsl +imagemagick latex offscreen +opengl python sigsegv svg test vim-syntax X"
18 RESTRICT="!test? ( test )"
19
20 REQUIRED_USE="
21         ${PYTHON_REQUIRED_USE}
22         offscreen? ( opengl )
23         doc? ( boehm-gc )"
24
25 RDEPEND="
26         >=sys-libs/ncurses-5.4-r5:0=
27         >=sys-libs/readline-4.3-r5:0=
28         imagemagick? ( media-gfx/imagemagick[png] )
29         opengl? ( media-libs/mesa[X(+)] media-libs/freeglut media-libs/glew:0 media-libs/glm )
30         offscreen? ( media-libs/mesa[osmesa] )
31         svg? ( app-text/dvisvgm )
32         sigsegv? ( dev-libs/libsigsegv )
33         boehm-gc? ( >=dev-libs/boehm-gc-7.0[cxx,threads] )
34         fftw? ( >=sci-libs/fftw-3.0.1 )
35         gsl? ( sci-libs/gsl )
36         python? ( ${PYTHON_DEPS} )
37         X? (
38                 ${PYTHON_DEPS}
39                 dev-python/PyQt5[${PYTHON_USEDEP},gui,widgets,svg]
40                 dev-python/numpy
41                 dev-python/pycson
42                 >=gnome-base/librsvg-2.40
43                 )
44         latex? (
45                 virtual/latex-base
46                 >=dev-texlive/texlive-latexextra-2013
47                 )
48         emacs? ( >=app-editors/emacs-23.1:* )
49         vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )"
50 DEPEND="${RDEPEND}
51         doc? (
52                 dev-lang/perl
53                 media-gfx/imagemagick[png]
54                 virtual/texi2dvi
55                 virtual/latex-base
56                 app-text/ghostscript-gpl )
57         test? ( app-text/ghostscript-gpl )"
58
59 TEXMF=/usr/share/texmf-site
60
61 PATCHES=(
62         # Changing pdf, ps, image viewers to xdg-open
63         "${FILESDIR}/${P}-xdg-utils.patch"
64
65         # Bug #322473
66         "${FILESDIR}/${P}-info.patch"
67 )
68
69 src_prepare() {
70         sed -e "s:Datadir/doc/asymptote:Datadir/doc/${PF}:" \
71                 -i configure.ac \
72                 || die "sed configure.ac failed"
73
74         default
75         eautoreconf
76 }
77
78 src_configure() {
79         # for the CPPFLAGS see
80         # https://sourceforge.net/forum/forum.php?thread_id=1683277&forum_id=409349
81         econf \
82                 CPPFLAGS=-DHAVE_SYS_TYPES_H \
83                 CFLAGS="${CXXFLAGS}" \
84                 --disable-gc-debug \
85                 $(use_enable boehm-gc gc system) \
86                 $(use_enable fftw) \
87                 $(use_enable gsl) \
88                 $(use_enable opengl gl) \
89                 $(use_enable offscreen) \
90                 $(use_enable sigsegv)
91 }
92
93 src_compile() {
94         default
95
96         cd doc || die
97         emake asy.1
98         if use doc; then
99                 # info
100                 einfo "Making info"
101                 emake ${PN}.info
102                 cd FAQ || die
103                 emake
104                 cd .. || die
105                 # pdf
106                 einfo "Making pdf docs"
107                 export VARTEXFONTS="${T}"/fonts
108                 # see bug #260606
109                 emake -j1 asymptote.pdf
110                 emake CAD.pdf
111         fi
112         cd .. || die
113
114         if use emacs; then
115                 einfo "Compiling emacs lisp files"
116                 elisp-compile base/*.el
117         fi
118 }
119
120 src_install() {
121         # the program
122         dobin asy
123
124         # .asy files
125         insinto /usr/share/${PN}
126         doins base/*.asy
127
128         # documentation
129         dodoc BUGS ChangeLog README ReleaseNotes TODO
130         doman doc/asy.1
131
132         # X GUI
133         if use X; then
134                 insinto /usr/share/${PN}
135                 doins -r GUI
136                 chmod +x "${D}"/usr/share/${PN}/GUI/xasy.py
137                 dosym ../share/${PN}/GUI/xasy.py /usr/bin/xasy
138                 doman doc/xasy.1x
139         fi
140
141         # examples
142         if use examples; then
143                 insinto /usr/share/${PN}/examples
144                 doins \
145                         examples/*.asy \
146                         doc/*.asy \
147                         doc/*.csv \
148                         doc/*.dat \
149                         doc/extra/*.asy
150                 insinto /usr/share/${PN}/examples/animations
151                 doins examples/animations/*.asy
152         fi
153
154         # LaTeX style
155         if use latex; then
156                 cd doc || die
157                 insinto "${TEXMF}"/tex/latex/${PN}
158                 doins ${PN}.sty asycolors.sty
159                 if use examples; then
160                         insinto /usr/share/${PN}/examples
161                         doins latexusage.tex
162                         insinto /usr/share/${PN}/examples/animations
163                         doins ../examples/animations/*.tex
164                 fi
165                 cd .. || die
166         fi
167
168         # asymptote.py
169         if use python; then
170                 python_foreach_impl python_domodule base/${PN}.py
171         fi
172
173         # emacs mode
174         if use emacs; then
175                 elisp-install ${PN} base/*.el base/*.elc
176                 elisp-site-file-install "${FILESDIR}"/64${PN}-gentoo.el
177         fi
178
179         # vim syntax
180         if use vim-syntax; then
181                 insinto /usr/share/vim/vimfiles/syntax
182                 doins base/asy.vim
183                 insinto /usr/share/vim/vimfiles/ftdetect
184                 doins "${FILESDIR}"/asy-ftd.vim
185         fi
186
187         # extra documentation
188         if use doc; then
189                 cd doc || die
190                 doinfo ${PN}.info*
191                 dodoc ${PN}.pdf CAD.pdf
192                 cd FAQ || die
193                 dodoc asy-faq.ascii
194                 doinfo asy-faq.info
195                 docinto html/FAQ
196                 dodoc asy-faq.html/*
197         fi
198 }
199
200 pkg_postinst() {
201         use latex && latex-package_rehash
202         use emacs && elisp-site-regen
203
204         elog 'Use the variable ASYMPTOTE_PSVIEWER to set the postscript viewer'
205         elog 'Use the variable ASYMPTOTE_PDFVIEWER to set the PDF viewer'
206 }
207
208 pkg_postrm() {
209         use latex && latex-package_rehash
210         use emacs && elisp-site-regen
211 }