summaryrefslogtreecommitdiff
blob: bbcc4938fdb2d893e12cadacb7e3de23e29e2c32 (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
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit autotools elisp-common flag-o-matic

# C-INTERCAL uses minor-major ordering of version components and
# negative version numbers. We map version components -1, -2, ...
# to 65535, 65534, ..., and subtract one from the next component.
# For example, upstream version 0.28 is mapped to Gentoo version 28.0
# and 0.-2.0.29 is mapped to 28.65535.65534.0.
#get_intercal_version() {
#	local i=.${1:-${PV}} j k c=0
#	while [[ ${i} ]]; do
#		(( k = ${i##*.} + c ))
#		(( (c = (k >= 32768)) && (k -= 65536) ))
#		i=${i%.*}
#		j=${j}.${k}
#	done
#	echo ${j#.}
#}

MY_P="${PN#c-}-$(ver_cut 2).$(ver_cut 1)"
DESCRIPTION="C-INTERCAL - INTERCAL to binary (via C) compiler"
HOMEPAGE="http://www.catb.org/~esr/intercal/
	https://gitlab.com/esr/intercal"
SRC_URI="http://www.catb.org/~esr/intercal/${MY_P}.tar.gz"

LICENSE="GPL-2+ FDL-1.2+"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="emacs examples"

RDEPEND="emacs? ( >=app-editors/emacs-23.1:* )"
BDEPEND="${RDEPEND}
	sys-devel/flex
	virtual/yacc"

S="${WORKDIR}/${MY_P}"
SITEFILE="50${PN}-gentoo.el"

src_prepare() {
	eapply "${FILESDIR}"/${P}-version.patch
	eapply "${FILESDIR}"/${P}-no-common.patch
	eapply_user
	eautoreconf
}

src_configure() {
	append-flags -fno-toplevel-reorder		#722862
	econf
}

src_compile() {
	emake

	if use emacs; then
		elisp-compile etc/intercal.el
	fi
}

src_install() {
	emake DESTDIR="${D}" install
	dodoc BUGS NEWS HISTORY README doc/THEORY.txt

	if use emacs; then
		elisp-install ${PN} etc/intercal.{el,elc}
		elisp-site-file-install "${FILESDIR}/${SITEFILE}"
	fi

	use examples && dodoc -r pit
}

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

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