aboutsummaryrefslogtreecommitdiff
blob: bb79cb1f43a89321c9bfcb8cc04bda92a9581ced (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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI="7"

COMMIT="13e5b90eecc79ec6704efb333c4c100187520e80"
AUTOTOOLS_AUTORECONF=1
AUTOTOOLS_IN_SOURCE_BUILD=1

inherit autotools elisp-common

DESCRIPTION="The Aldor Programming Language"
HOMEPAGE="http://pippijn.github.io/aldor"
SRC_URI="
	https://github.com/pippijn/aldor/archive/${COMMIT}.tar.gz -> ${P}.tar.gz
	doc? ( http://aldor.org/docs/libaldor.pdf.gz )
	emacs? ( http://hemmecke.de/aldor/aldor.el.nw )
"

LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64"

IUSE="doc emacs"

RDEPEND="
	emacs? ( app-editors/emacs:= )
"
DEPEND="
	${RDEPEND}
	virtual/yacc

	doc? ( virtual/latex-base )
	emacs? ( app-text/noweb )
"

S="${WORKDIR}/${PN}-${COMMIT}/aldor"

DOCS=( AUTHORS README.building README.binary-only README.library ../README.md )

src_unpack() {
	unpack "${P}.tar.gz"
	use doc && cp "${DISTDIR}/libaldor.pdf.gz" "${S}" && gunzip "${S}/libaldor.pdf.gz" || die
	use emacs && cp "${DISTDIR}/aldor.el.nw" "${S}" || die
}

src_compile() {
	if use doc ; then
		( cd aldorug; emake aldorug.pdf ) || die "make aldorug.pdf failed"
		( cd lib/aldor/tutorial
			pdflatex tutorial.tex
			pdflatex tutorial.tex ) || die "make tutorial.pdf failed"
		tar xzf "${DISTDIR}/algebra.html.tar.gz"
	fi

	if use emacs ; then
		notangle "aldor.el.nw" > aldor.el
		notangle -Rinit.el "aldor.el.nw" | \
			sed -e '1s/^.*$/;; aldor mode/' > 64aldor-gentoo.el
		if use doc ; then
			einfo "Documentation for the aldor emacs mode"
			noweave "aldor.el.nw" > aldor-mode.tex
			pdflatex aldor-mode.tex
			pdflatex aldor-mode.tex || die "make aldor-mode.pdf failed"
		fi
	fi
	default
}

src_install() {
	if use doc ; then
		DOCS+=( aldorug/aldorug.pdf lib/aldor/tutorial/tutorial.pdf libaldor.pdf )
	fi
	if use emacs ; then
		DOCS+=( aldor-mode.pdf )
		elisp-site-file-install aldor.el
		elisp-site-file-install 64aldor-gentoo.el
	fi
	default

	# Add information about ALDORROOT to environmental variables
	cat > 99aldor <<- EOF
		ALDORROOT="${EPREFIX}/usr"
	EOF
	doenvd 99aldor
}

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

pkg_prerm() {
	[ -f "${SITELISP}/site-gentoo.el" ] && elisp-site-regen
}