summaryrefslogtreecommitdiff
blob: 9e932f1108d9f2f1efb877abf0f5e859db414eb4 (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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header:  $

# Note: Although this ebuild has the approval of the SXEmacs Project,
# it is not an official subset of the project and thus only limited
# support can be offered for this ebuild.

EAPI="4"

inherit eutils flag-o-matic

DESCRIPTION="Text editing and development environment based on XEmacs aimed at stability, features, innovation"
HOMEPAGE="http://www.sxemacs.org/"
SRC_URI="http://downloads.sxemacs.org/releases/${P}.tar.xz
	http://www.malfunction.de/afterstep/files/NeXT_XEmacs.tar.gz"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"

IUSE="X alsa jack pulseaudio oss nas ao gif png jpeg xface tiff ffmpeg mad bdwgc \
	  sndfile sox ssl tls ipv6 pop kerberos hesiod postgresql libffi gmp mpfr magic xpm \
	  athena neXt motif xim canna freewnn gdbm berkdb tty gpm ncurses mule socks \
	  omgoptimize warnfull"

X_DEPEND="x11-libs/libXt x11-libs/libXmu x11-libs/libXext x11-misc/xbitmaps"

# The blockers at the end are because sxemacs has file conflicts with all of
# those packages and blockers are the easiest solution.
DEPEND="virtual/libc
	sys-libs/zlib
	>=media-libs/audiofile-0.2.3
	X? ( $X_DEPEND !neXt? ( x11-libs/libXaw ) )
	alsa? ( media-sound/alsa-headers )
	jack? ( media-sound/jack )
	pulseaudio? ( media-sound/pulseaudio )
	nas? ( media-libs/nas )
	ao? ( >=media-libs/libao-0.8.5 )
	png? ( media-libs/libpng )
	jpeg? ( virtual/jpeg )
	xface? ( media-libs/compface )
	tiff? ( media-libs/tiff )
	ffmpeg? ( media-video/ffmpeg )
	mad? ( media-libs/libmad media-sound/madplay )
	bdwgc? ( dev-libs/boehm-gc )
	sndfile? ( media-libs/libsndfile )
	sox? ( media-sound/sox )
	ssl? ( >=dev-libs/openssl-0.9.8 )
	tls? ( >=net-libs/gnutls-2.0.4 )
	kerberos? ( app-crypt/mit-krb5 )
	hesiod? ( net-dns/hesiod )
	postgresql? ( dev-db/postgresql-base )
	libffi? ( dev-libs/libffi )
	gmp? ( dev-libs/gmp )
	mpfr? ( dev-libs/mpfr )
	athena? ( x11-libs/libXaw )
	neXt? ( x11-libs/neXtaw )
	motif? ( >=x11-libs/motif-2.3:0 )
	canna? ( app-i18n/canna )
	freewnn? ( app-i18n/freewnn )
	gdbm? ( >=sys-libs/gdbm-1.8.3 )
	berkdb? ( sys-libs/db )
	gpm? ( sys-libs/gpm )
	ncurses? ( >=sys-libs/ncurses-5.2 )
	magic? ( sys-apps/file )
	!app-admin/eselect-ctags
	!app-editors/emacs
	!app-editors/emacs-vcs
	!app-editors/xemacs
	!dev-util/ctags"

# app-xemacs/xemacs-base should probably be here but it causes
# app-editors/xemacs to be installed which causes file conflicts
PDEPEND="mule? ( app-xemacs/mule-base )"

pkg_setup() {
	if use libffi ;
	then
		elog "You've elected to build SXEmacs with FFI support."
		elog "This will allow you to view in SXEmacs any image type"
		elog "supported by ImageMagick's libWand."
		elog "It will also allow you to download the initial XE packages"
		elog "from within SXEmacs itself. To do this, use"
		elog "            M-x pui-bootstrap RET"
	fi

	if use bdwgc ;
	then
		ewarn "You've elected to compile SXEmacs with support for the"
		ewarn "Boehm-Demers-Weiser Garbage Collector, or Boehm-GC."
		ewarn "The BDWGC code is still in its infancy, and is known to"
		ewarn "consume larger-than-average amounts of memory in an SXEmacs"
		ewarn "session. You have been warned."
	fi

	ewarn "Note: Although this ebuild has the approval of the SXEmacs Project,"
	ewarn "it is not an official subset of the project and thus only limited"
	ewarn "support can be offered for this ebuild. "
}

src_unpack() {
	unpack ${P}.tar.xz
	use neXt && unpack NeXT_XEmacs.tar.gz
}

src_prepare() {
	use neXt && cp "${WORKDIR}"/NeXT.XEmacs/xemacs-icons/* "${S}"/etc/toolbar/
}

src_configure() {

	#####################################
	# Allow SXEmacs to decide on CFLAGS #
	#####################################
	# Don't know why a higher value won't work on some Gentoo systems, but to be
	# safe and ensure that users don't whinge too much, we'll arbitrate -O2 as
	# the optimisation level.
	# Also work around hardened compiler bugs.
	if use omgoptimize ; then
		echo ""
	else
		replace-flags -O* -O2
	fi
	filter-flags -fomit-frame-pointer -fPIE
	is-flag -nopie && append-flags -nopie

	#################
	# Configuration #
	#################
	local myconf=""

		#######################
		# Configuration for X #
		#######################
		if use X ; then
		myconf="${myconf} --with-widgets=athena"
		myconf="${myconf} --with-dialogs=athena"
		myconf="${myconf} --with-menubars=lucid"
		myconf="${myconf} --with-scrollbars=lucid"
		if use motif ; then
		myconf="--with-widgets=motif"
		myconf="${myconf} --with-dialogs=motif"
		myconf="${myconf} --with-scrollbars=motif"
		myconf="${myconf} --with-menubars=lucid"
		fi
		if use athena ; then
		myconf="--with-scrollbars=athena"
		fi
		if use neXt ; then
		myconf="${myconf} --with-athena=next"
		else
		myconf="${myconf} --with-athena=xaw"
		fi

		else
		myconf="${myconf} --without-x"
		fi

		#########################
		# Configuration for TTY #
		#########################
		local ttyconf=""
		if use tty ; then
		ttyconf="${ttyconf} --with-tty"
		if use tty ; then
		if use ncurses ; then
			ttyconf="${ttyconf} --with-ncurses"
		else
			ttyconf="${ttyconf} --without-ncurses"
		fi
		if use gpm ; then
			ttyconf="${ttyconf} --with-gpm"
		else
			ttyconf="${ttyconf} --without-gpm"
		fi
		fi
		else
		ttyconf="${ttyconf} --without-tty"
		fi
		myconf="${myconf} ${ttyconf}"

		######################
		# MULE Configuration #
		######################
		if use mule ; then
		myconf="${myconf} --with-mule"
		if use xim ; then
		if use motif ; then
			myconf="${myconf} --with-xim=motif"
		else
			myconf="${myconf} --with-xim=xlib"
		fi
		else
		myconf="${myconf} --with-xim=no"
		fi
		use canna && myconf="${myconf} --with-canna"
		use freewnn && myconf="${myconf} --with-wnn"
		else
		myconf="${myconf} --without-mule"
		fi

		#######################
		# Sound Configuration #
		#######################
		local soundconf="none"
		# Define what sound outputs we use
		use alsa && soundconf="${soundconf},alsa"
		use jack && soundconf="${soundconf},jack"
		use oss && soundconf="${soundconf},oss"
		use nas && soundconf="${soundconf},nas"
		use arts && soundconf="${soundconf},arts"
		use ao && soundconf="${soundconf},ao"
		use esd && soundconf="${soundconf},esd"
		# And make them work
		myconf="${myconf} --with-sound=${soundconf}"
		use pulseaudio && myconf="${myconf} --with-pulseaudio"

		########################
		# Images Configuration #
		########################
		local imageconf="none"
		# Define Image Types to support
		use gif && imageconf="${imageconf},gif"
		use png && imageconf="${imageconf},png"
		use jpeg && imageconf="${imageconf},jpeg"
		use xface && imageconf="${imageconf},xface"
		use tiff && imageconf="${imageconf},tiff"
		use xpm && imageconf="${imageconf},xpm"
		# And make them work
		myconf="${myconf} --with-image=${imageconf}"
		# Note - If FFI useflag is set, and ImageMagick is installed, SXEmacs
		# will make use of libWand and can thus display many more types of
		# image.

		##########################
		# Database Configuration #
		##########################
		local mydb="none"
		use gdbm && mydb="${mydb},gdbm"
		use berkdb && mydb="${mydb},berkdb"
		myconf="${myconf} --with-database=${mydb}"
		# and add support for postgre here
		use postgresql && myconf="${myconf} --with-postgresql" || myconf="${myconf} --without-postgresql"

		#######################
		# Media Configuration #
		#######################
		local mediaconf="none,internal"
		# Define Media Types to support
		use ffmpeg && mediaconf="${mediaconf},ffmpeg"
		use mad && mediaconf="${mediaconf},mad"
		use sndfile && mediaconf="${mediaconf},sndfile"
		use magic && mediaconf="${mediaconf},magic"
		use sox && mediaconf="${mediaconf},sox"
		# And make them work
		myconf="${myconf} --with-media=${mediaconf}"

		########################
		# Cryptography Options #
		########################
		local crypto=""
		use ssl && crypto="${crypto} --with-openssl"
		use tls && crypto="${crypto} --with-gnutls"
		myconf="${myconf} ${crypto}"

		############################
		# Networking Configuration #
		############################
		local netconf=""
		use pop && netconf="${netconf} --with-pop" || netconf="${netconf} --without-pop"
		use kerberos && netconf="${netconf} --with-kerberos" || netconf="${netconf} --without-kerberos"
		use hesiod && netconf="${netconf} --with-hesiod"
		use socks && netconf="${netconf} --with-socks"
		myconf="${myconf} ${netconf}"

		#######
		# FFI #
		#######
		use libffi && myconf="${myconf} --with-ffi"

		#########################################
		# Boehm-Demers-Weiser Garbage Collector #
		#########################################
		use bdwgc && myconf="${myconf} --with-experimental-features=all"

		############################
		# Aggressive Optimisations #
		############################
		use omgoptimize && myconf="${myconf} --with-ridiculously-aggressive-optimisations"

		##########################
		# Maximum Warning Output #
		##########################
		use warnfull && myconf="${myconf} --with-maximum-warning-output"

		####################
		# Neat Math Tricks #
		####################
		# I'm going to let SXEmacs do the deciding here.
		# The useflags will simply be for dependencies.
		myconf="${myconf} --with-ent=all --with-ase=all"

		##################
		# Module Support #
		##################
		myconf="${myconf} --with-module-support"
		myconf="${myconf} --with-modules=all"

	########################
	# End of Configuration #
	########################

	###############
	# ./configure #
	###############

	econf ${myconf}
}

src_compile()
{
	#################
	# Build SXEmacs #
	#################

	emake build-report

}

src_install() {
	###################
	# Install SXEmacs #
	###################
	default

	dodir /usr/share/sxemacs-22.1.15/
	dodir /usr/share/sxemacs/xemacs-packages/
	dodir /usr/share/sxemacs/sxemacs-packages/
	dodir /usr/share/sxemacs/site-packages/

	if use mule;
	then
	dodir /usr/share/sxemacs/mule-packages
	fi

	insinto /usr/share/pixmaps
	newins "${S}"/etc/${PN}-icon3.xpm ${PN}.xpm

	insinto /usr/share/applications
	doins "${S}"/etc/${PN}.desktop

}

pkg_postinst() {
	eselect emacs update --if-unset
}

pkg_postrm() {
	eselect emacs update --if-unset
}