summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app-editors/emacs/ChangeLog12
-rw-r--r--app-editors/emacs/Manifest9
-rw-r--r--app-editors/emacs/emacs-22.1.ebuild234
-rw-r--r--app-editors/emacs/files/digest-emacs-22.13
-rw-r--r--app-editors/emacs/files/emacs-22.1-Xaw3d-headers.patch150
-rw-r--r--app-editors/emacs/files/emacs-22.1-disable_alsa_detection.patch42
-rw-r--r--app-editors/emacs/files/emacs-22.1-freebsd-sparc.patch13
-rw-r--r--app-editors/emacs/files/emacs-22.1-oldxmenu-qa.patch20
-rw-r--r--app-editors/emacs/files/emacs-22.1-xembed.patch361
-rw-r--r--app-editors/emacs/metadata.xml5
10 files changed, 849 insertions, 0 deletions
diff --git a/app-editors/emacs/ChangeLog b/app-editors/emacs/ChangeLog
new file mode 100644
index 0000000..3d92f16
--- /dev/null
+++ b/app-editors/emacs/ChangeLog
@@ -0,0 +1,12 @@
+# ChangeLog for app-editors/emacs
+# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2
+# $Header: $
+
+ 14 Jul 2007; Ulrich Mueller <ulm@gentoo.org>
+ +files/emacs-22.1-Xaw3d-headers.patch,
+ +files/emacs-22.1-disable_alsa_detection.patch,
+ +files/emacs-22.1-freebsd-sparc.patch,
+ +files/emacs-22.1-oldxmenu-qa.patch, +files/emacs-22.1-xembed.patch,
+ +metadata.xml, +emacs-22.1.ebuild:
+ XEmbed support, see bug #185064.
+
diff --git a/app-editors/emacs/Manifest b/app-editors/emacs/Manifest
new file mode 100644
index 0000000..1b3b8e4
--- /dev/null
+++ b/app-editors/emacs/Manifest
@@ -0,0 +1,9 @@
+AUX emacs-22.1-Xaw3d-headers.patch 4736 RMD160 d94da74ae2e8db00b5b98f35f3bbf11a1f38a188 SHA1 dd4eafe26a313334cc2c51f14b9ee7669428d02a SHA256 80228568be71952150c75adf562208913dcb15e51743480749729f9dc58816ea
+AUX emacs-22.1-disable_alsa_detection.patch 1573 RMD160 e41972bc7c8c6ce80128046ee134acc7903fef2b SHA1 bdb460012bd526d336e97cb7f6b7e9c852da5be4 SHA256 afab81ebc4ac289c6f2ff4cd93f3f10a29bed3e55d463b337ab8711f6ff8cfcc
+AUX emacs-22.1-freebsd-sparc.patch 475 RMD160 a8e6e3f2bc014979fd269a027835a65520c12417 SHA1 71c6d9ee3b3e5149a33d440373a212b56fbd064c SHA256 43584ea923e6c7221e69d1d6a14d55d386565c5decd067a62acc58af522c803b
+AUX emacs-22.1-oldxmenu-qa.patch 448 RMD160 ac5b0e57569f0963862ded46953be899fb637590 SHA1 10887f5e0ccebde6715307fdc59faa8f826dd597 SHA256 3039fa8eedc22c638e706123bd1affb0f736a53bf0ebc68566678ead92a4c590
+AUX emacs-22.1-xembed.patch 11614 RMD160 363319e91489a306a1114578edac02b4a8e00e87 SHA1 60f6d85cf5f651d22b5460cdb676c961fd7a2124 SHA256 b35eb5f0637e70dd757b5e47ce3da56889b11ac8976e208512dba964af0714da
+DIST emacs-22.1.tar.gz 38172226 RMD160 da5360871db8b1d473ff7f0b0937ee6c278c0b19 SHA1 327664173eabe5db49d4e7e4a4b1794577af902e SHA256 1ec43bef7127e572f92d7c3a846951cf8e263e27445c62c867035f94681c3ed0
+EBUILD emacs-22.1.ebuild 7374 RMD160 8a1f2e15c61859e9e19bd8a19dd9c9241bdf6ee4 SHA1 1feb68169646524000eba0d417e8b726c1cdbb8d SHA256 f50eb71fd644b58cc3c4f59ec6afc94aac54ae3f4acd4dfdea9f64351c68cc97
+MISC ChangeLog 441 RMD160 5381181e28e7c603d3a20d7da51cb3ad35066f15 SHA1 1a85a3dab187f6f5e0b99f6300570c7ffcbcb80e SHA256 096a1e3ea38104319d72dd6c611afb02ba6479cba57bc8301274b07cc882a933
+MISC metadata.xml 158 RMD160 415d172437ca754d24fc5ab186ba8e77934d96e4 SHA1 61f6eff9729cd87a725c2a70c81aca4270a17fc4 SHA256 1393bdef3a74343fdb40a112c7096a1af16f67e7a43413250de28dfe73810eab
diff --git a/app-editors/emacs/emacs-22.1.ebuild b/app-editors/emacs/emacs-22.1.ebuild
new file mode 100644
index 0000000..ed71f51
--- /dev/null
+++ b/app-editors/emacs/emacs-22.1.ebuild
@@ -0,0 +1,234 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-editors/emacs/emacs-22.1.ebuild,v 1.11 2007/06/25 05:57:15 ulm Exp $
+
+WANT_AUTOCONF="2.61"
+WANT_AUTOMAKE="latest"
+
+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"
+
+LICENSE="GPL-2 FDL-1.2"
+SLOT="22"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
+IUSE="alsa gif gtk gzip-el hesiod jpeg motif png spell sound source tiff toolkit-scroll-bars X Xaw3d xembed xpm"
+RESTRICT="strip"
+
+X_DEPEND="x11-libs/libXmu x11-libs/libXt x11-misc/xbitmaps"
+
+RDEPEND="!<app-editors/emacs-cvs-22.1
+ sys-libs/ncurses
+ >=app-admin/eselect-emacs-0.7-r1
+ sys-libs/zlib
+ hesiod? ( net-dns/hesiod )
+ spell? ( || ( app-text/ispell app-text/aspell ) )
+ alsa? ( media-sound/alsa-headers )
+ X? (
+ $X_DEPEND
+ x11-misc/emacs-desktop
+ gif? ( media-libs/giflib )
+ jpeg? ( media-libs/jpeg )
+ tiff? ( media-libs/tiff )
+ png? ( media-libs/libpng )
+ xpm? ( x11-libs/libXpm )
+ gtk? ( =x11-libs/gtk+-2* )
+ !gtk? (
+ Xaw3d? ( x11-libs/Xaw3d )
+ !Xaw3d? (
+ motif? ( virtual/motif )
+ )
+ )
+ )"
+
+DEPEND="${RDEPEND}
+ gzip-el? ( app-arch/gzip )"
+
+PROVIDE="virtual/editor"
+
+# 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}"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ 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 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
+
+ epatch "${FILESDIR}/${P}-Xaw3d-headers.patch"
+ epatch "${FILESDIR}/${P}-freebsd-sparc.patch"
+ epatch "${FILESDIR}/${P}-oldxmenu-qa.patch"
+ # ALSA is detected and used even if not requested by the USE=alsa flag.
+ # So remove the automagic check
+ use alsa || epatch "${FILESDIR}/${P}-disable_alsa_detection.patch"
+ # XEmbed support, see #185064
+ use xembed && epatch "${FILESDIR}/${P}-xembed.patch"
+
+ eautoreconf
+}
+
+src_compile() {
+ export SANDBOX_ON=0 # for the unbelievers, see Bug #131505
+ ALLOWED_FLAGS=""
+ strip-flags
+ unset LDFLAGS
+ 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
+ echo
+ einfo "Although sound USE flag is disabled you chose to have alsa,"
+ einfo "so sound is switched on anyway."
+ echo
+ myconf="${myconf} --with-sound"
+ else
+ myconf="${myconf} $(use_with sound)"
+ fi
+
+ if use X; then
+ # GTK+ is the default toolkit if USE=gtk is chosen with other
+ # possibilities. Emacs upstream thinks this should be standard
+ # policy on all distributions
+ myconf="${myconf} --with-x"
+ myconf="${myconf} $(use_with xpm)"
+ myconf="${myconf} $(use_with toolkit-scroll-bars)"
+ myconf="${myconf} $(use_with jpeg) $(use_with tiff)"
+ myconf="${myconf} $(use_with gif) $(use_with png)"
+ if use gtk; then
+ echo
+ einfo "Configuring to build with GTK support, disabling all other toolkits"
+ echo
+ myconf="${myconf} --with-x-toolkit=gtk"
+ elif use Xaw3d; then
+ einfo "Configuring to build with Xaw3d(athena) support"
+ myconf="${myconf} --with-x-toolkit=athena"
+ myconf="${myconf} --without-gtk"
+ elif use motif; then
+ einfo "Configuring to build with motif toolkit support"
+ 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
+ else
+ myconf="${myconf} --without-x"
+ fi
+
+ myconf="${myconf} $(use_with hesiod)"
+
+ econf \
+ --program-suffix=-emacs-${SLOT} \
+ --infodir=/usr/share/info/emacs-${SLOT} \
+ --without-carbon \
+ ${myconf} || die "econf emacs failed"
+
+ emake CC="$(tc-getCC)" $(useq xembed && echo bootstrap) \
+ || die "emake failed"
+}
+
+src_install () {
+ emake install DESTDIR="${D}" || die "make install failed"
+
+ rm "${D}"/usr/bin/emacs-${FULL_VERSION}-emacs-${SLOT} \
+ || die "removing duplicate emacs executable failed"
+ mv "${D}"/usr/bin/emacs-emacs-${SLOT} "${D}"/usr/bin/emacs-${SLOT} \
+ || die "moving Emacs executable failed"
+
+ # move info documentation to the correct place
+ einfo "Fixing info documentation ..."
+ for i in "${D}"/usr/share/info/emacs-${SLOT}/*; do
+ mv ${i} ${i}.info || die "mv info failed"
+ done
+
+ # move man pages to the correct place
+ einfo "Fixing manpages ..."
+ for m in "${D}"/usr/share/man/man1/* ; do
+ mv ${m} ${m%.1}-emacs-${SLOT}.1 || die "mv man failed"
+ done
+
+ # 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/
+
+ 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]
+ sed 's/^X//' >00${PN}-${SLOT}-gentoo.el <<-EOF
+ (if (string-match "\\\\\`${FULL_VERSION//./\\\\.}\\\\>" emacs-version)
+ X (setq find-function-C-source-directory
+ X "/usr/share/emacs/${FULL_VERSION}/src"))
+ EOF
+ elisp-site-file-install 00${PN}-${SLOT}-gentoo.el
+ fi
+
+ dodoc AUTHORS BUGS CONTRIBUTE README || die "dodoc failed"
+}
+
+emacs-infodir-rebuild() {
+ # Depending on the Portage version, the Info dir file is compressed
+ # or removed. It is only rebuilt by Portage if our directory is in
+ # INFOPATH, which is not guaranteed. So we rebuild it ourselves.
+
+ local infodir=/usr/share/info/emacs-${SLOT} f
+ einfo "Regenerating Info directory index in ${infodir} ..."
+ rm -f ${ROOT}${infodir}/dir{,.*}
+ for f in ${ROOT}${infodir}/*.info*; do
+ [[ ${f##*/} == *[0-9].info* ]] \
+ || install-info --info-dir=${ROOT}${infodir} ${f} &>/dev/null
+ done
+ echo
+}
+
+pkg_postinst() {
+ test -f ${ROOT}/usr/share/emacs/site-lisp/subdirs.el ||
+ cp ${ROOT}/usr/share/emacs{/${FULL_VERSION},}/site-lisp/subdirs.el
+
+ elisp-site-regen
+ emacs-infodir-rebuild
+
+ if [[ "$(readlink ${ROOT}/usr/bin/emacs)" == emacs.emacs-${SLOT}* ]]; then
+ # transition from pre-eselect revision
+ eselect emacs set emacs-${SLOT}
+ else
+ eselect emacs update --if-unset
+ fi
+
+ if use X; then
+ elog "You need to install some fonts for Emacs. Under monolithic"
+ elog "XFree86/Xorg you typically had such fonts installed by default."
+ elog "With modular Xorg, you will have to perform this step yourself."
+ elog "Installing media-fonts/font-adobe-{75,100}dpi on the X server's"
+ elog "machine would satisfy basic Emacs requirements under X11."
+ fi
+
+ echo
+ elog "You can set the version to be started by /usr/bin/emacs through"
+ elog "the Emacs eselect module. Man and info pages are automatically"
+ elog "redirected, so you may have several installed Emacs versions at the"
+ elog "same time. \"man emacs.eselect\" for details."
+}
+
+pkg_postrm() {
+ elisp-site-regen
+ emacs-infodir-rebuild
+ eselect emacs update --if-unset
+}
diff --git a/app-editors/emacs/files/digest-emacs-22.1 b/app-editors/emacs/files/digest-emacs-22.1
new file mode 100644
index 0000000..44943fd
--- /dev/null
+++ b/app-editors/emacs/files/digest-emacs-22.1
@@ -0,0 +1,3 @@
+MD5 6949df37caec2d7a2e0eee3f1b422726 emacs-22.1.tar.gz 38172226
+RMD160 da5360871db8b1d473ff7f0b0937ee6c278c0b19 emacs-22.1.tar.gz 38172226
+SHA256 1ec43bef7127e572f92d7c3a846951cf8e263e27445c62c867035f94681c3ed0 emacs-22.1.tar.gz 38172226
diff --git a/app-editors/emacs/files/emacs-22.1-Xaw3d-headers.patch b/app-editors/emacs/files/emacs-22.1-Xaw3d-headers.patch
new file mode 100644
index 0000000..8b4f332
--- /dev/null
+++ b/app-editors/emacs/files/emacs-22.1-Xaw3d-headers.patch
@@ -0,0 +1,150 @@
+--- emacs-22.1-orig/src/xfns.c 2007-06-02 06:00:11.000000000 +0200
++++ emacs-22.1/src/xfns.c 2007-07-01 17:19:35.000000000 +0200
+@@ -72,8 +72,13 @@
+ #include <X11/Shell.h>
+
+ #ifndef USE_MOTIF
++#ifdef HAVE_XAW3D
++#include <X11/Xaw3d/Paned.h>
++#include <X11/Xaw3d/Label.h>
++#else /* !HAVE_XAW3D */
+ #include <X11/Xaw/Paned.h>
+ #include <X11/Xaw/Label.h>
++#endif /* HAVE_XAW3D */
+ #endif /* USE_MOTIF */
+
+ #ifdef USG
+--- emacs-22.1-orig/src/xmenu.c 2007-05-14 16:56:31.000000000 +0200
++++ emacs-22.1/src/xmenu.c 2007-07-01 17:19:35.000000000 +0200
+@@ -82,7 +82,11 @@
+ #include <X11/StringDefs.h>
+ #include <X11/Shell.h>
+ #ifdef USE_LUCID
++#ifdef HAVE_XAW3D
++#include <X11/Xaw3d/Paned.h>
++#else /* !HAVE_XAW3D */
+ #include <X11/Xaw/Paned.h>
++#endif /* HAVE_XAW3D */
+ #endif /* USE_LUCID */
+ #include "../lwlib/lwlib.h"
+ #else /* not USE_X_TOOLKIT */
+--- emacs-22.1-orig/lwlib/lwlib.c 2007-04-20 15:27:29.000000000 +0200
++++ emacs-22.1/lwlib/lwlib.c 2007-07-01 17:19:35.000000000 +0200
+@@ -48,7 +48,11 @@
+ #endif /* not USE_MOTIF && USE_LUCID */
+ #endif
+ #if defined (USE_XAW)
++#ifdef HAVE_XAW3D
++#include <X11/Xaw3d/Paned.h>
++#else /* !HAVE_XAW3D */
+ #include <X11/Xaw/Paned.h>
++#endif /* HAVE_XAW3D */
+ #include "lwlib-Xaw.h"
+ #endif
+
+--- emacs-22.1-orig/lwlib/lwlib-Xaw.c 2007-04-20 15:27:29.000000000 +0200
++++ emacs-22.1/lwlib/lwlib-Xaw.c 2007-07-01 17:19:35.000000000 +0200
+@@ -35,12 +35,21 @@
+ #include <X11/CoreP.h>
+ #include <X11/Shell.h>
+
++#ifdef HAVE_XAW3D
++#include <X11/Xaw3d/Scrollbar.h>
++#include <X11/Xaw3d/Paned.h>
++#include <X11/Xaw3d/Dialog.h>
++#include <X11/Xaw3d/Form.h>
++#include <X11/Xaw3d/Command.h>
++#include <X11/Xaw3d/Label.h>
++#else /* !HAVE_XAW3D */
+ #include <X11/Xaw/Scrollbar.h>
+ #include <X11/Xaw/Paned.h>
+ #include <X11/Xaw/Dialog.h>
+ #include <X11/Xaw/Form.h>
+ #include <X11/Xaw/Command.h>
+ #include <X11/Xaw/Label.h>
++#endif /* HAVE_XAW3D */
+
+ #include <X11/Xatom.h>
+
+--- emacs-22.1-orig/configure.in 2007-05-25 14:43:29.000000000 +0200
++++ emacs-22.1/configure.in 2007-07-01 17:19:35.000000000 +0200
+@@ -2205,29 +2205,45 @@
+
+ dnl Do not put whitespace before the #include statements below.
+ dnl Older compilers (eg sunos4 cc) choke on it.
++HAVE_XAW3D=no
+ if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then
+- if test x"${HAVE_X11R5}" = xyes; then
+- AC_MSG_CHECKING(X11 version 5 with Xaw)
+- AC_CACHE_VAL(emacs_cv_x11_version_5_with_xaw,
++ if test x"${HAVE_X11R5}" != xyes; then
++ USE_X_TOOLKIT=none
++ else
++ AC_MSG_CHECKING(for xaw3d)
++ AC_CACHE_VAL(emacs_cv_xaw3d,
+ [AC_TRY_LINK([
+ #include <X11/Intrinsic.h>
+-#include <X11/Xaw/Simple.h>],
++#include <X11/Xaw3d/Simple.h>],
+ [],
+- emacs_cv_x11_version_5_with_xaw=yes,
+- emacs_cv_x11_version_5_with_xaw=no)])
+- if test $emacs_cv_x11_version_5_with_xaw = yes; then
+- AC_MSG_RESULT([5 or newer, with Xaw; use toolkit by default])
++ emacs_cv_xaw3d=yes,
++ emacs_cv_xaw3d=no)])
++ if test $emacs_cv_xaw3d = yes; then
++ AC_MSG_RESULT([yes; using Lucid toolkit])
+ USE_X_TOOLKIT=LUCID
++ HAVE_XAW3D=yes
++ AC_DEFINE(HAVE_XAW3D, 1,
++ [Define to 1 if you have the Xaw3d library (-lXaw3d).])
+ else
+- if test x"${USE_X_TOOLKIT}" = xLUCID; then
++ AC_MSG_RESULT(no)
++ AC_MSG_CHECKING(for libXaw)
++ AC_CACHE_VAL(emacs_cv_xaw,
++ [AC_TRY_LINK([
++#include <X11/Intrinsic.h>
++#include <X11/Xaw/Simple.h>],
++ [],
++ emacs_cv_xaw=yes,
++ emacs_cv_xaw=no)])
++ if test $emacs_cv_xaw = yes; then
++ AC_MSG_RESULT([yes; using Lucid toolkit])
++ USE_X_TOOLKIT=LUCID
++ elif test x"${USE_X_TOOLKIT}" = xLUCID; then
+ AC_MSG_ERROR([Lucid toolkit requires X11/Xaw include files])
+ else
+- AC_MSG_RESULT(before 5 or no Xaw; do not use toolkit by default)
++ AC_MSG_RESULT([no; do not use toolkit by default])
+ USE_X_TOOLKIT=none
+ fi
+ fi
+- else
+- USE_X_TOOLKIT=none
+ fi
+ fi
+
+@@ -2315,21 +2331,6 @@
+ fi
+ fi
+
+-### Is -lXaw3d available?
+-HAVE_XAW3D=no
+-if test "${HAVE_X11}" = "yes"; then
+- if test "${USE_X_TOOLKIT}" != "none" && test "${with_toolkit_scroll_bars}" != "no"; then
+- dnl Fixme: determine what Scrollbar.h needs to avoid compilation
+- dnl errors from the test without the `-'.
+- AC_CHECK_HEADER(X11/Xaw3d/Scrollbar.h,
+- [AC_CHECK_LIB(Xaw3d, XawScrollbarSetThumb, HAVE_XAW3D=yes)], , -)
+- if test "${HAVE_XAW3D}" = "yes"; then
+- AC_DEFINE(HAVE_XAW3D, 1,
+- [Define to 1 if you have the Xaw3d library (-lXaw3d).])
+- fi
+- fi
+-fi
+-
+ dnl Use toolkit scroll bars if configured for GTK or X toolkit and either
+ dnl using Motif or Xaw3d is available, and unless
+ dnl --with-toolkit-scroll-bars=no was specified.
diff --git a/app-editors/emacs/files/emacs-22.1-disable_alsa_detection.patch b/app-editors/emacs/files/emacs-22.1-disable_alsa_detection.patch
new file mode 100644
index 0000000..d4b630f
--- /dev/null
+++ b/app-editors/emacs/files/emacs-22.1-disable_alsa_detection.patch
@@ -0,0 +1,42 @@
+--- configure.in 22 May 2007 15:54:32 -0000 1.448
++++ configure.in 30 May 2007 13:19:39 -0000
+@@ -1590,39 +1590,6 @@
+ # Emulation library used on NetBSD.
+ AC_CHECK_LIB(ossaudio, _oss_ioctl, LIBSOUND=-lossaudio, LIBSOUND=)
+ AC_SUBST(LIBSOUND)
+-
+- ALSA_REQUIRED=1.0.0
+- ALSA_MODULES="alsa >= $ALSA_REQUIRED"
+- dnl Check if --with-pkg-config-prog has been given.
+- if test "X${with_pkg_config_prog}" != X; then
+- PKG_CONFIG="${with_pkg_config_prog}"
+- fi
+- PKG_CHECK_MODULES(ALSA, $ALSA_MODULES, HAVE_ALSA=yes, HAVE_ALSA=no)
+- if test $HAVE_ALSA = yes; then
+- SAVE_CFLAGS="$CFLAGS"
+- SAVE_LDFLAGS="$LDFLAGS"
+- CFLAGS="$ALSA_CFLAGS $CFLAGS"
+- LDFLAGS="$ALSA_LIBS $LDFLAGS"
+- AC_TRY_COMPILE([#include <asoundlib.h>], [snd_lib_error_set_handler (0);],
+- emacs_alsa_normal=yes,
+- emacs_alsa_normal=no)
+- if test "$emacs_alsa_normal" != yes; then
+- AC_TRY_COMPILE([#include <alsa/asoundlib.h>],
+- [snd_lib_error_set_handler (0);],
+- emacs_alsa_subdir=yes,
+- emacs_alsa_subdir=no)
+- if test "$emacs_alsa_subdir" != yes; then
+- AC_MSG_ERROR([pkg-config found alsa, but it does not compile. See config.log for error messages.])
+- fi
+- ALSA_CFLAGS="$ALSA_CFLAGS -DALSA_SUBDIR_INCLUDE"
+- fi
+-
+- CFLAGS="$SAVE_CFLAGS"
+- LDFLAGS="$SAVE_LDFLAGS"
+- LIBSOUND="$LIBSOUND $ALSA_LIBS"
+- CFLAGS_SOUND="$CFLAGS_SOUND $ALSA_CFLAGS"
+- AC_DEFINE(HAVE_ALSA, 1, [Define to 1 if ALSA is available.])
+- fi
+ AC_SUBST(CFLAGS_SOUND)
+ fi
+
diff --git a/app-editors/emacs/files/emacs-22.1-freebsd-sparc.patch b/app-editors/emacs/files/emacs-22.1-freebsd-sparc.patch
new file mode 100644
index 0000000..d5e0793
--- /dev/null
+++ b/app-editors/emacs/files/emacs-22.1-freebsd-sparc.patch
@@ -0,0 +1,13 @@
+Index: emacs/src/alloc.c
+===================================================================
+--- emacs.orig/src/alloc.c
++++ emacs/src/alloc.c
+@@ -4522,7 +4522,7 @@ mark_stack ()
+ /* Fixme: Code in the Boehm GC suggests flushing (with `flushrs') is
+ needed on ia64 too. See mach_dep.c, where it also says inline
+ assembler doesn't work with relevant proprietary compilers. */
+-#ifdef sparc
++#if defined(sparc) && !defined(__FreeBSD__)
+ asm ("ta 3");
+ #endif
+
diff --git a/app-editors/emacs/files/emacs-22.1-oldxmenu-qa.patch b/app-editors/emacs/files/emacs-22.1-oldxmenu-qa.patch
new file mode 100644
index 0000000..4c962c1
--- /dev/null
+++ b/app-editors/emacs/files/emacs-22.1-oldxmenu-qa.patch
@@ -0,0 +1,20 @@
+--- emacs-22.1-orig/oldXMenu/ChgPane.c 2007-02-27 04:04:22.000000000 +0100
++++ emacs-22.1/oldXMenu/ChgPane.c 2007-06-04 00:47:56.000000000 +0200
+@@ -13,6 +13,7 @@
+ *
+ */
+
++#include <config.h>
+ #include "XMenuInt.h"
+
+ int
+--- emacs-22.1-orig/oldXMenu/ChgSel.c 2007-02-27 04:04:22.000000000 +0100
++++ emacs-22.1/oldXMenu/ChgSel.c 2007-06-04 00:47:42.000000000 +0200
+@@ -13,6 +13,7 @@
+ *
+ */
+
++#include <config.h>
+ #include "XMenuInt.h"
+
+ int
diff --git a/app-editors/emacs/files/emacs-22.1-xembed.patch b/app-editors/emacs/files/emacs-22.1-xembed.patch
new file mode 100644
index 0000000..3c31c3b
--- /dev/null
+++ b/app-editors/emacs/files/emacs-22.1-xembed.patch
@@ -0,0 +1,361 @@
+diff -Nur emacs-22.1-orig/lisp/startup.el emacs-22.1/lisp/startup.el
+--- emacs-22.1-orig/lisp/startup.el 2007-05-14 16:56:29.000000000 +0200
++++ emacs-22.1/lisp/startup.el 2007-07-14 03:13:43.000000000 +0200
+@@ -151,7 +151,8 @@
+ ("--vertical-scroll-bars" 0 x-handle-switch vertical-scroll-bars t)
+ ("--line-spacing" 1 x-handle-numeric-switch line-spacing)
+ ("--border-color" 1 x-handle-switch border-color)
+- ("--smid" 1 x-handle-smid))
++ ("--smid" 1 x-handle-smid)
++ ("--parent-id" 1 x-handle-parent-id))
+ "Alist of X Windows options.
+ Each element has the form
+ (NAME NUMARGS HANDLER FRAME-PARAM VALUE)
+diff -Nur emacs-22.1-orig/lisp/term/x-win.el emacs-22.1/lisp/term/x-win.el
+--- emacs-22.1-orig/lisp/term/x-win.el 2007-03-06 06:50:48.000000000 +0100
++++ emacs-22.1/lisp/term/x-win.el 2007-07-14 03:13:43.000000000 +0200
+@@ -181,6 +181,15 @@
+ (setq initial-frame-alist (cons (cons 'name x-resource-name)
+ initial-frame-alist)))
+
++;; Handle the --parent-id option.
++(defun x-handle-parent-id (switch)
++ (or (consp x-invocation-args)
++ (error "%s: missing argument to `%s' option" (invocation-name) switch))
++ (setq parent-id (string-to-number (car x-invocation-args))
++ x-invocation-args (cdr x-invocation-args))
++ (setq initial-frame-alist (cons (cons 'parent-id parent-id)
++ initial-frame-alist)))
++
+ (defvar x-display-name nil
+ "The name of the X display on which Emacs was started.
+
+diff -Nur emacs-22.1-orig/src/emacs.c emacs-22.1/src/emacs.c
+--- emacs-22.1-orig/src/emacs.c 2007-04-22 05:45:41.000000000 +0200
++++ emacs-22.1/src/emacs.c 2007-07-14 03:13:43.000000000 +0200
+@@ -325,6 +325,7 @@
+ --title, -T TITLE title for initial Emacs frame\n\
+ --vertical-scroll-bars, -vb enable vertical scroll bars\n\
+ --xrm XRESOURCES set additional X resources\n\
++--parent-id XID set parent window\n\
+ --help display this help and exit\n\
+ --version output version information and exit\n\
+ \n"
+@@ -1835,6 +1836,7 @@
+ { "-title", 0, 10, 1 },
+ { "-name", "--name", 10, 1 },
+ { "-xrm", "--xrm", 10, 1 },
++ { "-parent-id", "--parent-id", 10, 1 },
+ { "-r", "--reverse-video", 5, 0 },
+ { "-rv", 0, 5, 0 },
+ { "-reverse", 0, 5, 0 },
+diff -Nur emacs-22.1-orig/src/gtkutil.c emacs-22.1/src/gtkutil.c
+--- emacs-22.1-orig/src/gtkutil.c 2007-05-14 16:56:31.000000000 +0200
++++ emacs-22.1/src/gtkutil.c 2007-07-14 03:13:57.000000000 +0200
+@@ -769,7 +769,11 @@
+
+ BLOCK_INPUT;
+
+- wtop = gtk_window_new (GTK_WINDOW_TOPLEVEL);
++ if (FRAME_X_EMBEDDED_P (f))
++ wtop = gtk_plug_new (f->output_data.x->parent_desc);
++ else
++ wtop = gtk_window_new (GTK_WINDOW_TOPLEVEL);
++
+ xg_set_screen (wtop, f);
+
+ wvbox = gtk_vbox_new (FALSE, 0);
+diff -Nur emacs-22.1-orig/src/xfns.c emacs-22.1/src/xfns.c
+--- emacs-22.1-orig/src/xfns.c 2007-07-14 03:11:59.000000000 +0200
++++ emacs-22.1/src/xfns.c 2007-07-14 03:14:20.000000000 +0200
+@@ -2609,6 +2609,10 @@
+ XtManageChild (pane_widget);
+ XtRealizeWidget (shell_widget);
+
++ if (FRAME_X_EMBEDDED_P (f))
++ XReparentWindow (FRAME_X_DISPLAY (f), XtWindow (shell_widget),
++ f->output_data.x->parent_desc, 0, 0);
++
+ FRAME_X_WINDOW (f) = XtWindow (frame_widget);
+
+ validate_x_resource_name ();
+@@ -3267,8 +3271,10 @@
+ xlwmenu_default_font = FRAME_FONT (f);
+ #endif
+
+- x_default_parameter (f, parms, Qborder_width, make_number (2),
+- "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
++ /* Frame contents get displaced if an embedded X window has a border. */
++ if (! FRAME_X_EMBEDDED_P (f))
++ x_default_parameter (f, parms, Qborder_width, make_number (2),
++ "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
+
+ /* This defaults to 1 in order to match xterm. We recognize either
+ internalBorderWidth or internalBorder (which is what xterm calls
+@@ -3339,8 +3345,6 @@
+ x_default_parameter (f, parms, Qfullscreen, Qnil,
+ "fullscreen", "Fullscreen", RES_TYPE_SYMBOL);
+
+- f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window;
+-
+ /* Compute the size of the X window. */
+ window_prompting = x_figure_window_size (f, parms, 1);
+
+diff -Nur emacs-22.1-orig/src/xterm.c emacs-22.1/src/xterm.c
+--- emacs-22.1-orig/src/xterm.c 2007-05-25 14:43:35.000000000 +0200
++++ emacs-22.1/src/xterm.c 2007-07-14 03:14:11.000000000 +0200
+@@ -3306,6 +3306,15 @@
+ FOCUS_IMPLICIT : FOCUS_EXPLICIT),
+ dpyinfo, frame, bufp);
+ break;
++
++ case ClientMessage:
++ if (event->xclient.message_type == dpyinfo->Xatom_XEMBED)
++ {
++ enum xembed_message msg = event->xclient.data.l[1];
++ x_focus_changed ((msg == XEMBED_FOCUS_IN ? FocusIn : FocusOut),
++ FOCUS_EXPLICIT, dpyinfo, frame, bufp);
++ }
++ break;
+ }
+ }
+
+@@ -5876,6 +5885,18 @@
+ }
+ #endif /* USE_TOOLKIT_SCROLL_BARS */
+
++ /* XEmbed messages from the embedder (if any). */
++ if (event.xclient.message_type
++ == dpyinfo->Xatom_XEMBED)
++ {
++ enum xembed_message msg = event.xclient.data.l[1];
++ if (msg == XEMBED_FOCUS_IN || msg == XEMBED_FOCUS_OUT)
++ x_detect_focus_change (dpyinfo, &event, &inev.ie);
++
++ *finish = X_EVENT_GOTO_OUT;
++ goto done;
++ }
++
+ f = x_any_window_to_frame (dpyinfo, event.xclient.window);
+ if (!f)
+ goto OTHER;
+@@ -6796,6 +6817,10 @@
+ else
+ construct_mouse_click (&inev.ie, &event.xbutton, f);
+ }
++
++ if (FRAME_X_EMBEDDED_P (f))
++ xembed_send_message (f, event.xbutton.time,
++ XEMBED_REQUEST_FOCUS, 0, 0, 0);
+ }
+ }
+ else
+@@ -8889,6 +8914,51 @@
+ x_lower_frame (f);
+ }
+
++/* XEmbed implementation. */
++
++void
++xembed_set_info (f, flags)
++ struct frame *f;
++ enum xembed_info flags;
++{
++ Atom atom;
++ unsigned long data[2];
++
++ atom = XInternAtom (FRAME_X_DISPLAY (f), "_XEMBED_INFO", False);
++
++ data[0] = XEMBED_VERSION;
++ data[1] = flags;
++
++ XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), atom, atom,
++ 32, PropModeReplace, (unsigned char *) data, 2);
++}
++
++void
++xembed_send_message (f, time, message, detail, data1, data2)
++ struct frame *f;
++ Time time;
++ enum xembed_message message;
++ long detail;
++ long data1;
++ long data2;
++{
++ XEvent event;
++
++ event.xclient.type = ClientMessage;
++ event.xclient.window = FRAME_X_OUTPUT (f)->parent_desc;
++ event.xclient.message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_XEMBED;
++ event.xclient.format = 32;
++ event.xclient.data.l[0] = time;
++ event.xclient.data.l[1] = message;
++ event.xclient.data.l[2] = detail;
++ event.xclient.data.l[3] = data1;
++ event.xclient.data.l[4] = data2;
++
++ XSendEvent (FRAME_X_DISPLAY (f), FRAME_X_OUTPUT (f)->parent_desc,
++ False, NoEventMask, &event);
++ XSync (FRAME_X_DISPLAY (f), False);
++}
++
+ /* Change of visibility. */
+
+ /* This tries to wait until the frame is really visible.
+@@ -8921,6 +8991,7 @@
+ if we get to x_make_frame_visible a second time
+ before the window gets really visible. */
+ if (! FRAME_ICONIFIED_P (f)
++ && ! FRAME_X_EMBEDDED_P (f)
+ && ! f->output_data.x->asked_for_visible)
+ x_set_offset (f, f->left_pos, f->top_pos, 0);
+
+@@ -8929,14 +9000,22 @@
+ if (! EQ (Vx_no_window_manager, Qt))
+ x_wm_set_window_state (f, NormalState);
+ #ifdef USE_X_TOOLKIT
+- /* This was XtPopup, but that did nothing for an iconified frame. */
+- XtMapWidget (f->output_data.x->widget);
++ if (FRAME_X_EMBEDDED_P (f))
++ xembed_set_info (f, XEMBED_MAPPED);
++ else
++ {
++ /* This was XtPopup, but that did nothing for an iconified frame. */
++ XtMapWidget (f->output_data.x->widget);
++ }
+ #else /* not USE_X_TOOLKIT */
+ #ifdef USE_GTK
+ gtk_widget_show_all (FRAME_GTK_OUTER_WIDGET (f));
+ gtk_window_deiconify (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)));
+ #else
+- XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
++ if (FRAME_X_EMBEDDED_P (f))
++ xembed_set_info (f, XEMBED_MAPPED);
++ else
++ XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
+ #endif /* not USE_GTK */
+ #endif /* not USE_X_TOOLKIT */
+ #if 0 /* This seems to bring back scroll bars in the wrong places
+@@ -8977,7 +9056,9 @@
+ because the window manager may choose the position
+ and we don't want to override it. */
+
+- if (! FRAME_VISIBLE_P (f) && ! FRAME_ICONIFIED_P (f)
++ if (! FRAME_VISIBLE_P (f)
++ && ! FRAME_ICONIFIED_P (f)
++ && ! FRAME_X_EMBEDDED_P (f)
+ && f->win_gravity == NorthWestGravity
+ && previously_visible)
+ {
+@@ -9088,6 +9169,10 @@
+ if (FRAME_GTK_OUTER_WIDGET (f))
+ gtk_widget_hide (FRAME_GTK_OUTER_WIDGET (f));
+ else
++#else
++ if (FRAME_X_EMBEDDED_P (f))
++ xembed_set_info (f, 0);
++ else
+ #endif
+ {
+ #ifdef HAVE_X11R4
+@@ -9218,7 +9303,9 @@
+
+ /* Make sure the X server knows where the window should be positioned,
+ in case the user deiconifies with the window manager. */
+- if (! FRAME_VISIBLE_P (f) && !FRAME_ICONIFIED_P (f))
++ if (! FRAME_VISIBLE_P (f)
++ && ! FRAME_ICONIFIED_P (f)
++ && ! FRAME_X_EMBEDDED_P (f))
+ x_set_offset (f, f->left_pos, f->top_pos, 0);
+
+ /* Since we don't know which revision of X we're running, we'll use both
+@@ -10851,6 +10938,9 @@
+ dpyinfo->Xatom_Scrollbar = XInternAtom (dpyinfo->display, "SCROLLBAR",
+ False);
+
++ dpyinfo->Xatom_XEMBED = XInternAtom (dpyinfo->display, "_XEMBED",
++ False);
++
+ dpyinfo->cut_buffers_initialized = 0;
+
+ dpyinfo->x_dnd_atoms_size = 8;
+diff -Nur emacs-22.1-orig/src/xterm.h emacs-22.1/src/xterm.h
+--- emacs-22.1-orig/src/xterm.h 2007-01-21 05:18:14.000000000 +0100
++++ emacs-22.1/src/xterm.h 2007-07-14 03:13:57.000000000 +0200
+@@ -327,6 +327,9 @@
+ /* Atom used in toolkit scroll bar client messages. */
+ Atom Xatom_Scrollbar;
+
++ /* Atom used in XEmbed client messages. */
++ Atom Xatom_XEMBED;
++
+ #ifdef MULTI_KBOARD
+ struct kboard *kboard;
+ #endif
+@@ -1101,6 +1104,66 @@
+ extern int x_session_have_connection P_ ((void));
+ #endif
+
++/* XEmbed implementation. */
++
++#define XEMBED_VERSION 0
++
++enum xembed_info
++ {
++ XEMBED_MAPPED = 1 << 0
++ };
++
++enum xembed_message
++ {
++ XEMBED_EMBEDDED_NOTIFY = 0,
++ XEMBED_WINDOW_ACTIVATE = 1,
++ XEMBED_WINDOW_DEACTIVATE = 2,
++ XEMBED_REQUEST_FOCUS = 3,
++ XEMBED_FOCUS_IN = 4,
++ XEMBED_FOCUS_OUT = 5,
++ XEMBED_FOCUS_NEXT = 6,
++ XEMBED_FOCUS_PREV = 7,
++
++ XEMBED_MODALITY_ON = 10,
++ XEMBED_MODALITY_OFF = 11,
++ XEMBED_REGISTER_ACCELERATOR = 12,
++ XEMBED_UNREGISTER_ACCELERATOR = 13,
++ XEMBED_ACTIVATE_ACCELERATOR = 14
++ };
++
++enum xembed_focus
++ {
++ XEMBED_FOCUS_CURRENT = 0,
++ XEMBED_FOCUS_FIRST = 1,
++ XEMBED_FOCUS_LAST = 2
++ };
++
++enum xembed_modifier
++ {
++ XEMBED_MODIFIER_SHIFT = 1 << 0,
++ XEMBED_MODIFIER_CONTROL = 1 << 1,
++ XEMBED_MODIFIER_ALT = 1 << 2,
++ XEMBED_MODIFIER_SUPER = 1 << 3,
++ XEMBED_MODIFIER_HYPER = 1 << 4
++ };
++
++enum xembed_accelerator
++ {
++ XEMBED_ACCELERATOR_OVERLOADED = 1 << 0
++ };
++
++/* Defined in xterm.c */
++
++extern void xembed_set_info P_ ((struct frame *f, enum xembed_info flags));
++extern void xembed_send_message P_ ((struct frame *f, Time time,
++ enum xembed_message message,
++ long detail, long data1, long data2));
++
++/* Is the frame embedded into another application? */
++
++#define FRAME_X_EMBEDDED_P(f) (FRAME_X_OUTPUT(f)->explicit_parent != 0)
++
++
+ #define FONT_TYPE_FOR_UNIBYTE(font, ch) 0
+ #define FONT_TYPE_FOR_MULTIBYTE(font, ch) 0
+
diff --git a/app-editors/emacs/metadata.xml b/app-editors/emacs/metadata.xml
new file mode 100644
index 0000000..bc306fe
--- /dev/null
+++ b/app-editors/emacs/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>emacs</herd>
+</pkgmetadata>