summaryrefslogtreecommitdiff
blob: f582047527ae1b83c91e4505fbb83181e7eb1393 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{8..10} )

inherit elisp-common distutils-r1

DESCRIPTION="Toolkit for literate programming in Coq"
HOMEPAGE="https://github.com/cpitclaudel/alectryon/"

if [[ "${PV}" == *9999* ]] ; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/cpitclaudel/${PN}.git"
else
	SRC_URI="https://github.com/cpitclaudel/${PN}/archive/v${PV}.tar.gz
			-> ${P}.tar.gz"
	KEYWORDS="~amd64"
fi

LICENSE="MIT"
SLOT="0"
IUSE="doc emacs"

RDEPEND="
	dev-python/beautifulsoup4[${PYTHON_USEDEP}]
	dev-python/docutils[${PYTHON_USEDEP}]
	dev-python/dominate[${PYTHON_USEDEP}]
	dev-python/myst_parser[${PYTHON_USEDEP}]
	dev-python/pygments[${PYTHON_USEDEP}]
	dev-python/sphinx[${PYTHON_USEDEP}]
	sci-mathematics/coq-serapi
"
DEPEND="${RDEPEND}"
BDEPEND="
	emacs? (
		>=app-editors/emacs-23.1:*
		app-emacs/flycheck
		app-emacs/proofgeneral
	)
"

DOCS=( CHANGES.rst CITATION.bib README.rst )
PATCHES=( "${FILESDIR}"/${P}-setup.cfg-version.patch )
SITEFILE="50${PN}-gentoo.el"

src_compile() {
	distutils-r1_src_compile

	use doc && emake -C ./recipes/sphinx latexpdf
	use emacs && elisp-compile ./etc/elisp/alectryon.el
}

src_install() {
	distutils-r1_src_install
	einstalldocs

	if use doc ; then
		docinto html
		dodoc ./recipes/sphinx/_build/html/*
		docinto pdf
		dodoc ./recipes/sphinx/_build/latex/alectryon-demo.pdf
		docinto latex
		dodoc ./recipes/sphinx/_build/latex/alectryon-demo.tex
	fi
	if use emacs ; then
		elisp-install ${PN} ./etc/elisp/${PN}.el{,c}
		elisp-site-file-install "${FILESDIR}/${SITEFILE}"
	fi
}

pkg_postinst() {
	use emacs && elisp-site-regen
}

pkg_postrm() {
	use emacs && elisp-site-regen
}