summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2018-07-28 21:25:15 +0200
committerUlrich Müller <ulm@gentoo.org>2018-07-28 21:26:10 +0200
commit0a7587ec5063edaeeb4698339e699d97e8a1a465 (patch)
tree5c9faa67933b34a4f554e3ac932df28d88fa6d2a
parentapp-editors/xemacs: Remove since outdated as compared to gentoo repo (diff)
downloademacs-0a7587ec5063edaeeb4698339e699d97e8a1a465.tar.gz
emacs-0a7587ec5063edaeeb4698339e699d97e8a1a465.tar.bz2
emacs-0a7587ec5063edaeeb4698339e699d97e8a1a465.zip
app-editors/emacs: Restore emacs-24.3 for compatibility testing.
This version is for investigation of some problems with app-emacs/vm and PGP encryption/decryption, where 24.3 is the last known good version. I publish this ebuild only because it was surprisingly hard to make this version build again, given the fact that there are working ebuilds for both 23.4 and 24.5. Since it is meant as a temporary solution, there is no consolidated patchset. Only the patches necessary to make it build are applied. Also some less important features (like shared game score files) have been dropped. Package-Manager: Portage-2.3.43, Repoman-2.3.10
-rw-r--r--app-editors/emacs/Manifest5
-rw-r--r--app-editors/emacs/emacs-24.3-r7.ebuild377
-rw-r--r--app-editors/emacs/files/emacs-24.3-data-start.patch626
-rw-r--r--app-editors/emacs/files/emacs-24.3-giflib-5.patch168
-rw-r--r--app-editors/emacs/files/emacs-24.3-jpeg-version.patch25
-rw-r--r--app-editors/emacs/metadata.xml44
6 files changed, 1245 insertions, 0 deletions
diff --git a/app-editors/emacs/Manifest b/app-editors/emacs/Manifest
new file mode 100644
index 0000000..3d9a59e
--- /dev/null
+++ b/app-editors/emacs/Manifest
@@ -0,0 +1,5 @@
+DIST emacs-23.4-patches-21.tar.xz 19604 BLAKE2B 97327f2079c496c28122203d233a12199a3c11a8c4efb2107247a4ca4483b898467d73d19d4f0570ec7be2a49dc5f6bd1bc9ee0811f932e7deb6b1c4ca96e362 SHA512 135eda432de64200797456d594f7de811275a7adf792d10a1c3a51ca4bbbbaa3a2c682b9fd577c4d93fbce967ca08d4ac47eb45f031477c3e44c69c14d5d5b48
+DIST emacs-24.3-patches-7.tar.xz 6484 BLAKE2B 42da9c01a6fc7fd44b9281f11e1aed9ccc7273533c6deeab54125cabad9ff25757c410f43e32f55e13fc0d5354688a4fdd7e5c05dd8a98e36d9cd1a87f414ce9 SHA512 6e3f6f053ad66e6d298b4fd904c57a6c2a03269ec53e9dfc56f834672a42c8f48eeb20a7ed1bcfb534eb62e0cca6e01b4a1663bebb046a0ce7325b732a378868
+DIST emacs-24.3.tar.xz 35565352 BLAKE2B 12474f0d4fb99449bb226834aabcaa15aa4e6c3cd6382786959636d53ea1c9a9662cb158cd6c88589e2760bd3030c3970c919fe35967a90830b77fce9e315df8 SHA512 a1300fa10a9fba2db9735db3d01382bcda89ceec033976c4622796dfdf6d2748ed5fa73edf229182b368190c8acbf706810dd5f344542d2c0d294154bc2d0ca9
+DIST emacs-24.4-patches-5.tar.xz 6000 BLAKE2B 5a36e15de2237e8c42bbc57038c301ad9548a24af08b072dcfd175f07950605804649c5c4c3fd3504a864bf314d6a742c588cad26b84a1c283de68e4adb139fd SHA512 0a337ad5b7601f5e453645d1fba99717328c6bc7a5505bcb4bd8e853179cf61be43eb6f3b9370edf0f44aa6485d4847c14554c1592ccc7da87b10dabaaa9d421
+DIST emacs-24.5-patches-4.tar.xz 13632 BLAKE2B 99e70f4ee32c1ba3a66b934de692437aaf0b83eb6fa841ce4569bc58e2bd12802890c2a8496375280c0ce8fa56515918dfdcbc958f349bc2472104e37ad1fcd1 SHA512 569c3a55aaf1102c0bae4ab25ee06372763cd2de8a54e26b3eefd54e585cf90b53c8ffe1ca48eb4fd312a340380fd3f2fcdb584697814bf429129b48fa56ffb5
diff --git a/app-editors/emacs/emacs-24.3-r7.ebuild b/app-editors/emacs/emacs-24.3-r7.ebuild
new file mode 100644
index 0000000..b013715
--- /dev/null
+++ b/app-editors/emacs/emacs-24.3-r7.ebuild
@@ -0,0 +1,377 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools elisp-common eutils flag-o-matic multilib readme.gentoo-r1
+
+DESCRIPTION="The extensible, customizable, self-documenting real-time display editor"
+HOMEPAGE="https://www.gnu.org/software/emacs/"
+SRC_URI="mirror://gnu/emacs/${P}.tar.xz
+ https://dev.gentoo.org/~ulm/emacs/${P}-patches-7.tar.xz
+ https://dev.gentoo.org/~ulm/emacs/${PN}-23.4-patches-21.tar.xz
+ https://dev.gentoo.org/~ulm/emacs/${PN}-24.4-patches-5.tar.xz
+ https://dev.gentoo.org/~ulm/emacs/${PN}-24.5-patches-4.tar.xz"
+
+LICENSE="GPL-3+ FDL-1.3+ BSD HPND MIT W3C unicode PSF-2"
+SLOT="24.3"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="alsa aqua athena dbus gconf gif gpm gsettings gtk +gtk3 gzip-el imagemagick jpeg kerberos libxml2 livecd m17n-lib motif png selinux sound source ssl svg tiff toolkit-scroll-bars wide-int X Xaw3d xft +xpm"
+REQUIRED_USE="?? ( aqua X )"
+
+RDEPEND="sys-libs/ncurses:0=
+ >=app-eselect/eselect-emacs-1.16
+ >=app-emacs/emacs-common-gentoo-1.5[X?]
+ net-libs/liblockfile
+ alsa? ( media-libs/alsa-lib )
+ dbus? ( sys-apps/dbus )
+ gpm? ( sys-libs/gpm )
+ kerberos? ( virtual/krb5 )
+ libxml2? ( >=dev-libs/libxml2-2.2.0 )
+ selinux? ( sys-libs/libselinux )
+ ssl? ( net-libs/gnutls:0= )
+ X? (
+ x11-libs/libICE
+ x11-libs/libSM
+ x11-libs/libX11
+ x11-libs/libXext
+ x11-libs/libXinerama
+ x11-libs/libXrandr
+ x11-misc/xbitmaps
+ gconf? ( >=gnome-base/gconf-2.26.2 )
+ gsettings? ( >=dev-libs/glib-2.28.6 )
+ gif? ( media-libs/giflib:0= )
+ jpeg? ( virtual/jpeg:0= )
+ png? ( >=media-libs/libpng-1.4:0= )
+ svg? ( >=gnome-base/librsvg-2.0 )
+ tiff? ( media-libs/tiff:0 )
+ xpm? ( x11-libs/libXpm )
+ imagemagick? ( >=media-gfx/imagemagick-6.6.2:0= )
+ xft? (
+ media-libs/fontconfig
+ media-libs/freetype
+ x11-libs/libXft
+ x11-libs/libXrender
+ m17n-lib? (
+ >=dev-libs/libotf-0.9.4
+ >=dev-libs/m17n-lib-1.5.1
+ )
+ )
+ gtk? (
+ gtk3? ( x11-libs/gtk+:3 )
+ !gtk3? ( x11-libs/gtk+:2 )
+ )
+ !gtk? (
+ motif? (
+ >=x11-libs/motif-2.3:0
+ x11-libs/libXpm
+ x11-libs/libXmu
+ x11-libs/libXt
+ )
+ !motif? (
+ Xaw3d? (
+ x11-libs/libXaw3d
+ x11-libs/libXmu
+ x11-libs/libXt
+ )
+ !Xaw3d? ( athena? (
+ x11-libs/libXaw
+ x11-libs/libXmu
+ x11-libs/libXt
+ ) )
+ )
+ )
+ )"
+
+DEPEND="${RDEPEND}
+ X? ( x11-base/xorg-proto )"
+
+BDEPEND="virtual/pkgconfig
+ gzip-el? ( app-arch/gzip )"
+# pax_kernel? ( sys-apps/attr )
+
+RDEPEND="${RDEPEND}
+ !<app-editors/emacs-vcs-${PV}"
+
+EMACS_SUFFIX="${PN/emacs/emacs-${SLOT}}"
+SITEFILE="20${PN}-${SLOT}-gentoo.el"
+# 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%%_*}"
+S="${WORKDIR}/emacs-${FULL_VERSION}"
+
+src_unpack() {
+ unpack ${P}.tar.xz
+ unpack ${PN}-23.4-patches-21.tar.xz; mv patch{,-23.4} || die
+ unpack ${PN}-24.4-patches-5.tar.xz; mv patch{,-24.4} || die
+ unpack ${PN}-24.5-patches-4.tar.xz; mv patch{,-24.5} || die
+ unpack ${P}-patches-7.tar.xz
+}
+
+src_prepare() {
+ eapply ../patch \
+ ../patch-23.4/28_all_gmalloc.patch \
+ ../patch-24.4/03_all_gnus-image.patch \
+ ../patch-24.4/05_all_browse-url-firefox.patch \
+ ../patch-24.5/08_all_enriched-mode.patch \
+ "${FILESDIR}"/${P}-jpeg-version.patch \
+ "${FILESDIR}"/${P}-giflib-5.patch \
+ "${FILESDIR}"/${P}-data-start.patch
+ eapply_user
+
+ # Fix filename reference in redirected man page
+ sed -i -e "/^\\.so/s/etags/&-${EMACS_SUFFIX}/" doc/man/ctags.1 \
+ || die "unable to sed ctags.1"
+
+ 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.ac \
+ || die "unable to sed configure.ac"
+ 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 "/AC_PATH_PROG/s/gzip/PrEvEnTcOmPrEsSiOn/" configure.ac \
+ || die "unable to sed configure.ac"
+ fi
+
+ AT_M4DIR=m4 eautoreconf
+ touch src/stamp-h.in || die
+}
+
+src_configure() {
+ strip-flags
+ filter-flags -pie #526948
+ append-ldflags $(test-flags -no-pie) #639570
+
+ if use sh; then
+ replace-flags "-O[1-9]" -O0 #262359
+ elif use ia64; then
+ replace-flags "-O[2-9]" -O1 #325373
+ else
+ replace-flags "-O[3-9]" -O2
+ fi
+
+ # Don't trigger a floating point exception for NaNs on alpha
+ use alpha && append-flags -mieee
+
+ 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+=" --with-sound"
+ else
+ myconf+=" $(use_with sound)"
+ fi
+
+ if use X; then
+ myconf+=" --with-x --without-ns"
+ myconf+=" $(use_with gconf)"
+ myconf+=" $(use_with gsettings)"
+ myconf+=" $(use_with toolkit-scroll-bars)"
+ myconf+=" $(use_with gif)"
+ myconf+=" $(use_with jpeg)"
+ myconf+=" $(use_with png)"
+ myconf+=" $(use_with svg rsvg)"
+ myconf+=" $(use_with tiff)"
+ myconf+=" $(use_with xpm)"
+ myconf+=" $(use_with imagemagick)"
+
+ if use xft; then
+ myconf+=" --with-xft"
+ myconf+=" $(use_with m17n-lib libotf)"
+ myconf+=" $(use_with m17n-lib m17n-flt)"
+ else
+ myconf+=" --without-xft"
+ myconf+=" --without-libotf --without-m17n-flt"
+ use m17n-lib && ewarn \
+ "USE flag \"m17n-lib\" has no effect if \"xft\" is not set."
+ fi
+
+ local f line
+ if use gtk; then
+ einfo "Configuring to build with GIMP Toolkit (GTK+)"
+ while read line; do ewarn "${line}"; done <<-EOF
+ Your version of GTK+ will have problems with closing open
+ displays. This is no problem if you just use one display, but
+ if you use more than one and close one of them Emacs may crash.
+ See <https://bugzilla.gnome.org/show_bug.cgi?id=85715>.
+ If you intend to use more than one display, then it is strongly
+ recommended that you compile Emacs with the Athena/Lucid or the
+ Motif toolkit instead.
+ EOF
+ myconf+=" --with-x-toolkit=$(usex gtk3 gtk3 gtk2)"
+ for f in motif Xaw3d athena; do
+ use ${f} && ewarn \
+ "USE flag \"${f}\" has no effect if \"gtk\" is set."
+ done
+ elif use motif; then
+ einfo "Configuring to build with Motif toolkit"
+ myconf+=" --with-x-toolkit=motif"
+ for f in Xaw3d athena; do
+ use ${f} && ewarn \
+ "USE flag \"${f}\" has no effect if \"motif\" is set."
+ done
+ elif use athena || use Xaw3d; then
+ einfo "Configuring to build with Athena/Lucid toolkit"
+ myconf+=" --with-x-toolkit=lucid $(use_with Xaw3d xaw3d)"
+ else
+ einfo "Configuring to build with no toolkit"
+ myconf+=" --with-x-toolkit=no"
+ fi
+ elif use aqua; then
+ einfo "Configuring to build with Nextstep (Cocoa) support"
+ myconf+=" --with-ns --disable-ns-self-contained"
+ myconf+=" --without-x"
+ else
+ myconf+=" --without-x --without-ns"
+ fi
+
+ econf \
+ --program-suffix="-${EMACS_SUFFIX}" \
+ --infodir="${EPREFIX}"/usr/share/info/${EMACS_SUFFIX} \
+ --localstatedir="${EPREFIX}"/var \
+ --enable-locallisppath="${EPREFIX}/etc/emacs:${EPREFIX}${SITELISP}" \
+ --without-gameuser \
+ --without-compress-info \
+ --without-hesiod \
+ $(use_with dbus) \
+ $(use_with gpm) \
+ $(use_with kerberos) $(use_with kerberos kerberos5) \
+ $(use_with libxml2 xml2) \
+ $(use_with selinux) \
+ $(use_with ssl gnutls) \
+ $(use_with wide-int) \
+ ${myconf}
+}
+
+src_compile() {
+ # Disable sandbox when dumping. For the unbelievers, see bug #131505
+ emake RUN_TEMACS="SANDBOX_ON=0 LD_PRELOAD= env ./temacs"
+}
+
+src_install () {
+ emake DESTDIR="${D}" NO_BIN_LINK=t install
+
+ mv "${ED}"/usr/bin/{emacs-${FULL_VERSION}-,}${EMACS_SUFFIX} \
+ || die "moving emacs executable failed"
+ mv "${ED}"/usr/share/man/man1/{emacs-,}${EMACS_SUFFIX}.1 \
+ || die "moving emacs man page failed"
+
+ # move info dir to avoid collisions with the dir file generated by portage
+ mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{,.orig} \
+ || die "moving info dir failed"
+ touch "${ED}"/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 "${ED}"/usr/share/emacs/site-lisp/subdirs.el
+ rm -rf "${ED}"/usr/share/{applications,icons}
+ rm -rf "${ED}"/var
+
+ # remove unused <version>/site-lisp dir
+ rm -rf "${ED}"/usr/share/emacs/${FULL_VERSION}/site-lisp
+
+ # remove COPYING file (except for etc/COPYING used by describe-copying)
+ rm "${ED}"/usr/share/emacs/${FULL_VERSION}/lisp/COPYING
+
+ local cdir
+ if use source; then
+ cdir="/usr/share/emacs/${FULL_VERSION}/src"
+ insinto "${cdir}"
+ # This is not meant to install all the source -- just the
+ # C source you might find via find-function
+ doins src/*.{c,h,m}
+ elif has installsources ${FEATURES}; then
+ cdir="/usr/src/debug/${CATEGORY}/${PF}/${S#"${WORKDIR}/"}/src"
+ fi
+
+ sed -e "${cdir:+#}/^Y/d" -e "s/^[XY]//" >"${T}/${SITEFILE}" <<-EOF || die
+ X
+ ;;; ${PN}-${SLOT} site-lisp configuration
+ X
+ (when (string-match "\\\\\`${FULL_VERSION//./\\\\.}\\\\>" emacs-version)
+ Y (setq find-function-C-source-directory
+ Y "${EPREFIX}${cdir}")
+ X (let ((path (getenv "INFOPATH"))
+ X (dir "${EPREFIX}/usr/share/info/${EMACS_SUFFIX}")
+ X (re "\\\\\`${EPREFIX}/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 README BUGS
+
+ if use aqua; then
+ dodir /Applications/Gentoo
+ rm -rf "${ED}"/Applications/Gentoo/Emacs${EMACS_SUFFIX#emacs}.app
+ mv nextstep/Emacs.app \
+ "${ED}"/Applications/Gentoo/Emacs${EMACS_SUFFIX#emacs}.app || die
+ fi
+
+ DOC_CONTENTS="You can set the version to be started by /usr/bin/emacs
+ through the Emacs eselect module, which also redirects man and info
+ pages. Therefore, several Emacs versions can be installed at the
+ same time. \"man emacs.eselect\" for details.
+ \\n\\nIf you upgrade from Emacs version 24.2 or earlier, then it is
+ strongly recommended that you use app-admin/emacs-updater to rebuild
+ all byte-compiled elisp files of the installed Emacs packages."
+ use X && DOC_CONTENTS+="\\n\\nYou need to install some fonts for Emacs.
+ Installing media-fonts/font-adobe-{75,100}dpi on the X server's
+ machine would satisfy basic Emacs requirements under X11.
+ See also https://wiki.gentoo.org/wiki/Xft_support_for_GNU_Emacs
+ for how to enable anti-aliased fonts."
+ use aqua && DOC_CONTENTS+="\\n\\nEmacs${EMACS_SUFFIX#emacs}.app is in
+ \"${EPREFIX}/Applications/Gentoo\". You may want to copy or symlink
+ it into /Applications by yourself."
+ readme.gentoo_create_doc
+}
+
+pkg_preinst() {
+ # move Info dir file to correct name
+ local infodir=/usr/share/info/${EMACS_SUFFIX} f
+ if [[ -f ${ED}${infodir}/dir.orig ]]; then
+ mv "${ED}"${infodir}/dir{.orig,} || die "moving info dir failed"
+ elif [[ -d "${ED}"${infodir} ]]; then
+ # this should not happen in EAPI 4
+ ewarn "Regenerating Info directory index in ${infodir} ..."
+ rm -f "${ED}"${infodir}/dir{,.*}
+ for f in "${ED}"${infodir}/*; do
+ if [[ ${f##*/} != *-[0-9]* && -e ${f} ]]; then
+ install-info --info-dir="${ED}"${infodir} "${f}" \
+ || die "install-info failed"
+ fi
+ done
+ fi
+}
+
+pkg_postinst() {
+ elisp-site-regen
+ readme.gentoo_print_elog
+
+ if use livecd; then
+ # force an update of the emacs symlink for the livecd/dvd,
+ # because some microemacs packages set it with USE=livecd
+ eselect emacs update
+ elif [[ $(readlink "${EROOT}"/usr/bin/emacs) = ${EMACS_SUFFIX} ]]; then
+ # refresh symlinks in case any installed files have changed
+ eselect emacs set ${EMACS_SUFFIX}
+ else
+ eselect emacs update ifunset
+ fi
+}
+
+pkg_postrm() {
+ elisp-site-regen
+ eselect emacs update ifunset
+}
diff --git a/app-editors/emacs/files/emacs-24.3-data-start.patch b/app-editors/emacs/files/emacs-24.3-data-start.patch
new file mode 100644
index 0000000..6a1960e
--- /dev/null
+++ b/app-editors/emacs/files/emacs-24.3-data-start.patch
@@ -0,0 +1,626 @@
+commit 1ddc2bd6ff0b5071454d2591f835927ea5b85a06
+Author: Paul Eggert <eggert@cs.ucla.edu>
+Date: Sun Feb 24 21:55:37 2013 -0800
+
+ Simplify data_start configuration.
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -213,12 +213,6 @@
+ fi
+ fi
+
+-CRT_DIR=
+-AC_ARG_WITH([crt-dir],dnl
+-[AS_HELP_STRING([--with-crt-dir=DIR],[directory containing crtn.o etc.
+-The default is /usr/lib, or /usr/lib64 on some platforms.])])
+-CRT_DIR="${with_crt_dir}"
+-
+ AC_ARG_WITH(gameuser,dnl
+ [AS_HELP_STRING([--with-gameuser=USER],[user for shared game score files])])
+ test "X${with_gameuser}" != X && test "${with_gameuser}" != yes \
+@@ -1031,42 +1025,29 @@
+
+
+ LIB_MATH=-lm
+-LIB_STANDARD=
+-START_FILES=
+ dnl Current possibilities handled by sed (aix4-2 -> aix,
+ dnl gnu-linux -> gnu/linux, etc.):
+ dnl gnu, gnu/linux, gnu/kfreebsd, aix, cygwin, darwin, hpux, irix.
+ dnl And special cases: berkeley-unix, usg-unix-v, ms-dos, windows-nt.
+ SYSTEM_TYPE=`echo $opsys | sed -e 's/[[0-9]].*//' -e 's|-|/|'`
+
+-dnl NB do not use CRT_DIR unquoted here, since it might not be set yet.
+ case $opsys in
+ cygwin )
+ LIB_MATH=
+- START_FILES='pre-crt0.o'
+ ;;
+ darwin )
+ ## Adding -lm confuses the dynamic linker, so omit it.
+ LIB_MATH=
+- START_FILES='pre-crt0.o'
+ ;;
+ freebsd )
+- LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtn.o'
+- START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o'
+ SYSTEM_TYPE=berkeley-unix
+ ;;
+ gnu-linux | gnu-kfreebsd )
+- LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtn.o'
+- START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o'
+ ;;
+ hpux10-20 | hpux11 )
+- LIB_STANDARD=-lc
+- START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o'
+ ;;
+ dnl NB this may be adjusted below.
+ netbsd | openbsd )
+- LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o'
+- START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crtbegin.o'
+ SYSTEM_TYPE=berkeley-unix
+ ;;
+
+@@ -1077,96 +1058,9 @@
+ esac
+
+ AC_SUBST(LIB_MATH)
+-AC_SUBST(START_FILES)
+ AC_DEFINE_UNQUOTED(SYSTEM_TYPE, "$SYSTEM_TYPE",
+ [The type of system you are compiling for; sets `system-type'.])
+
+-dnl Not all platforms use crtn.o files. Check if the current one does.
+-crt_files=
+-
+-for file in x $LIB_STANDARD $START_FILES; do
+- case "$file" in
+- *CRT_DIR*) crt_files="$crt_files `echo $file | sed -e 's|.*/||'`" ;;
+- esac
+-done
+-
+-if test "x$crt_files" != x; then
+-
+- ## If user specified a crt-dir, use that unconditionally.
+- crt_gcc=no
+-
+- if test "X$CRT_DIR" = "X"; then
+-
+- CRT_DIR=/usr/lib # default
+-
+- case "$canonical" in
+- x86_64-*-linux-gnu* | s390x-*-linux-gnu*)
+- ## On x86-64 and s390x GNU/Linux distributions, the standard library
+- ## can be in a variety of places. We only try /usr/lib64 and /usr/lib.
+- ## For anything else (eg /usr/lib32), it is up the user to specify
+- ## the location (bug#5655).
+- ## Test for crtn.o, not just the directory, because sometimes the
+- ## directory exists but does not have the relevant files (bug#1287).
+- ## FIXME better to test for binary compatibility somehow.
+- test -e /usr/lib64/crtn.o && CRT_DIR=/usr/lib64
+- ;;
+-
+- powerpc64-*-linux-gnu* | sparc64-*-linux-gnu*) CRT_DIR=/usr/lib64 ;;
+- esac
+-
+- case "$opsys" in
+- hpux10-20) CRT_DIR=/lib ;;
+- esac
+-
+- test "x${GCC}" = xyes && crt_gcc=yes
+-
+- fi # CRT_DIR = ""
+-
+- crt_missing=
+-
+- for file in $crt_files; do
+-
+- ## If we're using gcc, try to determine it automatically by asking
+- ## gcc. [If this doesn't work, CRT_DIR will remain at the
+- ## system-dependent default from above.]
+- if test $crt_gcc = yes && test ! -e $CRT_DIR/$file; then
+-
+- crt_file=`$CC --print-file-name=$file 2>/dev/null`
+- case "$crt_file" in
+- */*)
+- CRT_DIR=`AS_DIRNAME(["$crt_file"])`
+- ;;
+- esac
+- fi
+-
+- dnl We expect all the files to be in a single directory, so after the
+- dnl first there is no point asking gcc.
+- crt_gcc=no
+-
+- test -e $CRT_DIR/$file || crt_missing="$crt_missing $file"
+- done # $crt_files
+-
+- test "x$crt_missing" = x || \
+- AC_MSG_ERROR([Required file(s) not found:$crt_missing
+-Try using the --with-crt-dir option.])
+-
+-fi # crt_files != ""
+-
+-AC_SUBST(CRT_DIR)
+-
+-case $opsys in
+- netbsd | openbsd )
+- if test -f $CRT_DIR/crti.o; then
+-
+- test -f $CRT_DIR/crtn.o || \
+- AC_MSG_ERROR([Required file not found: crtn.o])
+-
+- LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o $(CRT_DIR)/crtn.o'
+- START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtbegin.o'
+- fi
+- ;;
+-esac
+-
+
+ pre_PKG_CONFIG_CFLAGS=$CFLAGS
+ pre_PKG_CONFIG_LIBS=$LIBS
+@@ -1284,7 +1178,7 @@
+ AC_CHECK_HEADERS_ONCE(
+ linux/version.h sys/systeminfo.h
+ stdio_ext.h fcntl.h coff.h pty.h
+- sys/vlimit.h sys/resource.h
++ sys/resource.h
+ sys/utsname.h pwd.h utmp.h dirent.h util.h)
+
+ AC_MSG_CHECKING(if personality LINUX32 can be set)
+@@ -1501,8 +1395,6 @@
+ CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
+ LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES}"
+ LIBS_GNUSTEP="-lgnustep-gui -lgnustep-base -lobjc -lpthread"
+- LIB_STANDARD=
+- START_FILES=
+ dnl GNUstep defines BASE_NATIVE_OBJC_EXCEPTIONS to 0 or 1.
+ dnl If they had chosen to either define it or not, we could have
+ dnl just used AC_CHECK_DECL here.
+@@ -1591,7 +1483,6 @@
+ AC_SUBST(ns_self_contained)
+ AC_SUBST(NS_OBJ)
+ AC_SUBST(NS_OBJC_OBJ)
+-AC_SUBST(LIB_STANDARD)
+
+ HAVE_W32=no
+ W32_OBJ=
+@@ -1716,6 +1607,20 @@
+ else
+ test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o
+ VMLIMIT_OBJ=vm-limit.o
++
++ AC_CHECK_HEADERS([sys/vlimit.h])
++ AC_CACHE_CHECK([for data_start], [emacs_cv_data_start],
++ [AC_LINK_IFELSE(
++ [AC_LANG_PROGRAM(
++ [[extern char data_start[]; char ch;]],
++ [[return data_start == &ch;]])],
++ [emacs_cv_data_start=yes],
++ [emacs_cv_data_start=no])])
++ if test $emacs_cv_data_start = yes; then
++ AC_DEFINE([HAVE_DATA_START], 1,
++ [Define to 1 if data_start is the address of the start
++ of the main data segment.])
++ fi
+ fi
+ AC_SUBST(GMALLOC_OBJ)
+ AC_SUBST(VMLIMIT_OBJ)
+@@ -3759,9 +3664,7 @@
+ fi dnl emacs_glibc
+
+
+-dnl Used in vm-limit.c
+-AH_TEMPLATE(DATA_START, [Address of the start of the data segment.])
+-dnl Used in lisp.h, emacs.c, mem-limits.h
++dnl Used in lisp.h, emacs.c, vm-limit.c
+ dnl NEWS.18 describes this as "a number which contains
+ dnl the high bits to be inclusive or'ed with pointers that are unpacked."
+ AH_TEMPLATE(DATA_SEG_BITS, [Extra bits to be or'd in with any pointers
+@@ -3769,23 +3672,15 @@
+ dnl if Emacs uses fewer than 32 bits for the value field of a LISP_OBJECT.
+
+ case $opsys in
+- gnu)
+- dnl libc defines data_start.
+- AC_DEFINE(DATA_START, [({ extern int data_start; (char *) &data_start; })])
+- ;;
+-
+ aix*)
+ dnl This works with 32-bit executables; Emacs doesn't support 64-bit.
+- AC_DEFINE(DATA_START, [0x20000000])
+ AC_DEFINE(DATA_SEG_BITS, [0x20000000])
+ ;;
+ hpux*)
+ dnl The data segment on this machine always starts at address 0x40000000.
+- AC_DEFINE(DATA_START, [0x40000000])
+ AC_DEFINE(DATA_SEG_BITS, [0x40000000])
+ ;;
+ irix6-5)
+- AC_DEFINE(DATA_START, [0x10000000])
+ AC_DEFINE(DATA_SEG_BITS, [0x10000000])
+ ;;
+ esac
+@@ -4373,88 +4268,6 @@
+
+ AC_SUBST(LD_SWITCH_SYSTEM_TEMACS)
+
+-
+-LD_FIRSTFLAG=
+-ORDINARY_LINK=
+-case "$opsys" in
+- ## gnu: GNU needs its own crt0.
+- aix4-2|cygwin|darwin|gnu|hpux*|irix6-5|sol2*|unixware) ORDINARY_LINK=yes ;;
+-
+- ## On post 1.3 releases of NetBSD, gcc -nostdlib also clears the
+- ## library search parth, i.e. it won't search /usr/lib for libc and
+- ## friends. Using -nostartfiles instead avoids this problem, and
+- ## will also work on earlier NetBSD releases.
+- netbsd|openbsd) LD_FIRSTFLAG="-nostartfiles" ;;
+-
+- ## powerpc*: NAKAJI Hiroyuki <nakaji@tutrp.tut.ac.jp> says
+- ## MkLinux/LinuxPPC needs this.
+- ## s390x-* only supports opsys = gnu-linux so it can be added here.
+- gnu-*)
+- case "$canonical" in
+- powerpc*|s390x-*) LD_FIRSTFLAG="-nostdlib" ;;
+- esac
+- ;;
+-esac
+-
+-
+-if test "x$ORDINARY_LINK" = "xyes"; then
+-
+- LD_FIRSTFLAG=""
+- AC_DEFINE(ORDINARY_LINK, 1, [Define if the C compiler is the linker.])
+-
+-## The system files defining neither ORDINARY_LINK nor LD_FIRSTFLAG are:
+-## freebsd, gnu-* not on powerpc*|s390x*.
+-elif test "x$GCC" = "xyes" && test "x$LD_FIRSTFLAG" = "x"; then
+-
+- ## Versions of GCC >= 2.0 put their library, libgcc.a, in obscure
+- ## places that are difficult to figure out at make time. Fortunately,
+- ## these same versions allow you to pass arbitrary flags on to the
+- ## linker, so there is no reason not to use it as a linker.
+- ##
+- ## Well, it is not quite perfect. The "-nostdlib" keeps GCC from
+- ## searching for libraries in its internal directories, so we have to
+- ## ask GCC explicitly where to find libgcc.a (LIB_GCC below).
+- LD_FIRSTFLAG="-nostdlib"
+-fi
+-
+-## FIXME? What setting of EDIT_LDFLAGS should this have?
+-test "$NS_IMPL_GNUSTEP" = "yes" && LD_FIRSTFLAG="-rdynamic"
+-
+-AC_SUBST(LD_FIRSTFLAG)
+-
+-
+-## FIXME? The logic here is not precisely the same as that above.
+-## There is no check here for a pre-defined LD_FIRSTFLAG.
+-## Should we only be setting LIB_GCC if LD ~ -nostdlib?
+-LIB_GCC=
+-if test "x$GCC" = "xyes" && test "x$ORDINARY_LINK" != "xyes"; then
+-
+- case "$opsys" in
+- freebsd|netbsd|openbsd) LIB_GCC= ;;
+-
+- gnu-*)
+- ## armin76@gentoo.org reported that the lgcc_s flag is necessary to
+- ## build on ARM EABI under GNU/Linux. (Bug#5518)
+- case $host_cpu in
+- arm*)
+- LIB_GCC="-lgcc_s"
+- ;;
+- *)
+- ## FIXME? s/gnu-linux.h used to define LIB_GCC as below, then
+- ## immediately undefine it again and redefine it to empty.
+- ## Was the C_SWITCH_X_SITE part really necessary?
+-## LIB_GCC=`$CC $C_SWITCH_X_SITE -print-libgcc-file-name`
+- LIB_GCC=
+- ;;
+- esac
+- ;;
+-
+- ## Ask GCC where to find libgcc.a.
+- *) LIB_GCC=`$CC -print-libgcc-file-name 2> /dev/null` ;;
+- esac
+-fi dnl if $GCC
+-AC_SUBST(LIB_GCC)
+-
+ ## Common for all window systems
+ if test "$window_system" != "none"; then
+ AC_DEFINE(HAVE_WINDOW_SYSTEM, 1, [Define if you have a window system.])
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -34,7 +34,6 @@
+ CFLAGS = @CFLAGS@
+ CPPFLAGS = @CPPFLAGS@
+ LDFLAGS = @LDFLAGS@
+-LD_FIRSTFLAG=@LD_FIRSTFLAG@
+ EXEEXT = @EXEEXT@
+ version = @version@
+ # Substitute an assignment for the MAKE variable, because
+@@ -100,10 +99,8 @@
+ ## System-specific LDFLAGS.
+ LD_SWITCH_SYSTEM=@LD_SWITCH_SYSTEM@
+
+-## This holds any special options for linking temacs only (ie, not
+-## used by configure). Not used elsewhere because it sometimes
+-## contains options that have to do with using Emacs's crt0,
+-## which are only good with temacs.
++## This holds any special options for linking temacs only (i.e., not
++## used by configure).
+ LD_SWITCH_SYSTEM_TEMACS=@LD_SWITCH_SYSTEM_TEMACS@
+
+ ## Flags to pass to ld only for temacs.
+@@ -121,14 +118,6 @@
+ ## Some systems define this to request special libraries.
+ LIBS_SYSTEM=@LIBS_SYSTEM@
+
+-## Where to find libgcc.a, if using gcc and necessary.
+-LIB_GCC=@LIB_GCC@
+-
+-CRT_DIR=@CRT_DIR@
+-## May use $CRT_DIR.
+-LIB_STANDARD=@LIB_STANDARD@
+-START_FILES = @START_FILES@
+-
+ ## -lm, or empty.
+ LIB_MATH=@LIB_MATH@
+
+@@ -381,17 +370,16 @@
+
+ ## List of object files that make-docfile should not be told about.
+ otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(GMALLOC_OBJ) $(RALLOC_OBJ) \
+- $(POST_ALLOC_OBJ) $(VMLIMIT_OBJ) $(WIDGET_OBJ) $(LIBOBJS)
++ $(POST_ALLOC_OBJ) $(WIDGET_OBJ) $(LIBOBJS)
+
++## All object files linked into temacs. $(VMLIMIT_OBJ) should be first.
++ALLOBJS = $(VMLIMIT_OBJ) $(obj) $(otherobj)
+
+ ## Configure inserts the file lisp.mk at this point, defining $lisp.
+ @lisp_frag@
+
+
+ ## Construct full set of libraries to be linked.
+-## Note that SunOS needs -lm to come before -lc; otherwise, you get
+-## duplicated symbols. If the standard libraries were compiled
+-## with GCC, we might need LIB_GCC again after them.
+ LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) $(LIBIMAGE) \
+ $(LIBX_OTHER) $(LIBSOUND) \
+ $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(LIB_CLOCK_GETTIME) \
+@@ -401,7 +389,7 @@
+ $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \
+ $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
+ $(LIBGNUTLS_LIBS) $(LIB_PTHREAD) $(LIB_PTHREAD_SIGMASK) \
+- $(LIB_GCC) $(LIB_MATH) $(LIB_STANDARD) $(LIB_GCC)
++ $(LIB_MATH)
+
+ all: emacs$(EXEEXT) $(OTHER_FILES)
+ .PHONY: all
+@@ -448,7 +436,7 @@
+ cd $(libsrc); $(MAKE) $(MFLAGS) make-docfile$(EXEEXT)
+
+ buildobj.h: Makefile
+- echo "#define BUILDOBJ \"$(obj) $(otherobj) " "\"" > buildobj.h
++ echo "#define BUILDOBJ \"$(ALLOBJS) " "\"" >$@
+
+ globals.h: gl-stamp; @true
+
+@@ -460,14 +448,14 @@
+ $(srcdir)/../build-aux/move-if-change gl-tmp globals.h
+ echo timestamp > $@
+
+-$(obj) $(otherobj): globals.h
++$(ALLOBJS): globals.h
+
+ $(lib)/libgnu.a: $(config_h)
+ cd $(lib) && $(MAKE) libgnu.a
+
+-temacs$(EXEEXT): $(START_FILES) stamp-oldxmenu $(obj) $(otherobj) $(lib)/libgnu.a
+- $(CC) $(LD_FIRSTFLAG) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \
+- -o temacs $(START_FILES) $(obj) $(otherobj) $(lib)/libgnu.a $(LIBES)
++temacs$(EXEEXT): stamp-oldxmenu $(ALLOBJS) $(lib)/libgnu.a
++ $(CC) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \
++ -o temacs $(ALLOBJS) $(lib)/libgnu.a $(LIBES)
+ test "$(CANNOT_DUMP)" = "yes" || \
+ test "X$(PAXCTL)" = X || $(PAXCTL) -r temacs$(EXEEXT)
+ test "$(CANNOT_DUMP)" = "yes" || test "X$(SETFATTR)" = X || \
+--- a/src/autodeps.mk
++++ b/src/autodeps.mk
+@@ -2,5 +2,4 @@
+
+ ## This is inserted in src/Makefile if AUTO_DEPEND=yes.
+
+-ALLOBJS=$(START_FILES) ${obj} ${otherobj}
+ -include $(ALLOBJS:%.o=${DEPDIR}/%.d)
+--- a/src/deps.mk
++++ b/src/deps.mk
+@@ -143,7 +143,7 @@
+ dispextern.h lisp.h globals.h $(config_h) systime.h coding.h composite.h
+ gmalloc.o: gmalloc.c $(config_h)
+ ralloc.o: ralloc.c lisp.h $(config_h)
+-vm-limit.o: vm-limit.c mem-limits.h lisp.h globals.h $(config_h)
++vm-limit.o: vm-limit.c lisp.h globals.h $(config_h)
+ marker.o: marker.c buffer.h character.h lisp.h globals.h $(config_h)
+ minibuf.o: minibuf.c syntax.h frame.h window.h keyboard.h systime.h \
+ buffer.h commands.h character.h msdos.h $(INTERVALS_H) keymap.h \
+--- a/src/emacs.c
++++ b/src/emacs.c
+@@ -522,32 +522,6 @@
+ static char dump_tz[] = "UtC0";
+ #endif
+
+-#ifndef ORDINARY_LINK
+-/* We don't include crtbegin.o and crtend.o in the link,
+- so these functions and variables might be missed.
+- Provide dummy definitions to avoid error.
+- (We don't have any real constructors or destructors.) */
+-#ifdef __GNUC__
+-
+-/* Define a dummy function F. Declare F too, to pacify gcc
+- -Wmissing-prototypes. */
+-#define DEFINE_DUMMY_FUNCTION(f) \
+- void f (void) ATTRIBUTE_CONST EXTERNALLY_VISIBLE; void f (void) {}
+-
+-#ifndef GCC_CTORS_IN_LIBC
+-DEFINE_DUMMY_FUNCTION (__do_global_ctors)
+-DEFINE_DUMMY_FUNCTION (__do_global_ctors_aux)
+-DEFINE_DUMMY_FUNCTION (__do_global_dtors)
+-/* GNU/Linux has a bug in its library; avoid an error. */
+-#ifndef GNU_LINUX
+-char * __CTOR_LIST__[2] EXTERNALLY_VISIBLE = { (char *) (-1), 0 };
+-#endif
+-char * __DTOR_LIST__[2] EXTERNALLY_VISIBLE = { (char *) (-1), 0 };
+-#endif /* GCC_CTORS_IN_LIBC */
+-DEFINE_DUMMY_FUNCTION (__main)
+-#endif /* __GNUC__ */
+-#endif /* ORDINARY_LINK */
+-
+ /* Test whether the next argument in ARGV matches SSTR or a prefix of
+ LSTR (at least MINLEN characters). If so, then if VALPTR is non-null
+ (the argument is supposed to have a value) store in *VALPTR either
+--- a/src/vm-limit.c
++++ b/src/vm-limit.c
+@@ -19,7 +19,37 @@
+ #include <config.h>
+ #include <unistd.h> /* for 'environ', on AIX */
+ #include "lisp.h"
+-#include "mem-limits.h"
++
++#ifdef MSDOS
++#include <dpmi.h>
++extern int etext;
++#endif
++
++/* Some systems need this before <sys/resource.h>. */
++#include <sys/types.h>
++
++#ifdef HAVE_SYS_RESOURCE_H
++# include <sys/time.h>
++# include <sys/resource.h>
++#else
++# if HAVE_SYS_VLIMIT_H
++# include <sys/vlimit.h> /* Obsolete, says glibc */
++# endif
++#endif
++
++/* Start of data. It is OK if this is approximate; it's used only as
++ a heuristic. */
++#ifdef DATA_START
++# define data_start ((char *) DATA_START)
++#else
++extern char data_start[];
++# ifndef HAVE_DATA_START
++/* Initialize to nonzero, so that it's put into data and not bss.
++ Link this file's object code first, so that this symbol is near the
++ start of data. */
++char data_start[1] = { 1 };
++# endif
++#endif
+
+ /*
+ Level number of warnings already issued.
+@@ -43,6 +73,14 @@
+ /* Number of bytes of writable memory we can expect to be able to get. */
+ static size_t lim_data;
+
++/* Return true if PTR cannot be represented as an Emacs Lisp object. */
++static bool
++exceeds_lisp_ptr (void *ptr)
++{
++ return (! USE_LSB_TAG
++ && VAL_MAX < UINTPTR_MAX
++ && ((uintptr_t) ptr & ~DATA_SEG_BITS) >> VALBITS != 0);
++}
+
+ #if defined (HAVE_GETRLIMIT) && defined (RLIMIT_AS)
+ static void
+@@ -169,6 +207,8 @@
+ {
+ #ifdef REL_ALLOC
+ extern POINTER (*real_morecore) (ptrdiff_t);
++#else
++ POINTER (*real_morecore) (ptrdiff_t) = 0;
+ #endif
+ extern POINTER (*__morecore) (ptrdiff_t);
+
+@@ -182,13 +222,8 @@
+ five_percent = lim_data / 20;
+
+ /* Find current end of memory and issue warning if getting near max */
+-#ifdef REL_ALLOC
+- if (real_morecore)
+- cp = (char *) (*real_morecore) (0);
+- else
+-#endif
+- cp = (char *) (*__morecore) (0);
+- data_size = (char *) cp - (char *) data_space_start;
++ cp = (real_morecore ? real_morecore : __morecore) (0);
++ data_size = cp - data_space_start;
+
+ if (!warn_function)
+ return;
+@@ -235,49 +270,10 @@
+ warnlevel = warned_85;
+ }
+
+- if (EXCEEDS_LISP_PTR (cp))
++ if (exceeds_lisp_ptr (cp))
+ (*warn_function) ("Warning: memory in use exceeds lisp pointer size");
+ }
+
+-#if !defined (CANNOT_DUMP) || !defined (SYSTEM_MALLOC)
+-/* Some systems that cannot dump also cannot implement these. */
+-
+-/*
+- * Return the address of the start of the data segment prior to
+- * doing an unexec. After unexec the return value is undefined.
+- * See crt0.c for further information and definition of data_start.
+- *
+- * Apparently, on BSD systems this is etext at startup. On
+- * USG systems (swapping) this is highly mmu dependent and
+- * is also dependent on whether or not the program is running
+- * with shared text. Generally there is a (possibly large)
+- * gap between end of text and start of data with shared text.
+- *
+- */
+-
+-char *
+-start_of_data (void)
+-{
+-#ifdef BSD_SYSTEM
+- extern char etext;
+- return (POINTER)(&etext);
+-#elif defined DATA_START
+- return ((POINTER) DATA_START);
+-#elif defined ORDINARY_LINK
+- /*
+- * This is a hack. Since we're not linking crt0.c or pre_crt0.c,
+- * data_start isn't defined. We take the address of environ, which
+- * is known to live at or near the start of the system crt0.c, and
+- * we don't sweat the handful of bytes that might lose.
+- */
+- return ((POINTER) &environ);
+-#else
+- extern int data_start;
+- return ((POINTER) &data_start);
+-#endif
+-}
+-#endif /* (not CANNOT_DUMP or not SYSTEM_MALLOC) */
+-
+ /* Enable memory usage warnings.
+ START says where the end of pure storage is.
+ WARNFUN specifies the function to call to issue a warning. */
+@@ -287,10 +283,7 @@
+ {
+ extern void (* __after_morecore_hook) (void); /* From gmalloc.c */
+
+- if (start)
+- data_space_start = start;
+- else
+- data_space_start = start_of_data ();
++ data_space_start = start ? start : data_start;
+
+ warn_function = warnfun;
+ __after_morecore_hook = check_memory_limits;
diff --git a/app-editors/emacs/files/emacs-24.3-giflib-5.patch b/app-editors/emacs/files/emacs-24.3-giflib-5.patch
new file mode 100644
index 0000000..992a811
--- /dev/null
+++ b/app-editors/emacs/files/emacs-24.3-giflib-5.patch
@@ -0,0 +1,168 @@
+commit f3606ef766bcec86789316a05949f1e67a51e7c1
+Author: Barry Fishman <barry_fishman@acm.org>
+Date: Wed Oct 9 20:37:44 2013 -0400
+
+ Handle giflib 5 changes (tiny change)
+
+ * configure.ac: Update for giflib 5.
+
+ * src/image.c (GIFLIB_MAJOR): Ensure it's defined.
+ (DGifOpen, DGifOpenFileName): Handle giflib 5 syntax. (Bug#15531)
+
+commit be316ede5fffb724852ee225489e70778d240bb0
+Author: Paul Eggert <eggert@cs.ucla.edu>
+Date: Tue Jan 7 13:14:32 2014 -0800
+
+ Fix misdisplay of interlaced GIFs with libgif5.
+
+ * image.c (gif_load): libgif5 deinterlaces for us, so don't do
+ it again.
+
+ Fixes: debbugs:16372
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -2674,8 +2674,9 @@
+ || test "${HAVE_W32}" = "yes"; then
+ AC_CHECK_HEADER(gif_lib.h,
+ # EGifPutExtensionLast only exists from version libungif-4.1.0b1.
+-# Earlier versions can crash Emacs.
+- [AC_CHECK_LIB(gif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=maybe)])
++# Earlier versions can crash Emacs, but version 5.0 removes EGifPutExtensionLast.
++ [AC_CHECK_LIB(gif, GifMakeMapObject, HAVE_GIF=yes,
++ [AC_CHECK_LIB(gif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=maybe)])])
+
+ if test "$HAVE_GIF" = yes; then
+ LIBGIF=-lgif
+--- a/src/image.c
++++ b/src/image.c
+@@ -7095,14 +7095,25 @@
+
+ #endif /* HAVE_NTGUI */
+
++#ifndef GIFLIB_MAJOR
++#define GIFLIB_MAJOR 0
++#endif
++#ifndef GIFLIB_MINOR
++#define GIFLIB_MINOR 0
++#endif
+
+ #ifdef WINDOWSNT
+
+ /* GIF library details. */
+ DEF_IMGLIB_FN (int, DGifCloseFile, (GifFileType *));
+ DEF_IMGLIB_FN (int, DGifSlurp, (GifFileType *));
++#if GIFLIB_MAJOR < 5
+ DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc));
+ DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *));
++#else
++DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc, int *));
++DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *, int *));
++#endif
+
+ static bool
+ init_gif_functions (void)
+@@ -7192,7 +7203,11 @@
+ }
+
+ /* Open the GIF file. */
++#if GIFLIB_MAJOR < 5
+ gif = fn_DGifOpenFileName (SSDATA (file));
++#else
++ gif = fn_DGifOpenFileName (SSDATA (file), NULL);
++#endif
+ if (gif == NULL)
+ {
+ image_error ("Cannot open `%s'", file, Qnil);
+@@ -7213,7 +7228,11 @@
+ memsrc.len = SBYTES (specified_data);
+ memsrc.index = 0;
+
++#if GIFLIB_MAJOR < 5
+ gif = fn_DGifOpen (&memsrc, gif_read_from_memory);
++#else
++ gif = fn_DGifOpen (&memsrc, gif_read_from_memory, NULL);
++#endif
+ if (!gif)
+ {
+ image_error ("Cannot open memory source `%s'", img->spec, Qnil);
+@@ -7225,7 +7244,11 @@
+ if (!check_image_size (f, gif->SWidth, gif->SHeight))
+ {
+ image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
++#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
+ fn_DGifCloseFile (gif);
++#else
++ fn_DGifCloseFile (gif, NULL);
++#endif
+ return 0;
+ }
+
+@@ -7234,7 +7257,11 @@
+ if (rc == GIF_ERROR || gif->ImageCount <= 0)
+ {
+ image_error ("Error reading `%s'", img->spec, Qnil);
++#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
+ fn_DGifCloseFile (gif);
++#else
++ fn_DGifCloseFile (gif, NULL);
++#endif
+ return 0;
+ }
+
+@@ -7246,7 +7273,11 @@
+ {
+ image_error ("Invalid image number `%s' in image `%s'",
+ image_number, img->spec);
++#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
+ fn_DGifCloseFile (gif);
++#else
++ fn_DGifCloseFile (gif, NULL);
++#endif
+ return 0;
+ }
+ }
+@@ -7264,14 +7295,22 @@
+ if (!check_image_size (f, width, height))
+ {
+ image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
++#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
+ fn_DGifCloseFile (gif);
++#else
++ fn_DGifCloseFile (gif, NULL);
++#endif
+ return 0;
+ }
+
+ /* Create the X image and pixmap. */
+ if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
+ {
++#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
+ fn_DGifCloseFile (gif);
++#else
++ fn_DGifCloseFile (gif, NULL);
++#endif
+ return 0;
+ }
+
+@@ -7370,7 +7409,7 @@
+ }
+
+ /* Apply the pixel values. */
+- if (gif->SavedImages[j].ImageDesc.Interlace)
++ if (GIFLIB_MAJOR < 5 && gif->SavedImages[j].ImageDesc.Interlace)
+ {
+ int row, pass;
+
+@@ -7447,7 +7486,11 @@
+ Fcons (make_number (gif->ImageCount),
+ img->lisp_data));
+
++#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
+ fn_DGifCloseFile (gif);
++#else
++ fn_DGifCloseFile (gif, NULL);
++#endif
+
+ /* Maybe fill in the background field while we have ximg handy. */
+ if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
diff --git a/app-editors/emacs/files/emacs-24.3-jpeg-version.patch b/app-editors/emacs/files/emacs-24.3-jpeg-version.patch
new file mode 100644
index 0000000..a5845c0
--- /dev/null
+++ b/app-editors/emacs/files/emacs-24.3-jpeg-version.patch
@@ -0,0 +1,25 @@
+commit ff3878d749591ebf78da532ec1eb6fa00cb5757d
+Author: Andreas Schwab <schwab@suse.de>
+Date: Mon Mar 23 11:55:24 2015 +0100
+
+ * configure.ac: Fix jpeg version check to work with gcc >= 5.
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -2598,10 +2598,12 @@
+ AH_TEMPLATE(HAVE_JPEG, [Define to 1 if you have the jpeg library (-ljpeg).])dnl
+ if test "${HAVE_JPEG}" = "yes"; then
+ AC_DEFINE(HAVE_JPEG)
+- AC_EGREP_CPP([version= *(6[2-9]|[7-9][0-9])],
+- [#include <jpeglib.h>
+- version=JPEG_LIB_VERSION
+-],
++ AC_EGREP_CPP([version 6b or later],
++ [#include <jpeglib.h>
++ #if JPEG_LIB_VERSION >= 62
++ version 6b or later
++ #endif
++ ],
+ [AC_DEFINE(HAVE_JPEG)],
+ [AC_MSG_WARN([libjpeg found, but not version 6b or later])
+ HAVE_JPEG=no])
diff --git a/app-editors/emacs/metadata.xml b/app-editors/emacs/metadata.xml
new file mode 100644
index 0000000..720733b
--- /dev/null
+++ b/app-editors/emacs/metadata.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="project">
+ <email>gnu-emacs@gentoo.org</email>
+ <name>Gentoo GNU Emacs project</name>
+</maintainer>
+<longdescription>
+ GNU Emacs is an extensible, customizable text editor - and more. At its core
+ is an interpreter for Emacs Lisp, a dialect of the Lisp programming language
+ with extensions to support text editing. The features of GNU Emacs include:
+ * Content-sensitive editing modes, including syntax coloring, for a variety
+ of file types including plain text, source code, and HTML.
+ * Complete built-in documentation, including a tutorial for new users.
+ * Full Unicode support for nearly all human languages and their scripts.
+ * Highly customizable, using Emacs Lisp code or a graphical interface.
+ * A large number of extensions that add other functionality, including a
+ project planner, mail and news reader, debugger interface, calendar, and
+ more. Many of these extensions are distributed with GNU Emacs; others are
+ available separately.
+</longdescription>
+<use>
+ <flag name="athena">Enable the MIT Athena widget set
+ (<pkg>x11-libs/libXaw</pkg>)</flag>
+ <flag name="gconf">Use <pkg>gnome-base/gconf</pkg> to read the system
+ font name</flag>
+ <flag name="gsettings">Use gsettings (<pkg>dev-libs/glib</pkg>) to read the
+ system font name</flag>
+ <flag name="gtk3">Prefer version 3 of the GIMP Toolkit to version 2
+ (<pkg>x11-libs/gtk+</pkg>)</flag>
+ <flag name="gzip-el">Compress bundled Emacs Lisp source</flag>
+ <flag name="imagemagick">Use <pkg>media-gfx/imagemagick</pkg> for image
+ processing</flag>
+ <flag name="libxml2">Use <pkg>dev-libs/libxml2</pkg> to parse XML instead
+ of the internal Lisp implementations</flag>
+ <flag name="source">Install C source files and make them available for
+ find-function</flag>
+ <flag name="toolkit-scroll-bars">Use the selected toolkit's scrollbars in
+ preference to Emacs' own scrollbars</flag>
+ <flag name="wide-int">Prefer wide Emacs integers (typically 62-bit).
+ This option has an effect only on architectures where "long" and
+ "long long" types have different size.</flag>
+</use>
+</pkgmetadata>