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

EAPI=5
inherit elisp-common multilib eutils flag-o-matic

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

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

DEPEND="emacs? ( >=app-editors/emacs-23.1:* )"
RDEPEND="${DEPEND}"
SITEFILE=50scheme48-gentoo.el

src_prepare() {
	epatch "${FILESDIR}"/CVE-2014-4150.patch
}

src_configure() {
	append-cflags -fno-strict-aliasing
	econf --docdir=/usr/share/doc/${P}
}

src_compile() {
	emake
	if use emacs; then
		elisp-compile "${S}"/emacs/cmuscheme48.el
	fi
}

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

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

	dodoc README
	if use doc; then
		dodoc doc/*.txt
		docinto src
		dodoc doc/src/*
		pushd "${ED}/usr/share/doc/${P}" > /dev/null
		install -dm755 html
		mv *.html *.css *.gif html/
		popd > /dev/null
	else
		pushd "${ED}/usr/share/doc/${P}" > /dev/null
		rm -f *.html *.css *.gif
		rm -f manu*
		popd > /dev/null
	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
}