Add /etc/emacs to the lisp load-path; change from 13 Dec 2011 backported
authorUlrich Müller <ulm@gentoo.org>
Fri, 6 Jan 2012 10:24:47 +0000 (10:24 +0000)
committerUlrich Müller <ulm@gentoo.org>
Fri, 6 Jan 2012 10:24:47 +0000 (10:24 +0000)
to SLOTs 21 and 22.

Package-Manager: portage-2.1.10.44/cvs/Linux x86_64

app-editors/emacs/ChangeLog
app-editors/emacs/Manifest
app-editors/emacs/emacs-21.4-r24.ebuild [new file with mode: 0644]
app-editors/emacs/emacs-22.3-r9.ebuild [new file with mode: 0644]

index 717f84a87419df66f3e665b7098359cd498c6c4e..4fa9f7c5043f120085584f5971e3364a03026aa2 100644 (file)
@@ -1,6 +1,14 @@
 # ChangeLog for app-editors/emacs
 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-editors/emacs/ChangeLog,v 1.455 2012/01/05 23:51:53 ulm Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-editors/emacs/ChangeLog,v 1.456 2012/01/06 10:24:47 ulm Exp $
+
+*emacs-22.3-r9 (06 Jan 2012)
+*emacs-21.4-r24 (06 Jan 2012)
+
+  06 Jan 2012; Ulrich Mueller <ulm@gentoo.org> +emacs-21.4-r24.ebuild,
+  +emacs-22.3-r9.ebuild:
+  Add /etc/emacs to the lisp load-path; change from 13 Dec 2011 backported
+  to SLOTs 21 and 22.
 
   05 Jan 2012; Ulrich Mueller <ulm@gentoo.org> emacs-23.3-r3.ebuild:
   A build-time dependency on pkgconfig is needed only in some configurations.
index eca446e00e1978bf0e40e0b1d8d8bf5ba8e40823..b159feabc0eb4ef6ce2ef4d0a366687c4f8a510d 100644 (file)
@@ -15,26 +15,28 @@ DIST emacs-23.3a.tar.bz2 38748283 RMD160 21f201714bca420c3a8fed8c92058cec786e724
 DIST leim-21.4.tar.gz 3291433 RMD160 89e1108bfe06425a0d6b4d941f9c297551bafcca SHA1 dd63f9aca1a58d40d9d426dd410fb627230974f7 SHA256 db24946985dd644bfed18815d6e991dad27f8ab1fd5823dd6dc4eb8dcd04333b
 EBUILD emacs-18.59-r8.ebuild 4321 RMD160 5e3dd95eb27eb8751c77584f63b940b33f100213 SHA1 381fa77d88b5aa067c217cb75abf39a54666dce6 SHA256 1ca45281d2027bca0ca64300534f0713b80b98af2f504dd5810aa7608ed60f48
 EBUILD emacs-21.4-r23.ebuild 5010 RMD160 2b7019a59d7ba82a320c8464c3c2b6c098410b5a SHA1 04e1932afc02456234eb46ffc0baa35681162a7e SHA256 263a626ed20b87ae8f19b136ce75f90d9f188e4a69d8bcfdbef540b419f9b693
+EBUILD emacs-21.4-r24.ebuild 5241 RMD160 70117c0c7a53e2ffe4b8a03e913ba84c408889ea SHA1 5c9a5b3f00f4870af54b77c8bc6112d38b6414a8 SHA256 59342c8f7c3d6b7f2e5c891289f129168cda39b801028648e078acee24a4cb66
 EBUILD emacs-22.3-r8.ebuild 7832 RMD160 d74e25b91dbe8783930d1647dec3cf8e44b49b17 SHA1 92e6d6b50578faf6f669e6b2389d7599712048e9 SHA256 b9a75b8b6f468f984441ab725779ff581c8ddbfa14ccff404cc11381d0db741b
