Gentoo Archives: gentoo-commits

From: "Ulrich Mueller (ulm)" <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in app-editors/emacs-vcs: ChangeLog emacs-vcs-24.0.92-r1.ebuild emacs-vcs-23.3.9999-r1.ebuild emacs-vcs-23.3.9999.ebuild emacs-vcs-24.0.91.ebuild emacs-vcs-24.0.92.ebuild
Date: Mon, 09 Jan 2012 12:59:36
Message-Id: 20120109125924.D7CC320034@flycatcher.gentoo.org
1 ulm 12/01/09 12:59:24
2
3 Modified: ChangeLog
4 Added: emacs-vcs-24.0.92-r1.ebuild
5 emacs-vcs-23.3.9999-r1.ebuild
6 Removed: emacs-vcs-23.3.9999.ebuild emacs-vcs-24.0.91.ebuild
7 emacs-vcs-24.0.92.ebuild
8 Log:
9 Fix security flaw in EDE, bug 398227. Unchanged revbump for emacs-23 live
10 ebuild, so that users will pick up the fix. The bzr trunk doesn't contain
11 the bugfix yet, so its ebuild will follow later.
12
13 (Portage version: 2.1.10.44/cvs/Linux x86_64)
14
15 Revision Changes Path
16 1.75 app-editors/emacs-vcs/ChangeLog
17
18 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-editors/emacs-vcs/ChangeLog?rev=1.75&view=markup
19 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-editors/emacs-vcs/ChangeLog?rev=1.75&content-type=text/plain
20 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-editors/emacs-vcs/ChangeLog?r1=1.74&r2=1.75
21
22 Index: ChangeLog
23 ===================================================================
24 RCS file: /var/cvsroot/gentoo-x86/app-editors/emacs-vcs/ChangeLog,v
25 retrieving revision 1.74
26 retrieving revision 1.75
27 diff -u -r1.74 -r1.75
28 --- ChangeLog 8 Jan 2012 21:29:32 -0000 1.74
29 +++ ChangeLog 9 Jan 2012 12:59:24 -0000 1.75
30 @@ -1,6 +1,16 @@
31 # ChangeLog for app-editors/emacs-vcs
32 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
33 -# $Header: /var/cvsroot/gentoo-x86/app-editors/emacs-vcs/ChangeLog,v 1.74 2012/01/08 21:29:32 ulm Exp $
34 +# $Header: /var/cvsroot/gentoo-x86/app-editors/emacs-vcs/ChangeLog,v 1.75 2012/01/09 12:59:24 ulm Exp $
35 +
36 +*emacs-vcs-24.0.92-r1 (09 Jan 2012)
37 +*emacs-vcs-23.3.9999-r1 (09 Jan 2012)
38 +
39 + 09 Jan 2012; Ulrich Mueller <ulm@g.o> -emacs-vcs-23.3.9999.ebuild,
40 + +emacs-vcs-23.3.9999-r1.ebuild, -emacs-vcs-24.0.91.ebuild,
41 + -emacs-vcs-24.0.92.ebuild, +emacs-vcs-24.0.92-r1.ebuild:
42 + Fix security flaw in EDE, bug 398227. Unchanged revbump for emacs-23 live
43 + ebuild, so that users will pick up the fix. The bzr trunk doesn't contain
44 + the bugfix yet, so its ebuild will follow later.
45
46 08 Jan 2012; Ulrich Müller <ulm@g.o> emacs-vcs-23.3.9999.ebuild,
47 emacs-vcs-24.0.91.ebuild, emacs-vcs-24.0.92.ebuild,
48
49
50
51 1.1 app-editors/emacs-vcs/emacs-vcs-24.0.92-r1.ebuild
52
53 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-editors/emacs-vcs/emacs-vcs-24.0.92-r1.ebuild?rev=1.1&view=markup
54 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-editors/emacs-vcs/emacs-vcs-24.0.92-r1.ebuild?rev=1.1&content-type=text/plain
55
56 Index: emacs-vcs-24.0.92-r1.ebuild
57 ===================================================================
58 # Copyright 1999-2012 Gentoo Foundation
59 # Distributed under the terms of the GNU General Public License v2
60 # $Header: /var/cvsroot/gentoo-x86/app-editors/emacs-vcs/emacs-vcs-24.0.92-r1.ebuild,v 1.1 2012/01/09 12:59:24 ulm Exp $
61
62 EAPI=4
63
64 inherit autotools elisp-common eutils flag-o-matic multilib
65
66 if [[ ${PV##*.} = 9999 ]]; then
67 EBZR_PROJECT="emacs"
68 EBZR_BRANCH="trunk"
69 EBZR_REPO_URI="bzr://bzr.savannah.gnu.org/emacs/${EBZR_BRANCH}/"
70 # "Nosmart" is much faster for initial branching.
71 EBZR_INITIAL_URI="nosmart+${EBZR_REPO_URI}"
72 inherit bzr
73 SRC_URI=""
74 else
75 # emacs-23.3 patchball added for EDE security fix #398227
76 SRC_URI="mirror://gentoo/emacs-${PV}.tar.gz
77 ftp://alpha.gnu.org/gnu/emacs/pretest/emacs-${PV}.tar.gz
78 mirror://gentoo/emacs-23.3-patches-4.tar.bz2"
79 # FULL_VERSION keeps the full version number, which is needed in
80 # order to determine some path information correctly for copy/move
81 # operations later on
82 FULL_VERSION="${PV%%_*}"
83 S="${WORKDIR}/emacs-${FULL_VERSION}"
84 fi
85
86 DESCRIPTION="The extensible, customizable, self-documenting real-time display editor"
87 HOMEPAGE="http://www.gnu.org/software/emacs/"
88
89 LICENSE="GPL-3 FDL-1.3 BSD as-is MIT W3C unicode PSF-2"
90 SLOT="24"
91 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos"
92 IUSE="alsa athena dbus gconf gif gnutls gpm gsettings gtk gtk3 gzip-el hesiod imagemagick jpeg kerberos libxml2 m17n-lib motif png selinux sound source svg tiff toolkit-scroll-bars wide-int X Xaw3d xft +xpm"
93
94 RDEPEND="sys-libs/ncurses
95 >=app-admin/eselect-emacs-1.2
96 net-libs/liblockfile
97 hesiod? ( net-dns/hesiod )
98 kerberos? ( virtual/krb5 )
99 alsa? ( media-libs/alsa-lib )
100 gpm? ( sys-libs/gpm )
101 dbus? ( sys-apps/dbus )
102 gnutls? ( net-libs/gnutls )
103 libxml2? ( >=dev-libs/libxml2-2.2.0 )
104 selinux? ( sys-libs/libselinux )
105 X? (
106 x11-libs/libXmu
107 x11-libs/libXt
108 x11-misc/xbitmaps
109 gconf? ( >=gnome-base/gconf-2.26.2 )
110 gsettings? ( >=dev-libs/glib-2.28.6 )
111 gif? ( media-libs/giflib )
112 jpeg? ( virtual/jpeg )
113 png? ( >=media-libs/libpng-1.4:0 )
114 svg? ( >=gnome-base/librsvg-2.0 )
115 tiff? ( media-libs/tiff )
116 xpm? ( x11-libs/libXpm )
117 imagemagick? ( >=media-gfx/imagemagick-6.6.2 )
118 xft? (
119 media-libs/fontconfig
120 media-libs/freetype
121 x11-libs/libXft
122 m17n-lib? (
123 >=dev-libs/libotf-0.9.4
124 >=dev-libs/m17n-lib-1.5.1
125 )
126 )
127 gtk? (
128 gtk3? ( x11-libs/gtk+:3 )
129 !gtk3? ( x11-libs/gtk+:2 )
130 )
131 !gtk? (
132 Xaw3d? ( x11-libs/libXaw3d )
133 !Xaw3d? (
134 athena? ( x11-libs/libXaw )
135 !athena? ( motif? ( >=x11-libs/openmotif-2.3:0 ) )
136 )
137 )
138 )"
139
140 DEPEND="${RDEPEND}
141 alsa? ( dev-util/pkgconfig )
142 dbus? ( dev-util/pkgconfig )
143 gnutls? ( dev-util/pkgconfig )
144 libxml2? ( dev-util/pkgconfig )
145 X? ( dev-util/pkgconfig )
146 gzip-el? ( app-arch/gzip )"
147
148 RDEPEND="${RDEPEND}
149 >=app-emacs/emacs-common-gentoo-1.3[X?]"
150
151 EMACS_SUFFIX="emacs-${SLOT}"
152 SITEFILE="20${PN}-${SLOT}-gentoo.el"
153
154 src_prepare() {
155 if [[ ${PV##*.} = 9999 ]]; then
156 FULL_VERSION=$(sed -n 's/^AC_INIT(emacs,[ \t]*\([^ \t,)]*\).*/\1/p' \
157 configure.in)
158 [[ ${FULL_VERSION} ]] || die "Cannot determine current Emacs version"
159 einfo "Emacs branch: ${EBZR_BRANCH}"
160 einfo "Revision: ${EBZR_REVISION:-${EBZR_REVNO}}"
161 einfo "Emacs version number: ${FULL_VERSION}"
162 [[ ${FULL_VERSION} =~ ^${PV%.*}(\..*)?$ ]] \
163 || die "Upstream version number changed to ${FULL_VERSION}"
164 fi
165
166 epatch "${WORKDIR}"/patch/08_all_ede_security_fix.patch #398227
167
168 if ! use alsa; then
169 # ALSA is detected even if not requested by its USE flag.
170 # Suppress it by supplying pkg-config with a wrong library name.
171 sed -i -e "/ALSA_MODULES=/s/alsa/DiSaBlEaLsA/" configure.in \
172 || die "unable to sed configure.in"
173 fi
174 if ! use gzip-el; then
175 # Emacs' build system automatically detects the gzip binary and
176 # compresses el files. We don't want that so confuse it with a
177 # wrong binary name
178 sed -i -e "s/ gzip/ PrEvEnTcOmPrEsSiOn/" configure.in \
179 || die "unable to sed configure.in"
180 fi
181
182 AT_M4DIR=m4 eautoreconf
183 }
184
185 src_configure() {
186 ALLOWED_FLAGS=""
187 strip-flags
188
189 if use sh; then
190 replace-flags -O[1-9] -O0 #262359
191 elif use ia64; then
192 replace-flags -O[2-9] -O1 #325373
193 else
194 replace-flags -O[3-9] -O2
195 fi
196
197 local myconf
198
199 if use alsa && ! use sound; then
200 einfo "Although sound USE flag is disabled you chose to have alsa,"
201 einfo "so sound is switched on anyway."
202 myconf="${myconf} --with-sound"
203 else
204 myconf="${myconf} $(use_with sound)"
205 fi
206
207 if use X; then
208 myconf="${myconf} --with-x"
209 myconf="${myconf} $(use_with gconf)"
210 myconf="${myconf} $(use_with gsettings)"
211 myconf="${myconf} $(use_with toolkit-scroll-bars)"
212 myconf="${myconf} $(use_with wide-int)"
213 myconf="${myconf} $(use_with gif) $(use_with jpeg)"
214 myconf="${myconf} $(use_with png) $(use_with svg rsvg)"
215 myconf="${myconf} $(use_with tiff) $(use_with xpm)"
216 myconf="${myconf} $(use_with imagemagick)"
217
218 if use xft; then
219 myconf="${myconf} --with-xft"
220 myconf="${myconf} $(use_with m17n-lib libotf)"
221 myconf="${myconf} $(use_with m17n-lib m17n-flt)"
222 else
223 myconf="${myconf} --without-xft"
224 myconf="${myconf} --without-libotf --without-m17n-flt"
225 use m17n-lib && ewarn \
226 "USE flag \"m17n-lib\" has no effect if \"xft\" is not set."
227 fi
228
229 if use gtk; then
230 einfo "Configuring to build with GIMP Toolkit (GTK+)"
231 myconf="${myconf} --with-x-toolkit=$(usev gtk3 || echo gtk)"
232 elif use Xaw3d || use athena; then
233 einfo "Configuring to build with Athena/Lucid toolkit"
234 myconf="${myconf} --with-x-toolkit=lucid $(use_with Xaw3d xaw3d)"
235 elif use motif; then
236 einfo "Configuring to build with Motif toolkit"
237 myconf="${myconf} --with-x-toolkit=motif"
238 else
239 einfo "Configuring to build with no toolkit"
240 myconf="${myconf} --with-x-toolkit=no"
241 fi
242
243 local f tk=
244 for f in gtk Xaw3d athena motif; do
245 use ${f} || continue
246 [[ ${tk} ]] \
247 && ewarn "USE flag \"${f}\" ignored (superseded by \"${tk}\")"
248 tk="${tk}${tk:+ }${f}"
249 done
250 else
251 myconf="${myconf} --without-x"
252 fi
253
254 if [[ ${PV##*.} = 9999 ]]; then
255 # These variables are not needed for building. We add them to
256 # configure options because they are stored in the Emacs binary
257 # and available in variable "system-configuration-options".
258 myconf="${myconf} EBZR_BRANCH=${EBZR_BRANCH} EBZR_REVNO=${EBZR_REVNO}"
259 fi
260
261 # According to configure, this option is only used for GNU/Linux
262 # (x86_64 and s390). For Gentoo Prefix we have to explicitly spell
263 # out the location because $(get_libdir) does not necessarily return
264 # something that matches the host OS's libdir naming (e.g. RHEL).
265 local crtdir=$($(tc-getCC) -print-file-name=crt1.o)
266 crtdir=${crtdir%/*}
267
268 econf \
269 --program-suffix=-${EMACS_SUFFIX} \
270 --infodir="${EPREFIX}"/usr/share/info/${EMACS_SUFFIX} \
271 --enable-locallisppath="${EPREFIX}/etc/emacs:${EPREFIX}${SITELISP}" \
272 --with-crt-dir="${crtdir}" \
273 --with-gameuser="${GAMES_USER_DED:-games}" \
274 --without-compress-info \
275 --disable-maintainer-mode \
276 $(use_with hesiod) \
277 $(use_with kerberos) $(use_with kerberos kerberos5) \
278 $(use_with gpm) \
279 $(use_with dbus) \
280 $(use_with gnutls) \
281 $(use_with libxml2 xml2) \
282 $(use_with selinux) \
283 ${myconf}
284 }
285
286 src_compile() {
287 export SANDBOX_ON=0 # for the unbelievers, see Bug #131505
288 if [[ ${PV##*.} = 9999 ]]; then
289 emake CC="$(tc-getCC)" bootstrap
290 # cleanup, otherwise emacs will be dumped again in src_install
291 (cd src; emake versionclean)
292 fi
293 # set last component of emacs-version to (package revision + 1)
294 touch src/emacs-${FULL_VERSION}.${PR#r}
295 emake CC="$(tc-getCC)"
296 }
297
298 src_install () {
299 local i m
300
301 emake install DESTDIR="${D}"
302
303 rm "${ED}"/usr/bin/emacs-${FULL_VERSION}-${EMACS_SUFFIX} \
304 || die "removing duplicate emacs executable failed"
305 mv "${ED}"/usr/bin/emacs-${EMACS_SUFFIX} "${ED}"/usr/bin/${EMACS_SUFFIX} \
306 || die "moving Emacs executable failed"
307
308 # move man pages to the correct place
309 for m in "${ED}"/usr/share/man/man1/* ; do
310 mv "${m}" "${m%.1}-${EMACS_SUFFIX}.1" || die "mv man failed"
311 done
312
313 # move info dir to avoid collisions with the dir file generated by portage
314 mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{,.orig} \
315 || die "moving info dir failed"
316 touch "${ED}"/usr/share/info/${EMACS_SUFFIX}/.keepinfodir
317 docompress -x /usr/share/info/${EMACS_SUFFIX}/dir.orig
318
319 # avoid collision between slots, see bug #169033 e.g.
320 rm "${ED}"/usr/share/emacs/site-lisp/subdirs.el
321 rm -rf "${ED}"/usr/share/{applications,icons}
322 rm "${ED}"/var/lib/games/emacs/{snake,tetris}-scores
323 keepdir /var/lib/games/emacs
324
325 # remove unused <version>/site-lisp dir
326 rm -rf "${ED}"/usr/share/emacs/${FULL_VERSION}/site-lisp
327
328 local c=";;"
329 if use source; then
330 insinto /usr/share/emacs/${FULL_VERSION}/src
331 # This is not meant to install all the source -- just the
332 # C source you might find via find-function
333 doins src/*.{c,h,m}
334 doins -r src/{m,s}
335 rm "${ED}"/usr/share/emacs/${FULL_VERSION}/src/{m,s}/README
336 c=""
337 fi
338
339 sed 's/^X//' >"${T}/${SITEFILE}" <<-EOF
340 X
341 ;;; ${PN}-${SLOT} site-lisp configuration
342 X
343 (when (string-match "\\\\\`${FULL_VERSION//./\\\\.}\\\\>" emacs-version)
344 X ${c}(setq find-function-C-source-directory
345 X ${c} "${EPREFIX}/usr/share/emacs/${FULL_VERSION}/src")
346 X (let ((path (getenv "INFOPATH"))
347 X (dir "${EPREFIX}/usr/share/info/${EMACS_SUFFIX}")
348 X (re "\\\\\`${EPREFIX}/usr/share/info\\\\>"))
349 X (and path
350 X ;; move Emacs Info dir before anything else in /usr/share/info
351 X (let* ((p (cons nil (split-string path ":" t))) (q p))
352 X (while (and (cdr q) (not (string-match re (cadr q))))
353 X (setq q (cdr q)))
354 X (setcdr q (cons dir (delete dir (cdr q))))
355 X (setq Info-directory-list (prune-directory-list (cdr p)))))))
356 EOF
357 elisp-site-file-install "${T}/${SITEFILE}" || die
358
359 dodoc README BUGS
360 }
361
362 pkg_preinst() {
363 # move Info dir file to correct name
364 local infodir=/usr/share/info/${EMACS_SUFFIX} f
365 if [[ -f ${ED}${infodir}/dir.orig ]]; then
366 mv "${ED}"${infodir}/dir{.orig,} || die "moving info dir failed"
367 else
368 # this should not happen in EAPI 4
369 ewarn "Regenerating Info directory index in ${infodir} ..."
370 rm -f "${ED}"${infodir}/dir{,.*}
371 for f in "${ED}"${infodir}/*; do
372 if [[ ${f##*/} != *-[0-9]* && -e ${f} ]]; then
373 install-info --info-dir="${ED}"${infodir} "${f}" \
374 || die "install-info failed"
375 fi
376 done
377 fi
378 }
379
380 pkg_postinst() {
381 local f
382 for f in "${EROOT}"/var/lib/games/emacs/{snake,tetris}-scores; do
383 [[ -e ${f} ]] || touch "${f}"
384 done
385 chown "${GAMES_USER_DED:-games}" "${EROOT}"/var/lib/games/emacs
386
387 elisp-site-regen
388 eselect emacs update ifunset
389
390 if use X; then
391 elog "You need to install some fonts for Emacs."
392 elog "Installing media-fonts/font-adobe-{75,100}dpi on the X server's"
393 elog "machine would satisfy basic Emacs requirements under X11."
394 elog "See also http://www.gentoo.org/proj/en/lisp/emacs/xft.xml"
395 elog "for how to enable anti-aliased fonts."
396 elog
397 fi
398
399 elog "You can set the version to be started by /usr/bin/emacs through"
400 elog "the Emacs eselect module, which also redirects man and info pages."
401 elog "Therefore, several Emacs versions can be installed at the same time."
402 elog "\"man emacs.eselect\" for details."
403 elog
404 elog "If you upgrade from a previous major version of Emacs, then it is"
405 elog "strongly recommended that you use app-admin/emacs-updater to rebuild"
406 elog "all byte-compiled elisp files of the installed Emacs packages."
407 }
408
409 pkg_postrm() {
410 elisp-site-regen
411 eselect emacs update ifunset
412 }
413
414
415
416 1.1 app-editors/emacs-vcs/emacs-vcs-23.3.9999-r1.ebuild
417
418 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-editors/emacs-vcs/emacs-vcs-23.3.9999-r1.ebuild?rev=1.1&view=markup
419 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-editors/emacs-vcs/emacs-vcs-23.3.9999-r1.ebuild?rev=1.1&content-type=text/plain
420
421 Index: emacs-vcs-23.3.9999-r1.ebuild
422 ===================================================================
423 # Copyright 1999-2012 Gentoo Foundation
424 # Distributed under the terms of the GNU General Public License v2
425 # $Header: /var/cvsroot/gentoo-x86/app-editors/emacs-vcs/emacs-vcs-23.3.9999-r1.ebuild,v 1.1 2012/01/09 12:59:24 ulm Exp $
426
427 EAPI=4
428 WANT_AUTOMAKE="none"
429
430 inherit autotools elisp-common eutils flag-o-matic multilib
431
432 if [[ ${PV##*.} = 9999 ]]; then
433 EBZR_PROJECT="emacs"
434 EBZR_BRANCH="emacs-23"
435 EBZR_REPO_URI="bzr://bzr.savannah.gnu.org/emacs/${EBZR_BRANCH}/"
436 # "Nosmart" is much faster for initial branching.
437 EBZR_INITIAL_URI="nosmart+${EBZR_REPO_URI}"
438 inherit bzr
439 SRC_URI=""
440 else
441 SRC_URI="mirror://gentoo/emacs-${PV}.tar.gz
442 ftp://alpha.gnu.org/gnu/emacs/pretest/emacs-${PV}.tar.gz"
443 # FULL_VERSION keeps the full version number, which is needed in
444 # order to determine some path information correctly for copy/move
445 # operations later on
446 FULL_VERSION="${PV%%_*}"
447 S="${WORKDIR}/emacs-${FULL_VERSION}"
448 fi
449
450 DESCRIPTION="The extensible, customizable, self-documenting real-time display editor"
451 HOMEPAGE="http://www.gnu.org/software/emacs/"
452
453 LICENSE="GPL-3 FDL-1.3 BSD as-is MIT W3C unicode PSF-2"
454 SLOT="23"
455 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
456 IUSE="alsa athena dbus gconf gif gpm gtk gzip-el hesiod jpeg kerberos m17n-lib motif png sound source svg tiff toolkit-scroll-bars X Xaw3d xft +xpm"
457
458 RDEPEND="sys-libs/ncurses
459 >=app-admin/eselect-emacs-1.2
460 net-libs/liblockfile
461 hesiod? ( net-dns/hesiod )
462 kerberos? ( virtual/krb5 )
463 alsa? ( media-libs/alsa-lib )
464 gpm? ( sys-libs/gpm )
465 dbus? ( sys-apps/dbus )
466 X? (
467 x11-libs/libXmu
468 x11-libs/libXt
469 x11-misc/xbitmaps
470 gconf? ( >=gnome-base/gconf-2.26.2 )
471 gif? ( media-libs/giflib )
472 jpeg? ( virtual/jpeg )
473 png? ( >=media-libs/libpng-1.4:0 )
474 svg? ( >=gnome-base/librsvg-2.0 )
475 tiff? ( media-libs/tiff )
476 xpm? ( x11-libs/libXpm )
477 xft? (
478 media-libs/fontconfig
479 media-libs/freetype
480 x11-libs/libXft
481 m17n-lib? (
482 >=dev-libs/libotf-0.9.4
483 >=dev-libs/m17n-lib-1.5.1
484 )
485 )
486 gtk? ( x11-libs/gtk+:2 )
487 !gtk? (
488 Xaw3d? ( x11-libs/libXaw3d )
489 !Xaw3d? (
490 athena? ( x11-libs/libXaw )
491 !athena? ( motif? ( >=x11-libs/openmotif-2.3:0 ) )
492 )
493 )
494 )"
495
496 DEPEND="${RDEPEND}
497 alsa? ( dev-util/pkgconfig )
498 dbus? ( dev-util/pkgconfig )
499 X? ( dev-util/pkgconfig )
500 gzip-el? ( app-arch/gzip )"
501
502 RDEPEND="${RDEPEND}
503 >=app-emacs/emacs-common-gentoo-1.3[X?]"
504
505 EMACS_SUFFIX="emacs-${SLOT}-vcs"
506 SITEFILE="20${PN}-${SLOT}-gentoo.el"
507
508 src_prepare() {
509 if [[ ${PV##*.} = 9999 ]]; then
510 FULL_VERSION=$(grep 'defconst[ ]*emacs-version' lisp/version.el \
511 | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/')
512 [[ ${FULL_VERSION} ]] || die "Cannot determine current Emacs version"
513 einfo "Emacs branch: ${EBZR_BRANCH}"
514 einfo "Revision: ${EBZR_REVISION:-${EBZR_REVNO}}"
515 einfo "Emacs version number: ${FULL_VERSION}"
516 [[ ${FULL_VERSION} =~ ^${PV%.*}(\..*)?$ ]] \
517 || die "Upstream version number changed to ${FULL_VERSION}"
518 fi
519
520 sed -i \
521 -e "s:/usr/lib/crtbegin.o:$(`tc-getCC` -print-file-name=crtbegin.o):g" \
522 -e "s:/usr/lib/crtend.o:$(`tc-getCC` -print-file-name=crtend.o):g" \
523 "${S}"/src/s/freebsd.h || die "unable to sed freebsd.h settings"
524
525 if ! use alsa; then
526 # ALSA is detected even if not requested by its USE flag.
527 # Suppress it by supplying pkg-config with a wrong library name.
528 sed -i -e "/ALSA_MODULES=/s/alsa/DiSaBlEaLsA/" configure.in \
529 || die "unable to sed configure.in"
530 fi
531 if ! use gzip-el; then
532 # Emacs' build system automatically detects the gzip binary and
533 # compresses el files. We don't want that so confuse it with a
534 # wrong binary name
535 sed -i -e "s/ gzip/ PrEvEnTcOmPrEsSiOn/" configure.in \
536 || die "unable to sed configure.in"
537 fi
538
539 eautoreconf
540 }
541
542 src_configure() {
543 ALLOWED_FLAGS=""
544 strip-flags
545 filter-flags -fstrict-aliasing
546 append-flags $(test-flags -fno-strict-aliasing)
547
548 if use sh; then
549 replace-flags -O[1-9] -O0 #262359
550 elif use ia64; then
551 replace-flags -O[2-9] -O1 #325373
552 else
553 replace-flags -O[3-9] -O2
554 fi
555
556 local myconf
557
558 if use alsa && ! use sound; then
559 einfo "Although sound USE flag is disabled you chose to have alsa,"
560 einfo "so sound is switched on anyway."
561 myconf="${myconf} --with-sound"
562 else
563 myconf="${myconf} $(use_with sound)"
564 fi
565
566 if use X; then
567 myconf="${myconf} --with-x"
568 myconf="${myconf} $(use_with gconf)"
569 myconf="${myconf} $(use_with toolkit-scroll-bars)"
570 myconf="${myconf} $(use_with gif) $(use_with jpeg)"
571 myconf="${myconf} $(use_with png) $(use_with svg rsvg)"
572 myconf="${myconf} $(use_with tiff) $(use_with xpm)"
573
574 if use xft; then
575 myconf="${myconf} --with-xft"
576 myconf="${myconf} $(use_with m17n-lib libotf)"
577 myconf="${myconf} $(use_with m17n-lib m17n-flt)"
578 else
579 myconf="${myconf} --without-xft"
580 myconf="${myconf} --without-libotf --without-m17n-flt"
581 use m17n-lib && ewarn \
582 "USE flag \"m17n-lib\" has no effect if \"xft\" is not set."
583 fi
584
585 # GTK+ is the default toolkit if USE=gtk is chosen with other
586 # possibilities. Emacs upstream thinks this should be standard
587 # policy on all distributions
588 if use gtk; then
589 einfo "Configuring to build with GIMP Toolkit (GTK+)"
590 myconf="${myconf} --with-x-toolkit=gtk"
591 elif use Xaw3d || use athena; then
592 einfo "Configuring to build with Athena/Lucid toolkit"
593 myconf="${myconf} --with-x-toolkit=lucid $(use_with Xaw3d xaw3d)"
594 elif use motif; then
595 einfo "Configuring to build with Motif toolkit"
596 myconf="${myconf} --with-x-toolkit=motif"
597 else
598 einfo "Configuring to build with no toolkit"
599 myconf="${myconf} --with-x-toolkit=no"
600 fi
601
602 local f tk=
603 for f in gtk Xaw3d athena motif; do
604 use ${f} || continue
605 [[ ${tk} ]] \
606 && ewarn "USE flag \"${f}\" ignored (superseded by \"${tk}\")"
607 tk="${tk}${tk:+ }${f}"
608 done
609 else
610 myconf="${myconf} --without-x"
611 fi
612
613 if [[ ${PV##*.} = 9999 ]]; then
614 # These variables are not needed for building. We add them to
615 # configure options because they are stored in the Emacs binary
616 # and available in variable "system-configuration-options".
617 myconf="${myconf} EBZR_BRANCH=${EBZR_BRANCH} EBZR_REVNO=${EBZR_REVNO}"
618 fi
619
620 # According to configure, this option is only used for GNU/Linux
621 # (x86_64 and s390). For Gentoo Prefix we have to explicitly spell
622 # out the location because $(get_libdir) does not necessarily return
623 # something that matches the host OS's libdir naming (e.g. RHEL).
624 local crtdir=$($(tc-getCC) -print-file-name=crt1.o)
625 crtdir=${crtdir%/*}
626
627 econf \
628 --program-suffix=-${EMACS_SUFFIX} \
629 --infodir="${EPREFIX}"/usr/share/info/${EMACS_SUFFIX} \
630 --enable-locallisppath="${EPREFIX}/etc/emacs:${EPREFIX}${SITELISP}" \
631 --with-crt-dir="${crtdir}" \
632 $(use_with hesiod) \
633 $(use_with kerberos) $(use_with kerberos kerberos5) \
634 $(use_with gpm) \
635 $(use_with dbus) \
636 ${myconf}
637 }
638
639 src_compile() {
640 export SANDBOX_ON=0 # for the unbelievers, see Bug #131505
641 if [[ ${PV##*.} = 9999 ]]; then
642 emake CC="$(tc-getCC)" bootstrap
643 # cleanup, otherwise emacs will be dumped again in src_install
644 (cd src; emake versionclean)
645 fi
646 # set last component of emacs-version to (package revision + 1)
647 touch src/emacs-${FULL_VERSION}.${PR#r}
648 emake CC="$(tc-getCC)"
649 }
650
651 src_install () {
652 local i m
653
654 emake install DESTDIR="${D}"
655
656 rm "${ED}"/usr/bin/emacs-${FULL_VERSION}-${EMACS_SUFFIX} \
657 || die "removing duplicate emacs executable failed"
658 mv "${ED}"/usr/bin/emacs-${EMACS_SUFFIX} "${ED}"/usr/bin/${EMACS_SUFFIX} \
659 || die "moving Emacs executable failed"
660
661 # move man pages to the correct place
662 for m in "${ED}"/usr/share/man/man1/* ; do
663 mv "${m}" "${m%.1}-${EMACS_SUFFIX}.1" || die "mv man failed"
664 done
665
666 # move info dir to avoid collisions with the dir file generated by portage
667 mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{,.orig} \
668 || die "moving info dir failed"
669 touch "${ED}"/usr/share/info/${EMACS_SUFFIX}/.keepinfodir
670 docompress -x /usr/share/info/${EMACS_SUFFIX}/dir.orig
671
672 # avoid collision between slots, see bug #169033 e.g.
673 rm "${ED}"/usr/share/emacs/site-lisp/subdirs.el
674 rm -rf "${ED}"/usr/share/{applications,icons}
675 rm "${ED}"/var/lib/games/emacs/{snake,tetris}-scores
676 keepdir /var/lib/games/emacs
677
678 # remove unused <version>/site-lisp dir
679 rm -rf "${ED}"/usr/share/emacs/${FULL_VERSION}/site-lisp
680
681 local c=";;"
682 if use source; then
683 insinto /usr/share/emacs/${FULL_VERSION}/src
684 # This is not meant to install all the source -- just the
685 # C source you might find via find-function
686 doins src/*.{c,h,m}
687 doins -r src/{m,s}
688 rm "${ED}"/usr/share/emacs/${FULL_VERSION}/src/Makefile.c
689 rm "${ED}"/usr/share/emacs/${FULL_VERSION}/src/{m,s}/README
690 c=""
691 fi
692
693 sed 's/^X//' >"${T}/${SITEFILE}" <<-EOF
694 X
695 ;;; ${PN}-${SLOT} site-lisp configuration
696 X
697 (when (string-match "\\\\\`${FULL_VERSION//./\\\\.}\\\\>" emacs-version)
698 X ${c}(setq find-function-C-source-directory
699 X ${c} "${EPREFIX}/usr/share/emacs/${FULL_VERSION}/src")
700 X (let ((path (getenv "INFOPATH"))
701 X (dir "${EPREFIX}/usr/share/info/${EMACS_SUFFIX}")
702 X (re "\\\\\`${EPREFIX}/usr/share/info\\\\>"))
703 X (and path
704 X ;; move Emacs Info dir before anything else in /usr/share/info
705 X (let* ((p (cons nil (split-string path ":" t))) (q p))
706 X (while (and (cdr q) (not (string-match re (cadr q))))
707 X (setq q (cdr q)))
708 X (setcdr q (cons dir (delete dir (cdr q))))
709 X (setq Info-directory-list (prune-directory-list (cdr p)))))))
710 EOF
711 elisp-site-file-install "${T}/${SITEFILE}" || die
712
713 dodoc README BUGS
714 }
715
716 pkg_preinst() {
717 # move Info dir file to correct name
718 local infodir=/usr/share/info/${EMACS_SUFFIX} f
719 if [[ -f ${ED}${infodir}/dir.orig ]]; then
720 mv "${ED}"${infodir}/dir{.orig,} || die "moving info dir failed"
721 else
722 # this should not happen in EAPI 4
723 ewarn "Regenerating Info directory index in ${infodir} ..."
724 rm -f "${ED}"${infodir}/dir{,.*}
725 for f in "${ED}"${infodir}/*; do
726 if [[ ${f##*/} != *-[0-9]* && -e ${f} ]]; then
727 install-info --info-dir="${ED}"${infodir} "${f}" \
728 || die "install-info failed"
729 fi
730 done
731 fi
732 }
733
734 pkg_postinst() {
735 local f
736 for f in "${EROOT}"/var/lib/games/emacs/{snake,tetris}-scores; do
737 [[ -e ${f} ]] || touch "${f}"
738 done
739 chown games "${EROOT}"/var/lib/games/emacs
740
741 elisp-site-regen
742 eselect emacs update ifunset
743
744 if use X; then
745 elog "You need to install some fonts for Emacs."
746 elog "Installing media-fonts/font-adobe-{75,100}dpi on the X server's"
747 elog "machine would satisfy basic Emacs requirements under X11."
748 elog "See also http://www.gentoo.org/proj/en/lisp/emacs/xft.xml"
749 elog "for how to enable anti-aliased fonts."
750 elog
751 fi
752
753 elog "You can set the version to be started by /usr/bin/emacs through"
754 elog "the Emacs eselect module, which also redirects man and info pages."
755 elog "Therefore, several Emacs versions can be installed at the same time."
756 elog "\"man emacs.eselect\" for details."
757 elog
758 elog "If you upgrade from a previous major version of Emacs, then it is"
759 elog "strongly recommended that you use app-admin/emacs-updater to rebuild"
760 elog "all byte-compiled elisp files of the installed Emacs packages."
761 }
762
763 pkg_postrm() {
764 elisp-site-regen
765 eselect emacs update ifunset
766 }