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

EAPI=7

inherit elisp-common

DESCRIPTION="GNU Forth is a fast and portable implementation of the ANSI Forth language"
HOMEPAGE="https://www.gnu.org/software/gforth"
SRC_URI="mirror://gnu/gforth/${P}.tar.gz"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~riscv ~x86 ~x86-linux ~ppc-macos ~x64-macos"
IUSE="+check emacs"

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

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

PATCHES=(
	"${FILESDIR}"/${PN}-0.7.0-make-elc.patch
	"${FILESDIR}"/${PN}-0.7.3-rdynamic.patch
	"${FILESDIR}"/${PN}-0.7.3-rdynamic-auto.patch
	"${FILESDIR}"/${PN}-0.7.3-CFLAGS-LDFLAGS.patch
)

src_prepare() {
	default

	# gforth uses both $LIBTOOL and $GNU_LIBTOOL.
	# Let's settle on the former: bug #799371
	if [[ -n $LIBTOOL ]]; then
		export GNU_LIBTOOL=$LIBTOOL
		# ./configure does not generate it, but slibtool assumes
		# it's around
		ln -s "${EPREFIX}"/usr/bin/libtool libtool || die
	fi

	# We patches both configure and configure.ac.
	# Avoid reruining aclocal.
	touch aclocal.m4 configure || die
}

src_configure() {
	econf \
		$(use emacs || echo "--without-lispdir") \
		$(use_with check)
}

src_compile() {
	# Parallel make breaks here
	emake -j1
}

src_install() {
	default

	dodoc AUTHORS BUGS ChangeLog NEWS* README* ToDo doc/glossaries.doc doc/*.ps

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

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

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