+EBUILD emacs-22.3-r9.ebuild 7985 RMD160 01594bd1319b9a671374ffab8bdbdaee8d105013 SHA1 e39dea23803b36ca9c64bfe8600cdd6b8169825e SHA256 e955fa03e9c33411301b1b24559669319a5a5397d113f6c01e6a78cc81f1d14a
 EBUILD emacs-23.3-r1.ebuild 10301 RMD160 885b752594822d1425e3afe95e997ea9fb5a2776 SHA1 90bcec933661eb0f5066a6ae679ecdb6b7ac42d0 SHA256 93cf3fe5516ed9b9f0e06ae9de0472e55c47d89d0c7824da5269e71d548e4d0c
 EBUILD emacs-23.3-r2.ebuild 10656 RMD160 015444a016093e78a11dec0ad71857e1fcc7ef61 SHA1 600b0741c75f0bc0ab246380ce1d105c83186cd3 SHA256 821938b07f1303e0b0a2a8751f1d98760c4623bb87817c722c9f8e60a9f6d106
 EBUILD emacs-23.3-r3.ebuild 10481 RMD160 626fe3cf524bfeec60bc676e4a176a3748695a72 SHA1 580d3ad9d18985aee0c3b79e003268253e394312 SHA256 509469ab61b087b6893d2ea3e19a664e427570fad2e9860d2fade2346a0891d8
-MISC ChangeLog 65027 RMD160 7970318f81942367359d264dd8c7e790581bdd40 SHA1 35ed66107eedde1214793f5d1b0d5d377c9c1945 SHA256 0e9a669a774f8cc38e0a7762f640de7786a5a20d99e417a27d4b7f7a29d56319
+MISC ChangeLog 65281 RMD160 05a82c44efabfb2994c1febf93e858ebc048de9e SHA1 a41f4d325110a27d9ce4f2d1e440f577aeb74474 SHA256 6ee4fbe72a81dd87ef34e1ffb11dc81dbd1900d85c74a24dae81a5ad0b5bf27d
 MISC metadata.xml 1644 RMD160 911d63b0a921d248984f3c5efeb1922f05aa5111 SHA1 7281388d7c274016274e888d97821fda9e5c958c SHA256 7c703ad3af721dfa1d9737f78cd848b7c69a7b906ead5c5fe8fd1db23a1d3166
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.18 (GNU/Linux)
 
-iQIcBAEBAgAGBQJPBjolAAoJEDxpGckxwJCB6WkQAMHObJavrDu0LEquWYWgC0S+
-sMRvnL1NTG+ZmknOM7j3wF/PUOEDlGqP/5vXu+XBB6VEcE+J2fmvWfPvNfC+uGv9
-lzrYEQW2dJrbk3QITxVX4NDXDygJQt2G5HRH+9e+lNgtzScRdH9c5a7RCcMEagKk
-RyjK/VHP0TGFyjrXWpSQhIzmzH4V37vnqjqqSEYboOFCm691z4vDVOrQn1jDf+l/
-CxttC0lo1EVi0Fv04g/lmYpRhuU/+e2Dw1DbXgaAV3MaabiZ+WLNyHPfD8hje2nd
-78wSDorImrcXGRLp0Xg8ytXAqfBi5y6zEk75BCUTbxUugAzw2wG2gEC/oj7Z+pfS
-CCRusp//FfLiJCwXSQF4FPeHf5D6ZXfSq3tU5G7FhPmBVTDHfFZocC56VF+DtljB
-vwy1VUYj9m2bSS1hDOGJtLktHpAJjMVZ/mhS2UmtLSQj4+3oC/KLNczXymEJBLgQ
-HHvHm7KfkeXojn3GUmorXnc1mQ4aHrNKSHRG39gPqR86IdrnbnHztjzzRs5yGTx8
-y/IXJgb2ICtkxfnST4ok0pCVN/DwbqQjhrm+oYn3HA98/uts5nvC9T0g+UpUv1+A
-L/A9mu5Sgj7hrorVhpDyqPOoWJ4MZRKLWfxJh/bBZa6JWlzdO+N8OTOcS3WKwqJ6
-BbpBkkzG/EyEzvaWhslH
-=G90e
+iQIcBAEBAgAGBQJPBs57AAoJEDxpGckxwJCBThwQALFHH3h/R/1htBG0torvkFYk
+iKQq1YG1cBdC1kIEu8xRHBk1Aca/zM5pkOVRQkw/CRrT0DV2u27giwi30GlxsM/V
+Ml+/XkAgo78m4vl8v4FFfhzDrp30wdkph1mk5wXZqLPGyZiL0oJlv0qkI3QyQJRL
+eiiQpRmm/o2iFFGFy/+pb/b/g4MfjfZgNurYJfAoLRacok1uKbc4slv+Vz37GM/+
+NEFpA1M/u0dWbT8uaFFlgGW808I7ICXbMpoqx19Wydfgf+7wFom6gF9m1rPRCjtS
+EfSVyPcowi4hqlxPmjVxl+VsmVTI6NcHR9JhM6twunayrUKLNIul7HM4H4+9L2K8
+BXytJeUjAaOboEeREmBxgBA9T0a2PVtXXbUA+XjhyIgoG3nqyonBvv98x7iATeOa
+xhwHyhi6yNZfitvOjDErdAJEF47rpmL2G9CVz2KbmcLi/f7RiP1cQbNAiYHQQknu
+he86C2gPZe0bybnvioD6e6tl7PqDDyEeZ/b81rPUaX0Is9E5BczEcXiGktMRIy7M
+NlVtaSDrR5v+ExxAZxX7MKXV4s8VJpqj+/c7rn1JrNf1IdL0X3nfEyKjkrbIXpsZ
+WltjO/8X1YiQhOgIQOnhMdKQmfHGdq0pWo7MBhrgji/lqiIVmdNYikOf3QZAK2WX
+H48jsxR/OkJUVHeb/Hr5
+=orQj
 -----END PGP SIGNATURE-----
