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

EAPI="8"

inherit elisp-common flag-o-matic toolchain-funcs

DESCRIPTION="Scheme48 is an implementation of the Scheme Programming Language"
HOMEPAGE="https://www.s48.org/"
SRC_URI="https://www.s48.org/${PV}/${P}.tgz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="doc emacs"

RDEPEND="emacs? ( >=app-editors/emacs-23.1:* )"
DEPEND="${RDEPEND}"

PATCHES=( "${FILESDIR}"/CVE-2014-4150.patch )

SITEFILE="50${PN}-gentoo.el"

src_prepare() {
	default

	append-cflags -fno-strict-aliasing

	sed -i \
		-e "/# Cygwin/,/fi/d" \
		-e "s/\tar /\t$(tc-getAR) /" \
		-e "s/\tranlib/\t$(tc-getRANLIB) /" \
		-e "/\/COPYING/d" \
		-e "/for .*html/,/done/d" \
		Makefile.in
}

src_configure() {
	econf --docdir=/usr/share/doc/${PF}
}

src_compile() {
	default

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

src_install() {
	# weird parallel failures!
	emake -j1 DESTDIR="${D}" install

	if use doc; then
		DOCS=( README doc/*.txt )
		HTML_DOCS=( doc/html/. )
	else
		rm -f "${ED}"/usr/share/doc/${PF}/man*
	fi
	einstalldocs

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

	# this symlink clashes with gambit
	rm "${ED}"/usr/bin/scheme-r5rs || die
}

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

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