summaryrefslogtreecommitdiff
blob: e2912ac4c3a9ac5593f091e945c513f9fbe069d0 (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-lisp/gcl-cvs/gcl-cvs-2.7.0.ebuild,v 1.7 2007/07/22 08:03:17 graaff Exp $

ECVS_AUTH="pserver"
ECVS_SERVER="cvs.savannah.gnu.org:/sources/gcl"
ECVS_MODULE="gcl"
ECVS_BRANCH="HEAD"
ECVS_USER="anonymous"

inherit cvs elisp-common flag-o-matic eutils alternatives

DESCRIPTION="GNU Common Lisp"
HOMEPAGE="http://www.gnu.org/software/gcl/gcl.html"
SRC_URI=""
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
IUSE="emacs readline debug X tk custreloc dlopen gprof doc"
RESTRICT="$RESTRICT strip"

DEPEND=">=app-text/texi2html-1.64
	emacs? ( virtual/emacs )
	X? ( x11-libs/libXt x11-libs/libXext x11-libs/libXmu x11-libs/libXaw )
	readline? ( sys-libs/readline )
	>=dev-libs/gmp-4.1
	doc? ( virtual/tetex )
	tk? ( dev-lang/tk )
	sys-devel/autoconf
	sys-devel/automake
	sys-devel/libtool"

S=${WORKDIR}/${ECVS_MODULE}

src_compile() {
	export SANDBOX_ON="0"
	WANT_AUTOCONF=2.5 autoconf || die

	sed -e "s/gcl-doc/${PF}/g" ${S}/info/makefile > ${T}/makefile
	mv ${T}/makefile ${S}/info/makefile

	local myconfig=""

	# Hardened gcc may automatically use PIE building, which does not
	# work for this package so far

	filter-flags "-fPIC"

	# -fomit-frame-pointer cannot be used with gprof

	if use gprof; then
		filter-flags "-fomit-frame-pointer"
	fi

#	# Unfortunately, we need to override any relocation choices below
#	# while upstream doesn't work with system BFD.	SuSE has the same
#	# problem apparently.

#	if false; then

	# Linking options are enumerated at
	# http://www.gnu.org/software/gcl/RELEASE-2.6.2.html

	local dlopen_config="
		--disable-custreloc
		--enable-dlopen
		--disable-dynsysbfd
		--disable-statsysbfd";

	local bfd_config="
		--disable-custreloc
		--disable-dlopen
		--enable-dynsysbfd
		--disable-statsysbfd";

	local custreloc_config="
		--enable-custreloc
		--disable-dlopen
		--disable-dynsysbfd
		--disable-statsysbfd";

	if use custreloc; then
		case "${ARCH}" in
			x86 | sparc)
				myconfig="${myconfig} ${custreloc_config}";;
			*)
				ewarn "--enable-custreloc is not supported on your architecture (${ARCH})."
				ewarn "Using --enable-dlopen instead."
				myconfig="${myconfig} ${dlopen_config}"

		esac
	elif use dlopen; then
		myconfig="${myconfig} ${dlopen_config}"
	else
		case "${ARCH}" in
			x86 | sparc | ppc | amd64 | s390)
				myconfig="${myconfig} ${bfd_config}";;
			*)
				ewarn "BFD is not supported on your architecture (${ARCH})."
				ewarn "Using --enable-dlopen instead."
				myconfig="${myconfig} ${dlopen_config}";;
		esac
	fi

#	else
#		myconfig="${myconfig}
#		--enable-locbfd
#		--disable-dynsysbfd
#		--disable-statsysbfd"
#	fi

	if use tk; then
		myconfig="${myconfig}
		--enable-tkconfig=/usr/lib
		--enable-tclconfig=/usr/lib"
	fi

	myconfig="
		${myconfig}
		--enable-dynsysgmp
		--enable-ansi
		`use_enable readline readline`
		`use_with X x`
		`use_enable debug debug`
		`use_enable gprof gprof`
		--enable-xdr=no
		--enable-infodir=/usr/share/info
		--enable-emacsdir=/usr/share/emacs/site-lisp/gcl"

	einfo "Configuring with the following: ${myconfig}"
	econf ${myconfig} || die
	make || die
}

src_install() {
	export SANDBOX_ON="0"
	make DESTDIR=${D} install || die
	mv ${D}/usr/lib/gcl-${PV} ${D}/usr/lib/gcl
	doinfo ${D}/usr/lib/gcl/info/*.info*
	rm -rf ${D}/usr/lib/gcl/info
	mv ${D}/default.el elisp/

	if use emacs; then
		mv elisp/add-default.el ${T}/50gcl-gentoo.el
		elisp-site-file-install ${T}/50gcl-gentoo.el
		elisp-install ${PN} elisp/*
		fperms 0644 /usr/share/emacs/site-lisp/gcl/*
	else
		rm -rf ${D}/usr/share/emacs
	fi

	exeinto /usr/bin

	if use tk; then
		newexe ${FILESDIR}/gcl gcl
		dosed "s,@TKVER@,/usr/lib/tk$(source /usr/lib/tkConfig.sh; echo $TK_VERSION),g" \
			/usr/bin/gcl
		dosed /usr/lib/gcl/gcl-tk/gcltksrv
	else
		newexe ${FILESDIR}/gcl.notcltk gcl
	fi

	dosed "s,@SYS@,/usr/lib/gcl/unixport,g" /usr/bin/gcl
	dosed "s,@DIR@,/usr/lib/gcl,g" /usr/bin/gcl

	dodoc readme* RELEASE* ChangeLog* doc/*
	mv ${D}/usr/share/doc/* ${D}/usr/share/doc/${PF}

	find ${D}/usr/lib/gcl/ -type f \( -perm 640 -o -perm 750 \) \
		-exec chmod 0644 '{}' \;
}

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

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