summaryrefslogtreecommitdiff
blob: 55a8395b976bb0d14b8a9f58325c87efe2287c74 (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
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-lang/gnu-smalltalk/gnu-smalltalk-2.3.1.ebuild,v 1.5 2008/01/13 23:25:33 araujo Exp $

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

DESCRIPTION="GNU Smalltalk"
HOMEPAGE="http://www.gnu.org/software/smalltalk/smalltalk.html"
SRC_URI="http://ftp.gnu.org/gnu/smalltalk/smalltalk-${PV}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 ~sparc ~x86"
IUSE="tk readline emacs gtk gmp"

DEPEND="sys-libs/gdbm
	sys-apps/debianutils
	emacs? ( virtual/emacs )
	readline? ( sys-libs/readline )
	tk? ( dev-lang/tk )
	gtk? ( =x11-libs/gtk+-2* )
	gmp? ( dev-libs/gmp )"

S="${WORKDIR}/smalltalk-${PV}"

SITEFILE=50gnu-smalltalk-gentoo.el

src_unpack() {
	unpack "${A}"
	epatch "${FILESDIR}/gst-stack-${PV}.patch"
	sed -i "s:\$(DESTDIR)\$(bindir)/gst \$\$srcdir/Finish.st \-VisqS \-a\"\$(DESTDIR)\" \$(MODULES): :" "${S}/Makefile.am"
	sed -i "s:\$(DESTDIR)\$(bindir)/gst \$\$srcdir/Finish.st \-VisqS\-a\"\$(DESTDIR)\" \$(MODULES): :" "${S}/Makefile.in"
	# Fix gst-{load, sunit, reload} script paths.
	sed -i "s: @bindir@:/usr/bin:" "${S}/scripts/Reload.st" "${S}/scripts/Load.st" "${S}/scripts/Test.st"
}

src_compile() {
	replace-flags '-O3' '-O2'
	./configure --prefix=/usr \
		`use_with emacs emacs` \
		`use_with readline readline` \
		`use_with gmp gmp` \
		`use_with tk tcl /usr/$(get_libdir)` \
		`use_with tk tk /usr/$(get_libdir)` \
		`use_enable gtk gtk` \
		|| die
	emake || die "emake failed"
	use emacs && elisp-compile *.el
}

src_install() {
	make prefix="${D}/usr" mandir="${D}/usr/share/man" \
		infodir="${D}/usr/share/info" \
		lispdir="${D}/usr/share/emacs/site-lisp/gnu-smalltalk" install \
		|| die
	rm -rf "${D}/usr/include/sigsegv.h" \
		"${D}/usr/include/snprintfv" \
		"${D}/usr/share/aclocal/snprintfv.m4"
	dodoc AUTHORS COPYING* ChangeLog NEWS README THANKS TODO
	rm -rf "${D}/var"
	if use emacs; then
		elisp-install "${PN}" *.el *.elc
		elisp-site-file-install "${FILESDIR}/${SITEFILE}"
	fi
	fperms 0444 /usr/share/smalltalk/packages.xml
}

pkg_postinst() {
	einfo "We generate a GNU SmallTalk Image with the right image kernel path."
	cd /usr/share/smalltalk/
	/usr/bin/gst -iQ /dev/null
	use emacs && elisp-site-regen
}

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