diff --git a/app-editors/emacs/emacs-21.4-r24.ebuild b/app-editors/emacs/emacs-21.4-r24.ebuild
new file mode 100644 (file)
index 0000000..e41878a
--- /dev/null
@@ -0,0 +1,190 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-editors/emacs/emacs-21.4-r24.ebuild,v 1.1 2012/01/06 10:24:47 ulm Exp $
+
+EAPI=4
+WANT_AUTOMAKE="none"
+
+inherit elisp-common flag-o-matic eutils toolchain-funcs autotools
+
+DESCRIPTION="The extensible, customizable, self-documenting real-time display editor"
+HOMEPAGE="http://www.gnu.org/software/emacs/"
+SRC_URI="mirror://gnu/emacs/${P}a.tar.gz
+       mirror://gentoo/${P}-patches-12.tar.bz2
+       leim? ( mirror://gnu/emacs/leim-${PV}.tar.gz )"
+
+LICENSE="GPL-2 FDL-1.1 BSD as-is MIT"
+SLOT="21"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+IUSE="X Xaw3d leim motif sendmail"
+
+DEPEND="sys-libs/ncurses
+       >=app-admin/eselect-emacs-1.2
+       X? (
+               x11-libs/libXext
+               x11-libs/libICE
+               x11-libs/libSM
+               x11-libs/libXmu
+               x11-libs/libXpm
+               x11-misc/xbitmaps
+               >=media-libs/giflib-4.1.0.1b
+               virtual/jpeg
+               >=media-libs/tiff-3.5.5-r3
+               >=media-libs/libpng-1.4:0
+               Xaw3d? ( x11-libs/libXaw3d )
+               !Xaw3d? ( motif? ( >=x11-libs/openmotif-2.3:0 ) )
+       )"
+
+RDEPEND="${DEPEND}
+       >=app-emacs/emacs-common-gentoo-1.3[X?]
+       sendmail? ( virtual/mta )"
+
+src_prepare() {
+       EPATCH_SUFFIX=patch epatch
+
+       sed -i \
+               -e "s:/usr/lib/crtbegin.o:$(`tc-getCC` -print-file-name=crtbegin.o):g" \
+               -e "s:/usr/lib/crtend.o:$(`tc-getCC` -print-file-name=crtend.o):g" \
+               "${S}"/src/s/freebsd.h || die "unable to sed freebsd.h settings"
+
+       # This will need to be updated for X-Compilation
+       sed -i -e "s:/usr/lib/\([^ ]*\).o:/usr/$(get_libdir)/\1.o:g" \
+               "${S}/src/s/gnu-linux.h" || die
+
+       # custom aclocal.m4 was only needed for autoconf 2.13 and earlier
+       rm aclocal.m4
+       eaclocal
+       eautoconf
+}
+
+src_configure() {
+       # -fstack-protector gets internal compiler error at xterm.c (bug 33265)
+       filter-flags -fstack-protector -fstack-protector-all
+
+       # emacs doesn't handle LDFLAGS properly (bug #77430 and bug #65002)
+       unset LDFLAGS
+
+       # ever since GCC 3.2
+       replace-flags -O[3-9] -O2
+
+       # -march is known to cause signal 6 on some environment
+       filter-flags "-march=*"
+
+       local myconf
+       if use X ; then
+               myconf="${myconf}
+                       --with-x
+                       --with-xpm
+                       --with-jpeg
+                       --with-tiff
+                       --with-gif
+                       --with-png"
+
+               if use Xaw3d ; then
+                       einfo "Configuring to build with Xaw3d (Athena/Lucid) toolkit"
+                       myconf="${myconf} --with-x-toolkit=athena"
+                       use motif \
+                               && ewarn "USE flag \"motif\" ignored (superseded by \"Xaw3d\")"
+               elif use motif ; then
+                       einfo "Configuring to build with Motif toolkit"
+                       myconf="${myconf} --with-x-toolkit=motif"
+               else
+                       # do not build emacs with any toolkit, bug 35300
+                       einfo "Configuring to build with no toolkit"
+                       myconf="${myconf} --with-x-toolkit=no"
+               fi
+       else
+               myconf="${myconf} --without-x"
+       fi
+
+       econf ${myconf}
+
+       # leave this in src_configure
+       emake \
+               locallisppath="/etc/emacs:${SITELISP}:/usr/share/emacs/${PV}/leim" \
+               epaths-force
+}
+
+src_compile() {
+       export SANDBOX_ON=0
+       emake CC="$(tc-getCC)"
+
+       einfo "Recompiling patched lisp files..."
+       (cd lisp; emake recompile)
+       (cd src; emake versionclean)
+       emake CC="$(tc-getCC)"
+}
+
+src_install() {
+       local i m
+
+       einstall infodir="${D}/usr/share/info/emacs-${SLOT}"
+
+       for i in "${D}"/usr/bin/* ; do
+               mv "${i}" "${i}-emacs-${SLOT}" || die "mv ${i} failed"
+       done
+       mv "${D}"/usr/bin/emacs{-emacs,}-${SLOT} || die "mv emacs failed"
+       rm "${D}"/usr/bin/emacs-${PV}-emacs-${SLOT}
+
+       # move man pages to the correct place
+       for m in "${D}"/usr/share/man/man1/* ; do
+               mv "${m}" "${m%.1}-emacs-${SLOT}.1" || die "mv ${m} failed"
+       done
+
+       # move info dir to avoid collisions with the dir file generated by portage
+       mv "${D}"/usr/share/info/emacs-${SLOT}/dir{,.orig} \
+               || die "moving info dir failed"
+       touch "${D}"/usr/share/info/emacs-${SLOT}/.keepinfodir
+       docompress -x /usr/share/info/emacs-${SLOT}/dir.orig
+
+       # avoid collision between slots
+       rm "${D}"/usr/share/emacs/site-lisp/subdirs.el
+
+       # remove unused <version>/site-lisp dir
+       rm -rf "${D}"/usr/share/emacs/${PV}/site-lisp
+
+       # fix permissions
+       find "${D}" -perm 664 |xargs chmod -f 644 2>/dev/null
+       find "${D}" -type d |xargs chmod -f 755 2>/dev/null
+
+       keepdir /usr/share/emacs/${PV}/leim
+
+       dodoc BUGS ChangeLog README
+}
+
+pkg_preinst() {
+       # move Info dir file to correct name
+       local infodir=/usr/share/info/emacs-${SLOT} f
+       if [ -f "${D}"${infodir}/dir.orig ]; then
+               mv "${D}"${infodir}/dir{.orig,} || die "moving info dir failed"
+       else
+               # this should not happen in EAPI 4
+               ewarn "Regenerating Info directory index in ${infodir} ..."
+               rm -f "${D}"${infodir}/dir{,.*}
+               for f in "${D}"${infodir}/*; do
+                       if [[ ${f##*/} != *[0-9].info* && -e ${f} ]]; then
+                               install-info --info-dir="${D}"${infodir} "${f}" \
+                                       || die "install-info failed"
+                       fi
+               done
+       fi
+}
+
+pkg_postinst() {
+       eselect emacs update ifunset
+
+       if ! use sendmail && ! has_version "virtual/mta"; then
+               elog "You disabled sendmail support for Emacs. If you later install"
+               elog "a MTA then you will need to recompile Emacs. See Bug #11104."
+       fi
+
+       if use X; then
+               elog "You need to install some fonts for Emacs."
+               elog "Installing media-fonts/font-adobe-{75,100}dpi on the X server's"
+               elog "machine would satisfy basic Emacs requirements under X11."
+       fi
+}
+
+pkg_postrm() {
+       eselect emacs update ifunset
+}
diff --git a/app-editors/emacs/emacs-22.3-r9.ebuild b/app-editors/emacs/emacs-22.3-r9.ebuild
new file mode 100644 (file)
index 0000000..1995824
--- /dev/null
@@ -0,0 +1,257 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-editors/emacs/emacs-22.3-r9.ebuild,v 1.1 2012/01/06 10:24:47 ulm Exp $
+
+EAPI=4
+WANT_AUTOMAKE="none"
+
+inherit autotools elisp-common eutils flag-o-matic
+
+DESCRIPTION="The extensible, customizable, self-documenting real-time display editor"
+HOMEPAGE="http://www.gnu.org/software/emacs/"
+SRC_URI="mirror://gnu/emacs/${P}.tar.gz
+       mirror://gentoo/${P}-patches-8.tar.bz2"
+
+LICENSE="GPL-3 FDL-1.2 BSD as-is MIT"
+SLOT="22"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+IUSE="alsa gif gtk gzip-el hesiod jpeg kerberos motif png sound source tiff toolkit-scroll-bars X Xaw3d +xpm"
+
+RDEPEND="sys-libs/ncurses
+       >=app-admin/eselect-emacs-1.2
+       net-libs/liblockfile
+       hesiod? ( net-dns/hesiod )
+       kerberos? ( virtual/krb5 )
+       alsa? ( media-libs/alsa-lib )
+       X? (
+               x11-libs/libXmu
+               x11-libs/libXt
+               x11-misc/xbitmaps
+               gif? ( media-libs/giflib )
+               jpeg? ( virtual/jpeg )
+               png? ( >=media-libs/libpng-1.4:0 )
+               tiff? ( media-libs/tiff )
+               xpm? ( x11-libs/libXpm )
+               gtk? ( x11-libs/gtk+:2 )
+               !gtk? (
+                       Xaw3d? ( x11-libs/libXaw3d )
+                       !Xaw3d? ( motif? ( >=x11-libs/openmotif-2.3:0 ) )
+               )
+       )"
+
+DEPEND="${RDEPEND}
+       alsa? ( dev-util/pkgconfig )
+       X? ( gtk? ( dev-util/pkgconfig ) )
+       gzip-el? ( app-arch/gzip )"
+
+RDEPEND="${RDEPEND}
+       >=app-emacs/emacs-common-gentoo-1.3[X?]"
+
+# FULL_VERSION keeps the full version number, which is needed in order to
+# determine some path information correctly for copy/move operations later on
+FULL_VERSION="${PV}"
+EMACS_SUFFIX="emacs-${SLOT}"
+SITEFILE="20${PN}-${SLOT}-gentoo.el"
+
+src_prepare() {
+       EPATCH_SUFFIX=patch epatch
+
+       sed -i \
+               -e "s:/usr/lib/crtbegin.o:$(`tc-getCC` -print-file-name=crtbegin.o):g" \
+               -e "s:/usr/lib/crtend.o:$(`tc-getCC` -print-file-name=crtend.o):g" \
+               "${S}"/src/s/freebsd.h || die "unable to sed freebsd.h settings"
+
+       if ! use alsa; then
+               # ALSA is detected even if not requested by its USE flag.
+               # Suppress it by supplying pkg-config with a wrong library name.
+               sed -i -e "/ALSA_MODULES=/s/alsa/DiSaBlEaLsA/" configure.in \
+                       || die "unable to sed configure.in"
+       fi
+       if ! use gzip-el; then
+               # Emacs' build system automatically detects the gzip binary and
+               # compresses el files. We don't want that so confuse it with a
+               # wrong binary name
+               sed -i -e "s/ gzip/ PrEvEnTcOmPrEsSiOn/" configure.in \
+                       || die "unable to sed configure.in"
+       fi
+
+       eautoreconf
+}
+
+src_configure() {
+       ALLOWED_FLAGS=""
+       strip-flags
+       filter-flags -fstack-protector -fstack-protector-all    #285778
+       replace-flags -O[3-9] -O2
+       sed -i -e "s/-lungif/-lgif/g" configure* src/Makefile* || die
+
+       local myconf
+
+       if use alsa && ! use sound; then
+               einfo "Although sound USE flag is disabled you chose to have alsa,"
+               einfo "so sound is switched on anyway."
+               myconf="${myconf} --with-sound"
+       else
+               myconf="${myconf} $(use_with sound)"
+       fi
+
+       if use X; then
+               myconf="${myconf} --with-x"
+               myconf="${myconf} $(use_with toolkit-scroll-bars)"
+               myconf="${myconf} $(use_with gif) $(use_with jpeg)"
+               myconf="${myconf} $(use_with png) $(use_with tiff)"
+               myconf="${myconf} $(use_with xpm)"
+
+               # GTK+ is the default toolkit if USE=gtk is chosen with other
+               # possibilities. Emacs upstream thinks this should be standard
+               # policy on all distributions
+               if use gtk; then
+                       einfo "Configuring to build with GIMP Toolkit (GTK+)"
+                       myconf="${myconf} --with-x-toolkit=gtk"
+               elif use Xaw3d; then
+                       einfo "Configuring to build with Xaw3d (Athena/Lucid) toolkit"
+                       myconf="${myconf} --with-x-toolkit=athena"
+                       myconf="${myconf} --without-gtk"
+               elif use motif; then
+                       einfo "Configuring to build with Motif toolkit"
+                       myconf="${myconf} --with-x-toolkit=motif"
+                       myconf="${myconf} --without-gtk"
+               else
+                       einfo "Configuring to build with no toolkit"
+                       myconf="${myconf} --with-x-toolkit=no"
+                       myconf="${myconf} --without-gtk"
+               fi
+
+               local f tk=
+               for f in gtk Xaw3d motif; do
+                       use ${f} || continue
+                       [ "${tk}" ] \
+                               && ewarn "USE flag \"${f}\" ignored (superseded by \"${tk}\")"
+                       tk="${tk}${tk:+ }${f}"
+               done
+       else
+               myconf="${myconf} --without-x"
+       fi
+
+       econf \
+               --program-suffix=-${EMACS_SUFFIX} \
+               --infodir=/usr/share/info/${EMACS_SUFFIX} \
+               --enable-locallisppath="/etc/emacs:${SITELISP}" \
+               --without-carbon \
+               --with-gameuser="${GAMES_USER_DED:-games}" \
+               $(use_with hesiod) \
+               $(use_with kerberos) $(use_with kerberos kerberos5) \
+               ${myconf}
+}
+
+src_compile() {
+       export SANDBOX_ON=0                     # for the unbelievers, see Bug #131505
+       emake CC="$(tc-getCC)"
+}
+
+src_install () {
+       local i m
+
+       emake install DESTDIR="${D}"
+
+       rm "${D}"/usr/bin/emacs-${FULL_VERSION}-${EMACS_SUFFIX} \
+               || die "removing duplicate emacs executable failed"
+       mv "${D}"/usr/bin/emacs-${EMACS_SUFFIX} "${D}"/usr/bin/${EMACS_SUFFIX} \
+               || die "moving Emacs executable failed"
+
+       # move man pages to the correct place
+       for m in "${D}"/usr/share/man/man1/* ; do
+               mv "${m}" "${m%.1}-${EMACS_SUFFIX}.1" || die "mv man failed"
+       done
+
+       # move info dir to avoid collisions with the dir file generated by portage
+       mv "${D}"/usr/share/info/${EMACS_SUFFIX}/dir{,.orig} \
+               || die "moving info dir failed"
+       touch "${D}"/usr/share/info/${EMACS_SUFFIX}/.keepinfodir
+       docompress -x /usr/share/info/${EMACS_SUFFIX}/dir.orig
+
+       # avoid collision between slots, see bug #169033 e.g.
+       rm "${D}"/usr/share/emacs/site-lisp/subdirs.el
+       rm "${D}"/var/lib/games/emacs/{snake,tetris}-scores
+       keepdir /var/lib/games/emacs
+
+       # remove unused <version>/site-lisp dir
+       rm -rf "${D}"/usr/share/emacs/${FULL_VERSION}/site-lisp
+
+       local c=";;"
+       if use source; then
+               insinto /usr/share/emacs/${FULL_VERSION}/src
+               # This is not meant to install all the source -- just the
+               # C source you might find via find-function
+               doins src/*.[ch]
+               c=""
+       fi
+
+       sed 's/^X//' >"${T}/${SITEFILE}" <<-EOF
+       X
+       ;;; ${PN}-${SLOT} site-lisp configuration
+       X
+       (when (string-match "\\\\\`${FULL_VERSION//./\\\\.}\\\\>" emacs-version)
+       X  ${c}(setq find-function-C-source-directory
+       X  ${c}      "/usr/share/emacs/${FULL_VERSION}/src")
+       X  (let ((path (getenv "INFOPATH"))
+       X       (dir "/usr/share/info/${EMACS_SUFFIX}")
+       X       (re "\\\\\`/usr/share/info\\\\>"))
+       X    (and path
+       X        ;; move Emacs Info dir before anything else in /usr/share/info
+       X        (let* ((p (cons nil (split-string path ":" t))) (q p))
+       X          (while (and (cdr q) (not (string-match re (cadr q))))
+       X            (setq q (cdr q)))
+       X          (setcdr q (cons dir (delete dir (cdr q))))
+       X          (setq Info-directory-list (prune-directory-list (cdr p)))))))
+       EOF
+       elisp-site-file-install "${T}/${SITEFILE}" || die
+
+       dodoc AUTHORS BUGS CONTRIBUTE README
+}
+
+pkg_preinst() {
+       # move Info dir file to correct name
+       local infodir=/usr/share/info/${EMACS_SUFFIX} f
+       if [ -f "${D}"${infodir}/dir.orig ]; then
+               mv "${D}"${infodir}/dir{.orig,} || die "moving info dir failed"
+       else
+               # this should not happen in EAPI 4
+               ewarn "Regenerating Info directory index in ${infodir} ..."
+               rm -f "${D}"${infodir}/dir{,.*}
+               for f in "${D}"${infodir}/*; do
+                       if [[ ${f##*/} != *-[0-9]* && -e ${f} ]]; then
+                               install-info --info-dir="${D}"${infodir} "${f}" \
+                                       || die "install-info failed"
+                       fi
+               done
+       fi
+}
+
+pkg_postinst() {
+       local f
+       for f in "${ROOT}"/var/lib/games/emacs/{snake,tetris}-scores; do
+               [ -e "${f}" ] || touch "${f}"
+       done
+       chown "${GAMES_USER_DED:-games}" "${ROOT}"/var/lib/games/emacs
+
+       elisp-site-regen
+       eselect emacs update ifunset
+
+       if use X; then
+               elog "You need to install some fonts for Emacs."
+               elog "Installing media-fonts/font-adobe-{75,100}dpi on the X server's"
+               elog "machine would satisfy basic Emacs requirements under X11."
+               elog
+       fi
+
+       elog "You can set the version to be started by /usr/bin/emacs through"
+       elog "the Emacs eselect module, which also redirects man and info pages."
+       elog "Therefore, several Emacs versions can be installed at the same time."
+       elog "\"man emacs.eselect\" for details."
+}
+
+pkg_postrm() {
+       elisp-site-regen
+       eselect emacs update ifunset
+}