Gentoo Archives: gentoo-commits

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/emacs:master commit in: app-editors/emacs/files/, app-editors/emacs/
Date: Sat, 28 Jul 2018 19:27:40
Message-Id: 1532805970.0a7587ec5063edaeeb4698339e699d97e8a1a465.ulm@gentoo
1 commit: 0a7587ec5063edaeeb4698339e699d97e8a1a465
2 Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jul 28 19:25:15 2018 +0000
4 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
5 CommitDate: Sat Jul 28 19:26:10 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/emacs.git/commit/?id=0a7587ec
7
8 app-editors/emacs: Restore emacs-24.3 for compatibility testing.
9
10 This version is for investigation of some problems with app-emacs/vm
11 and PGP encryption/decryption, where 24.3 is the last known good
12 version.
13
14 I publish this ebuild only because it was surprisingly hard to make
15 this version build again, given the fact that there are working
16 ebuilds for both 23.4 and 24.5.
17
18 Since it is meant as a temporary solution, there is no consolidated
19 patchset. Only the patches necessary to make it build are applied.
20 Also some less important features (like shared game score files) have
21 been dropped.
22
23 Package-Manager: Portage-2.3.43, Repoman-2.3.10
24
25 app-editors/emacs/Manifest | 5 +
26 app-editors/emacs/emacs-24.3-r7.ebuild | 377 +++++++++++++
27 .../emacs/files/emacs-24.3-data-start.patch | 626 +++++++++++++++++++++
28 app-editors/emacs/files/emacs-24.3-giflib-5.patch | 168 ++++++
29 .../emacs/files/emacs-24.3-jpeg-version.patch | 25 +
30 app-editors/emacs/metadata.xml | 44 ++
31 6 files changed, 1245 insertions(+)
32
33 diff --git a/app-editors/emacs/Manifest b/app-editors/emacs/Manifest
34 new file mode 100644
35 index 0000000..3d9a59e
36 --- /dev/null
37 +++ b/app-editors/emacs/Manifest
38 @@ -0,0 +1,5 @@
39 +DIST emacs-23.4-patches-21.tar.xz 19604 BLAKE2B 97327f2079c496c28122203d233a12199a3c11a8c4efb2107247a4ca4483b898467d73d19d4f0570ec7be2a49dc5f6bd1bc9ee0811f932e7deb6b1c4ca96e362 SHA512 135eda432de64200797456d594f7de811275a7adf792d10a1c3a51ca4bbbbaa3a2c682b9fd577c4d93fbce967ca08d4ac47eb45f031477c3e44c69c14d5d5b48
40 +DIST emacs-24.3-patches-7.tar.xz 6484 BLAKE2B 42da9c01a6fc7fd44b9281f11e1aed9ccc7273533c6deeab54125cabad9ff25757c410f43e32f55e13fc0d5354688a4fdd7e5c05dd8a98e36d9cd1a87f414ce9 SHA512 6e3f6f053ad66e6d298b4fd904c57a6c2a03269ec53e9dfc56f834672a42c8f48eeb20a7ed1bcfb534eb62e0cca6e01b4a1663bebb046a0ce7325b732a378868
41 +DIST emacs-24.3.tar.xz 35565352 BLAKE2B 12474f0d4fb99449bb226834aabcaa15aa4e6c3cd6382786959636d53ea1c9a9662cb158cd6c88589e2760bd3030c3970c919fe35967a90830b77fce9e315df8 SHA512 a1300fa10a9fba2db9735db3d01382bcda89ceec033976c4622796dfdf6d2748ed5fa73edf229182b368190c8acbf706810dd5f344542d2c0d294154bc2d0ca9
42 +DIST emacs-24.4-patches-5.tar.xz 6000 BLAKE2B 5a36e15de2237e8c42bbc57038c301ad9548a24af08b072dcfd175f07950605804649c5c4c3fd3504a864bf314d6a742c588cad26b84a1c283de68e4adb139fd SHA512 0a337ad5b7601f5e453645d1fba99717328c6bc7a5505bcb4bd8e853179cf61be43eb6f3b9370edf0f44aa6485d4847c14554c1592ccc7da87b10dabaaa9d421
43 +DIST emacs-24.5-patches-4.tar.xz 13632 BLAKE2B 99e70f4ee32c1ba3a66b934de692437aaf0b83eb6fa841ce4569bc58e2bd12802890c2a8496375280c0ce8fa56515918dfdcbc958f349bc2472104e37ad1fcd1 SHA512 569c3a55aaf1102c0bae4ab25ee06372763cd2de8a54e26b3eefd54e585cf90b53c8ffe1ca48eb4fd312a340380fd3f2fcdb584697814bf429129b48fa56ffb5
44
45 diff --git a/app-editors/emacs/emacs-24.3-r7.ebuild b/app-editors/emacs/emacs-24.3-r7.ebuild
46 new file mode 100644
47 index 0000000..b013715
48 --- /dev/null
49 +++ b/app-editors/emacs/emacs-24.3-r7.ebuild
50 @@ -0,0 +1,377 @@
51 +# Copyright 1999-2018 Gentoo Foundation
52 +# Distributed under the terms of the GNU General Public License v2
53 +
54 +EAPI=7
55 +
56 +inherit autotools elisp-common eutils flag-o-matic multilib readme.gentoo-r1
57 +
58 +DESCRIPTION="The extensible, customizable, self-documenting real-time display editor"
59 +HOMEPAGE="https://www.gnu.org/software/emacs/"
60 +SRC_URI="mirror://gnu/emacs/${P}.tar.xz
61 + https://dev.gentoo.org/~ulm/emacs/${P}-patches-7.tar.xz
62 + https://dev.gentoo.org/~ulm/emacs/${PN}-23.4-patches-21.tar.xz
63 + https://dev.gentoo.org/~ulm/emacs/${PN}-24.4-patches-5.tar.xz
64 + https://dev.gentoo.org/~ulm/emacs/${PN}-24.5-patches-4.tar.xz"
65 +
66 +LICENSE="GPL-3+ FDL-1.3+ BSD HPND MIT W3C unicode PSF-2"
67 +SLOT="24.3"
68 +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"
69 +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"
70 +REQUIRED_USE="?? ( aqua X )"
71 +
72 +RDEPEND="sys-libs/ncurses:0=
73 + >=app-eselect/eselect-emacs-1.16
74 + >=app-emacs/emacs-common-gentoo-1.5[X?]
75 + net-libs/liblockfile
76 + alsa? ( media-libs/alsa-lib )
77 + dbus? ( sys-apps/dbus )
78 + gpm? ( sys-libs/gpm )
79 + kerberos? ( virtual/krb5 )
80 + libxml2? ( >=dev-libs/libxml2-2.2.0 )
81 + selinux? ( sys-libs/libselinux )
82 + ssl? ( net-libs/gnutls:0= )
83 + X? (
84 + x11-libs/libICE
85 + x11-libs/libSM
86 + x11-libs/libX11
87 + x11-libs/libXext
88 + x11-libs/libXinerama
89 + x11-libs/libXrandr
90 + x11-misc/xbitmaps
91 + gconf? ( >=gnome-base/gconf-2.26.2 )
92 + gsettings? ( >=dev-libs/glib-2.28.6 )
93 + gif? ( media-libs/giflib:0= )
94 + jpeg? ( virtual/jpeg:0= )
95 + png? ( >=media-libs/libpng-1.4:0= )
96 + svg? ( >=gnome-base/librsvg-2.0 )
97 + tiff? ( media-libs/tiff:0 )
98 + xpm? ( x11-libs/libXpm )
99 + imagemagick? ( >=media-gfx/imagemagick-6.6.2:0= )
100 + xft? (
101 + media-libs/fontconfig
102 + media-libs/freetype
103 + x11-libs/libXft
104 + x11-libs/libXrender
105 + m17n-lib? (
106 + >=dev-libs/libotf-0.9.4
107 + >=dev-libs/m17n-lib-1.5.1
108 + )
109 + )
110 + gtk? (
111 + gtk3? ( x11-libs/gtk+:3 )
112 + !gtk3? ( x11-libs/gtk+:2 )
113 + )
114 + !gtk? (
115 + motif? (
116 + >=x11-libs/motif-2.3:0
117 + x11-libs/libXpm
118 + x11-libs/libXmu
119 + x11-libs/libXt
120 + )
121 + !motif? (
122 + Xaw3d? (
123 + x11-libs/libXaw3d
124 + x11-libs/libXmu
125 + x11-libs/libXt
126 + )
127 + !Xaw3d? ( athena? (
128 + x11-libs/libXaw
129 + x11-libs/libXmu
130 + x11-libs/libXt
131 + ) )
132 + )
133 + )
134 + )"
135 +
136 +DEPEND="${RDEPEND}
137 + X? ( x11-base/xorg-proto )"
138 +
139 +BDEPEND="virtual/pkgconfig
140 + gzip-el? ( app-arch/gzip )"
141 +# pax_kernel? ( sys-apps/attr )
142 +
143 +RDEPEND="${RDEPEND}
144 + !<app-editors/emacs-vcs-${PV}"
145 +
146 +EMACS_SUFFIX="${PN/emacs/emacs-${SLOT}}"
147 +SITEFILE="20${PN}-${SLOT}-gentoo.el"
148 +# FULL_VERSION keeps the full version number, which is needed in
149 +# order to determine some path information correctly for copy/move
150 +# operations later on
151 +FULL_VERSION="${PV%%_*}"
152 +S="${WORKDIR}/emacs-${FULL_VERSION}"
153 +
154 +src_unpack() {
155 + unpack ${P}.tar.xz
156 + unpack ${PN}-23.4-patches-21.tar.xz; mv patch{,-23.4} || die
157 + unpack ${PN}-24.4-patches-5.tar.xz; mv patch{,-24.4} || die
158 + unpack ${PN}-24.5-patches-4.tar.xz; mv patch{,-24.5} || die
159 + unpack ${P}-patches-7.tar.xz
160 +}
161 +
162 +src_prepare() {
163 + eapply ../patch \
164 + ../patch-23.4/28_all_gmalloc.patch \
165 + ../patch-24.4/03_all_gnus-image.patch \
166 + ../patch-24.4/05_all_browse-url-firefox.patch \
167 + ../patch-24.5/08_all_enriched-mode.patch \
168 + "${FILESDIR}"/${P}-jpeg-version.patch \
169 + "${FILESDIR}"/${P}-giflib-5.patch \
170 + "${FILESDIR}"/${P}-data-start.patch
171 + eapply_user
172 +
173 + # Fix filename reference in redirected man page
174 + sed -i -e "/^\\.so/s/etags/&-${EMACS_SUFFIX}/" doc/man/ctags.1 \
175 + || die "unable to sed ctags.1"
176 +
177 + if ! use alsa; then
178 + # ALSA is detected even if not requested by its USE flag.
179 + # Suppress it by supplying pkg-config with a wrong library name.
180 + sed -i -e "/ALSA_MODULES=/s/alsa/DiSaBlEaLsA/" configure.ac \
181 + || die "unable to sed configure.ac"
182 + fi
183 + if ! use gzip-el; then
184 + # Emacs' build system automatically detects the gzip binary and
185 + # compresses el files. We don't want that so confuse it with a
186 + # wrong binary name
187 + sed -i -e "/AC_PATH_PROG/s/gzip/PrEvEnTcOmPrEsSiOn/" configure.ac \
188 + || die "unable to sed configure.ac"
189 + fi
190 +
191 + AT_M4DIR=m4 eautoreconf
192 + touch src/stamp-h.in || die
193 +}
194 +
195 +src_configure() {
196 + strip-flags
197 + filter-flags -pie #526948
198 + append-ldflags $(test-flags -no-pie) #639570
199 +
200 + if use sh; then
201 + replace-flags "-O[1-9]" -O0 #262359
202 + elif use ia64; then
203 + replace-flags "-O[2-9]" -O1 #325373
204 + else
205 + replace-flags "-O[3-9]" -O2
206 + fi
207 +
208 + # Don't trigger a floating point exception for NaNs on alpha
209 + use alpha && append-flags -mieee
210 +
211 + local myconf
212 +
213 + if use alsa && ! use sound; then
214 + einfo "Although sound USE flag is disabled you chose to have alsa,"
215 + einfo "so sound is switched on anyway."
216 + myconf+=" --with-sound"
217 + else
218 + myconf+=" $(use_with sound)"
219 + fi
220 +
221 + if use X; then
222 + myconf+=" --with-x --without-ns"
223 + myconf+=" $(use_with gconf)"
224 + myconf+=" $(use_with gsettings)"
225 + myconf+=" $(use_with toolkit-scroll-bars)"
226 + myconf+=" $(use_with gif)"
227 + myconf+=" $(use_with jpeg)"
228 + myconf+=" $(use_with png)"
229 + myconf+=" $(use_with svg rsvg)"
230 + myconf+=" $(use_with tiff)"
231 + myconf+=" $(use_with xpm)"
232 + myconf+=" $(use_with imagemagick)"
233 +
234 + if use xft; then
235 + myconf+=" --with-xft"
236 + myconf+=" $(use_with m17n-lib libotf)"
237 + myconf+=" $(use_with m17n-lib m17n-flt)"
238 + else
239 + myconf+=" --without-xft"
240 + myconf+=" --without-libotf --without-m17n-flt"
241 + use m17n-lib && ewarn \
242 + "USE flag \"m17n-lib\" has no effect if \"xft\" is not set."
243 + fi
244 +
245 + local f line
246 + if use gtk; then
247 + einfo "Configuring to build with GIMP Toolkit (GTK+)"
248 + while read line; do ewarn "${line}"; done <<-EOF
249 + Your version of GTK+ will have problems with closing open
250 + displays. This is no problem if you just use one display, but
251 + if you use more than one and close one of them Emacs may crash.
252 + See <https://bugzilla.gnome.org/show_bug.cgi?id=85715>.
253 + If you intend to use more than one display, then it is strongly
254 + recommended that you compile Emacs with the Athena/Lucid or the
255 + Motif toolkit instead.
256 + EOF
257 + myconf+=" --with-x-toolkit=$(usex gtk3 gtk3 gtk2)"
258 + for f in motif Xaw3d athena; do
259 + use ${f} && ewarn \
260 + "USE flag \"${f}\" has no effect if \"gtk\" is set."
261 + done
262 + elif use motif; then
263 + einfo "Configuring to build with Motif toolkit"
264 + myconf+=" --with-x-toolkit=motif"
265 + for f in Xaw3d athena; do
266 + use ${f} && ewarn \
267 + "USE flag \"${f}\" has no effect if \"motif\" is set."
268 + done
269 + elif use athena || use Xaw3d; then
270 + einfo "Configuring to build with Athena/Lucid toolkit"
271 + myconf+=" --with-x-toolkit=lucid $(use_with Xaw3d xaw3d)"
272 + else
273 + einfo "Configuring to build with no toolkit"
274 + myconf+=" --with-x-toolkit=no"
275 + fi
276 + elif use aqua; then
277 + einfo "Configuring to build with Nextstep (Cocoa) support"
278 + myconf+=" --with-ns --disable-ns-self-contained"
279 + myconf+=" --without-x"
280 + else
281 + myconf+=" --without-x --without-ns"
282 + fi
283 +
284 + econf \
285 + --program-suffix="-${EMACS_SUFFIX}" \
286 + --infodir="${EPREFIX}"/usr/share/info/${EMACS_SUFFIX} \
287 + --localstatedir="${EPREFIX}"/var \
288 + --enable-locallisppath="${EPREFIX}/etc/emacs:${EPREFIX}${SITELISP}" \
289 + --without-gameuser \
290 + --without-compress-info \
291 + --without-hesiod \
292 + $(use_with dbus) \
293 + $(use_with gpm) \
294 + $(use_with kerberos) $(use_with kerberos kerberos5) \
295 + $(use_with libxml2 xml2) \
296 + $(use_with selinux) \
297 + $(use_with ssl gnutls) \
298 + $(use_with wide-int) \
299 + ${myconf}
300 +}
301 +
302 +src_compile() {
303 + # Disable sandbox when dumping. For the unbelievers, see bug #131505
304 + emake RUN_TEMACS="SANDBOX_ON=0 LD_PRELOAD= env ./temacs"
305 +}
306 +
307 +src_install () {
308 + emake DESTDIR="${D}" NO_BIN_LINK=t install
309 +
310 + mv "${ED}"/usr/bin/{emacs-${FULL_VERSION}-,}${EMACS_SUFFIX} \
311 + || die "moving emacs executable failed"
312 + mv "${ED}"/usr/share/man/man1/{emacs-,}${EMACS_SUFFIX}.1 \
313 + || die "moving emacs man page failed"
314 +
315 + # move info dir to avoid collisions with the dir file generated by portage
316 + mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{,.orig} \
317 + || die "moving info dir failed"
318 + touch "${ED}"/usr/share/info/${EMACS_SUFFIX}/.keepinfodir
319 + docompress -x /usr/share/info/${EMACS_SUFFIX}/dir.orig
320 +
321 + # avoid collision between slots, see bug #169033 e.g.
322 + rm "${ED}"/usr/share/emacs/site-lisp/subdirs.el
323 + rm -rf "${ED}"/usr/share/{applications,icons}
324 + rm -rf "${ED}"/var
325 +
326 + # remove unused <version>/site-lisp dir
327 + rm -rf "${ED}"/usr/share/emacs/${FULL_VERSION}/site-lisp
328 +
329 + # remove COPYING file (except for etc/COPYING used by describe-copying)
330 + rm "${ED}"/usr/share/emacs/${FULL_VERSION}/lisp/COPYING
331 +
332 + local cdir
333 + if use source; then
334 + cdir="/usr/share/emacs/${FULL_VERSION}/src"
335 + insinto "${cdir}"
336 + # This is not meant to install all the source -- just the
337 + # C source you might find via find-function
338 + doins src/*.{c,h,m}
339 + elif has installsources ${FEATURES}; then
340 + cdir="/usr/src/debug/${CATEGORY}/${PF}/${S#"${WORKDIR}/"}/src"
341 + fi
342 +
343 + sed -e "${cdir:+#}/^Y/d" -e "s/^[XY]//" >"${T}/${SITEFILE}" <<-EOF || die
344 + X
345 + ;;; ${PN}-${SLOT} site-lisp configuration
346 + X
347 + (when (string-match "\\\\\`${FULL_VERSION//./\\\\.}\\\\>" emacs-version)
348 + Y (setq find-function-C-source-directory
349 + Y "${EPREFIX}${cdir}")
350 + X (let ((path (getenv "INFOPATH"))
351 + X (dir "${EPREFIX}/usr/share/info/${EMACS_SUFFIX}")
352 + X (re "\\\\\`${EPREFIX}/usr/share/info\\\\>"))
353 + X (and path
354 + X ;; move Emacs Info dir before anything else in /usr/share/info
355 + X (let* ((p (cons nil (split-string path ":" t))) (q p))
356 + X (while (and (cdr q) (not (string-match re (cadr q))))
357 + X (setq q (cdr q)))
358 + X (setcdr q (cons dir (delete dir (cdr q))))
359 + X (setq Info-directory-list (prune-directory-list (cdr p)))))))
360 + EOF
361 + elisp-site-file-install "${T}/${SITEFILE}" || die
362 +
363 + dodoc README BUGS
364 +
365 + if use aqua; then
366 + dodir /Applications/Gentoo
367 + rm -rf "${ED}"/Applications/Gentoo/Emacs${EMACS_SUFFIX#emacs}.app
368 + mv nextstep/Emacs.app \
369 + "${ED}"/Applications/Gentoo/Emacs${EMACS_SUFFIX#emacs}.app || die
370 + fi
371 +
372 + DOC_CONTENTS="You can set the version to be started by /usr/bin/emacs
373 + through the Emacs eselect module, which also redirects man and info
374 + pages. Therefore, several Emacs versions can be installed at the
375 + same time. \"man emacs.eselect\" for details.
376 + \\n\\nIf you upgrade from Emacs version 24.2 or earlier, then it is
377 + strongly recommended that you use app-admin/emacs-updater to rebuild
378 + all byte-compiled elisp files of the installed Emacs packages."
379 + use X && DOC_CONTENTS+="\\n\\nYou need to install some fonts for Emacs.
380 + Installing media-fonts/font-adobe-{75,100}dpi on the X server's
381 + machine would satisfy basic Emacs requirements under X11.
382 + See also https://wiki.gentoo.org/wiki/Xft_support_for_GNU_Emacs
383 + for how to enable anti-aliased fonts."
384 + use aqua && DOC_CONTENTS+="\\n\\nEmacs${EMACS_SUFFIX#emacs}.app is in
385 + \"${EPREFIX}/Applications/Gentoo\". You may want to copy or symlink
386 + it into /Applications by yourself."
387 + readme.gentoo_create_doc
388 +}
389 +
390 +pkg_preinst() {
391 + # move Info dir file to correct name
392 + local infodir=/usr/share/info/${EMACS_SUFFIX} f
393 + if [[ -f ${ED}${infodir}/dir.orig ]]; then
394 + mv "${ED}"${infodir}/dir{.orig,} || die "moving info dir failed"
395 + elif [[ -d "${ED}"${infodir} ]]; then
396 + # this should not happen in EAPI 4
397 + ewarn "Regenerating Info directory index in ${infodir} ..."
398 + rm -f "${ED}"${infodir}/dir{,.*}
399 + for f in "${ED}"${infodir}/*; do
400 + if [[ ${f##*/} != *-[0-9]* && -e ${f} ]]; then
401 + install-info --info-dir="${ED}"${infodir} "${f}" \
402 + || die "install-info failed"
403 + fi
404 + done
405 + fi
406 +}
407 +
408 +pkg_postinst() {
409 + elisp-site-regen
410 + readme.gentoo_print_elog
411 +
412 + if use livecd; then
413 + # force an update of the emacs symlink for the livecd/dvd,
414 + # because some microemacs packages set it with USE=livecd
415 + eselect emacs update
416 + elif [[ $(readlink "${EROOT}"/usr/bin/emacs) = ${EMACS_SUFFIX} ]]; then
417 + # refresh symlinks in case any installed files have changed
418 + eselect emacs set ${EMACS_SUFFIX}
419 + else
420 + eselect emacs update ifunset
421 + fi
422 +}
423 +
424 +pkg_postrm() {
425 + elisp-site-regen
426 + eselect emacs update ifunset
427 +}
428
429 diff --git a/app-editors/emacs/files/emacs-24.3-data-start.patch b/app-editors/emacs/files/emacs-24.3-data-start.patch
430 new file mode 100644
431 index 0000000..6a1960e
432 --- /dev/null
433 +++ b/app-editors/emacs/files/emacs-24.3-data-start.patch
434 @@ -0,0 +1,626 @@
435 +commit 1ddc2bd6ff0b5071454d2591f835927ea5b85a06
436 +Author: Paul Eggert <eggert@×××××××.edu>
437 +Date: Sun Feb 24 21:55:37 2013 -0800
438 +
439 + Simplify data_start configuration.
440 +
441 +--- a/configure.ac
442 ++++ b/configure.ac
443 +@@ -213,12 +213,6 @@
444 + fi
445 + fi
446 +
447 +-CRT_DIR=
448 +-AC_ARG_WITH([crt-dir],dnl
449 +-[AS_HELP_STRING([--with-crt-dir=DIR],[directory containing crtn.o etc.
450 +-The default is /usr/lib, or /usr/lib64 on some platforms.])])
451 +-CRT_DIR="${with_crt_dir}"
452 +-
453 + AC_ARG_WITH(gameuser,dnl
454 + [AS_HELP_STRING([--with-gameuser=USER],[user for shared game score files])])
455 + test "X${with_gameuser}" != X && test "${with_gameuser}" != yes \
456 +@@ -1031,42 +1025,29 @@
457 +
458 +
459 + LIB_MATH=-lm
460 +-LIB_STANDARD=
461 +-START_FILES=
462 + dnl Current possibilities handled by sed (aix4-2 -> aix,
463 + dnl gnu-linux -> gnu/linux, etc.):
464 + dnl gnu, gnu/linux, gnu/kfreebsd, aix, cygwin, darwin, hpux, irix.
465 + dnl And special cases: berkeley-unix, usg-unix-v, ms-dos, windows-nt.
466 + SYSTEM_TYPE=`echo $opsys | sed -e 's/[[0-9]].*//' -e 's|-|/|'`
467 +
468 +-dnl NB do not use CRT_DIR unquoted here, since it might not be set yet.
469 + case $opsys in
470 + cygwin )
471 + LIB_MATH=
472 +- START_FILES='pre-crt0.o'
473 + ;;
474 + darwin )
475 + ## Adding -lm confuses the dynamic linker, so omit it.
476 + LIB_MATH=
477 +- START_FILES='pre-crt0.o'
478 + ;;
479 + freebsd )
480 +- LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtn.o'
481 +- START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o'
482 + SYSTEM_TYPE=berkeley-unix
483 + ;;
484 + gnu-linux | gnu-kfreebsd )
485 +- LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtn.o'
486 +- START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o'
487 + ;;
488 + hpux10-20 | hpux11 )
489 +- LIB_STANDARD=-lc
490 +- START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o'
491 + ;;
492 + dnl NB this may be adjusted below.
493 + netbsd | openbsd )
494 +- LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o'
495 +- START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crtbegin.o'
496 + SYSTEM_TYPE=berkeley-unix
497 + ;;
498 +
499 +@@ -1077,96 +1058,9 @@
500 + esac
501 +
502 + AC_SUBST(LIB_MATH)
503 +-AC_SUBST(START_FILES)
504 + AC_DEFINE_UNQUOTED(SYSTEM_TYPE, "$SYSTEM_TYPE",
505 + [The type of system you are compiling for; sets `system-type'.])
506 +
507 +-dnl Not all platforms use crtn.o files. Check if the current one does.
508 +-crt_files=
509 +-
510 +-for file in x $LIB_STANDARD $START_FILES; do
511 +- case "$file" in
512 +- *CRT_DIR*) crt_files="$crt_files `echo $file | sed -e 's|.*/||'`" ;;
513 +- esac
514 +-done
515 +-
516 +-if test "x$crt_files" != x; then
517 +-
518 +- ## If user specified a crt-dir, use that unconditionally.
519 +- crt_gcc=no
520 +-
521 +- if test "X$CRT_DIR" = "X"; then
522 +-
523 +- CRT_DIR=/usr/lib # default
524 +-
525 +- case "$canonical" in
526 +- x86_64-*-linux-gnu* | s390x-*-linux-gnu*)
527 +- ## On x86-64 and s390x GNU/Linux distributions, the standard library
528 +- ## can be in a variety of places. We only try /usr/lib64 and /usr/lib.
529 +- ## For anything else (eg /usr/lib32), it is up the user to specify
530 +- ## the location (bug#5655).
531 +- ## Test for crtn.o, not just the directory, because sometimes the
532 +- ## directory exists but does not have the relevant files (bug#1287).
533 +- ## FIXME better to test for binary compatibility somehow.
534 +- test -e /usr/lib64/crtn.o && CRT_DIR=/usr/lib64
535 +- ;;
536 +-
537 +- powerpc64-*-linux-gnu* | sparc64-*-linux-gnu*) CRT_DIR=/usr/lib64 ;;
538 +- esac
539 +-
540 +- case "$opsys" in
541 +- hpux10-20) CRT_DIR=/lib ;;
542 +- esac
543 +-
544 +- test "x${GCC}" = xyes && crt_gcc=yes
545 +-
546 +- fi # CRT_DIR = ""
547 +-
548 +- crt_missing=
549 +-
550 +- for file in $crt_files; do
551 +-
552 +- ## If we're using gcc, try to determine it automatically by asking
553 +- ## gcc. [If this doesn't work, CRT_DIR will remain at the
554 +- ## system-dependent default from above.]
555 +- if test $crt_gcc = yes && test ! -e $CRT_DIR/$file; then
556 +-
557 +- crt_file=`$CC --print-file-name=$file 2>/dev/null`
558 +- case "$crt_file" in
559 +- */*)
560 +- CRT_DIR=`AS_DIRNAME(["$crt_file"])`
561 +- ;;
562 +- esac
563 +- fi
564 +-
565 +- dnl We expect all the files to be in a single directory, so after the
566 +- dnl first there is no point asking gcc.
567 +- crt_gcc=no
568 +-
569 +- test -e $CRT_DIR/$file || crt_missing="$crt_missing $file"
570 +- done # $crt_files
571 +-
572 +- test "x$crt_missing" = x || \
573 +- AC_MSG_ERROR([Required file(s) not found:$crt_missing
574 +-Try using the --with-crt-dir option.])
575 +-
576 +-fi # crt_files != ""
577 +-
578 +-AC_SUBST(CRT_DIR)
579 +-
580 +-case $opsys in
581 +- netbsd | openbsd )
582 +- if test -f $CRT_DIR/crti.o; then
583 +-
584 +- test -f $CRT_DIR/crtn.o || \
585 +- AC_MSG_ERROR([Required file not found: crtn.o])
586 +-
587 +- LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o $(CRT_DIR)/crtn.o'
588 +- START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtbegin.o'
589 +- fi
590 +- ;;
591 +-esac
592 +-
593 +
594 + pre_PKG_CONFIG_CFLAGS=$CFLAGS
595 + pre_PKG_CONFIG_LIBS=$LIBS
596 +@@ -1284,7 +1178,7 @@
597 + AC_CHECK_HEADERS_ONCE(
598 + linux/version.h sys/systeminfo.h
599 + stdio_ext.h fcntl.h coff.h pty.h
600 +- sys/vlimit.h sys/resource.h
601 ++ sys/resource.h
602 + sys/utsname.h pwd.h utmp.h dirent.h util.h)
603 +
604 + AC_MSG_CHECKING(if personality LINUX32 can be set)
605 +@@ -1501,8 +1395,6 @@
606 + CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
607 + LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES}"
608 + LIBS_GNUSTEP="-lgnustep-gui -lgnustep-base -lobjc -lpthread"
609 +- LIB_STANDARD=
610 +- START_FILES=
611 + dnl GNUstep defines BASE_NATIVE_OBJC_EXCEPTIONS to 0 or 1.
612 + dnl If they had chosen to either define it or not, we could have
613 + dnl just used AC_CHECK_DECL here.
614 +@@ -1591,7 +1483,6 @@
615 + AC_SUBST(ns_self_contained)
616 + AC_SUBST(NS_OBJ)
617 + AC_SUBST(NS_OBJC_OBJ)
618 +-AC_SUBST(LIB_STANDARD)
619 +
620 + HAVE_W32=no
621 + W32_OBJ=
622 +@@ -1716,6 +1607,20 @@
623 + else
624 + test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o
625 + VMLIMIT_OBJ=vm-limit.o
626 ++
627 ++ AC_CHECK_HEADERS([sys/vlimit.h])
628 ++ AC_CACHE_CHECK([for data_start], [emacs_cv_data_start],
629 ++ [AC_LINK_IFELSE(
630 ++ [AC_LANG_PROGRAM(
631 ++ [[extern char data_start[]; char ch;]],
632 ++ [[return data_start == &ch;]])],
633 ++ [emacs_cv_data_start=yes],
634 ++ [emacs_cv_data_start=no])])
635 ++ if test $emacs_cv_data_start = yes; then
636 ++ AC_DEFINE([HAVE_DATA_START], 1,
637 ++ [Define to 1 if data_start is the address of the start
638 ++ of the main data segment.])
639 ++ fi
640 + fi
641 + AC_SUBST(GMALLOC_OBJ)
642 + AC_SUBST(VMLIMIT_OBJ)
643 +@@ -3759,9 +3664,7 @@
644 + fi dnl emacs_glibc
645 +
646 +
647 +-dnl Used in vm-limit.c
648 +-AH_TEMPLATE(DATA_START, [Address of the start of the data segment.])
649 +-dnl Used in lisp.h, emacs.c, mem-limits.h
650 ++dnl Used in lisp.h, emacs.c, vm-limit.c
651 + dnl NEWS.18 describes this as "a number which contains
652 + dnl the high bits to be inclusive or'ed with pointers that are unpacked."
653 + AH_TEMPLATE(DATA_SEG_BITS, [Extra bits to be or'd in with any pointers
654 +@@ -3769,23 +3672,15 @@
655 + dnl if Emacs uses fewer than 32 bits for the value field of a LISP_OBJECT.
656 +
657 + case $opsys in
658 +- gnu)
659 +- dnl libc defines data_start.
660 +- AC_DEFINE(DATA_START, [({ extern int data_start; (char *) &data_start; })])
661 +- ;;
662 +-
663 + aix*)
664 + dnl This works with 32-bit executables; Emacs doesn't support 64-bit.
665 +- AC_DEFINE(DATA_START, [0x20000000])
666 + AC_DEFINE(DATA_SEG_BITS, [0x20000000])
667 + ;;
668 + hpux*)
669 + dnl The data segment on this machine always starts at address 0x40000000.
670 +- AC_DEFINE(DATA_START, [0x40000000])
671 + AC_DEFINE(DATA_SEG_BITS, [0x40000000])
672 + ;;
673 + irix6-5)
674 +- AC_DEFINE(DATA_START, [0x10000000])
675 + AC_DEFINE(DATA_SEG_BITS, [0x10000000])
676 + ;;
677 + esac
678 +@@ -4373,88 +4268,6 @@
679 +
680 + AC_SUBST(LD_SWITCH_SYSTEM_TEMACS)
681 +
682 +-
683 +-LD_FIRSTFLAG=
684 +-ORDINARY_LINK=
685 +-case "$opsys" in
686 +- ## gnu: GNU needs its own crt0.
687 +- aix4-2|cygwin|darwin|gnu|hpux*|irix6-5|sol2*|unixware) ORDINARY_LINK=yes ;;
688 +-
689 +- ## On post 1.3 releases of NetBSD, gcc -nostdlib also clears the
690 +- ## library search parth, i.e. it won't search /usr/lib for libc and
691 +- ## friends. Using -nostartfiles instead avoids this problem, and
692 +- ## will also work on earlier NetBSD releases.
693 +- netbsd|openbsd) LD_FIRSTFLAG="-nostartfiles" ;;
694 +-
695 +- ## powerpc*: NAKAJI Hiroyuki <nakaji@××××××××××××.jp> says
696 +- ## MkLinux/LinuxPPC needs this.
697 +- ## s390x-* only supports opsys = gnu-linux so it can be added here.
698 +- gnu-*)
699 +- case "$canonical" in
700 +- powerpc*|s390x-*) LD_FIRSTFLAG="-nostdlib" ;;
701 +- esac
702 +- ;;
703 +-esac
704 +-
705 +-
706 +-if test "x$ORDINARY_LINK" = "xyes"; then
707 +-
708 +- LD_FIRSTFLAG=""
709 +- AC_DEFINE(ORDINARY_LINK, 1, [Define if the C compiler is the linker.])
710 +-
711 +-## The system files defining neither ORDINARY_LINK nor LD_FIRSTFLAG are:
712 +-## freebsd, gnu-* not on powerpc*|s390x*.
713 +-elif test "x$GCC" = "xyes" && test "x$LD_FIRSTFLAG" = "x"; then
714 +-
715 +- ## Versions of GCC >= 2.0 put their library, libgcc.a, in obscure
716 +- ## places that are difficult to figure out at make time. Fortunately,
717 +- ## these same versions allow you to pass arbitrary flags on to the
718 +- ## linker, so there is no reason not to use it as a linker.
719 +- ##
720 +- ## Well, it is not quite perfect. The "-nostdlib" keeps GCC from
721 +- ## searching for libraries in its internal directories, so we have to
722 +- ## ask GCC explicitly where to find libgcc.a (LIB_GCC below).
723 +- LD_FIRSTFLAG="-nostdlib"
724 +-fi
725 +-
726 +-## FIXME? What setting of EDIT_LDFLAGS should this have?
727 +-test "$NS_IMPL_GNUSTEP" = "yes" && LD_FIRSTFLAG="-rdynamic"
728 +-
729 +-AC_SUBST(LD_FIRSTFLAG)
730 +-
731 +-
732 +-## FIXME? The logic here is not precisely the same as that above.
733 +-## There is no check here for a pre-defined LD_FIRSTFLAG.
734 +-## Should we only be setting LIB_GCC if LD ~ -nostdlib?
735 +-LIB_GCC=
736 +-if test "x$GCC" = "xyes" && test "x$ORDINARY_LINK" != "xyes"; then
737 +-
738 +- case "$opsys" in
739 +- freebsd|netbsd|openbsd) LIB_GCC= ;;
740 +-
741 +- gnu-*)
742 +- ## armin76@g.o reported that the lgcc_s flag is necessary to
743 +- ## build on ARM EABI under GNU/Linux. (Bug#5518)
744 +- case $host_cpu in
745 +- arm*)
746 +- LIB_GCC="-lgcc_s"
747 +- ;;
748 +- *)
749 +- ## FIXME? s/gnu-linux.h used to define LIB_GCC as below, then
750 +- ## immediately undefine it again and redefine it to empty.
751 +- ## Was the C_SWITCH_X_SITE part really necessary?
752 +-## LIB_GCC=`$CC $C_SWITCH_X_SITE -print-libgcc-file-name`
753 +- LIB_GCC=
754 +- ;;
755 +- esac
756 +- ;;
757 +-
758 +- ## Ask GCC where to find libgcc.a.
759 +- *) LIB_GCC=`$CC -print-libgcc-file-name 2> /dev/null` ;;
760 +- esac
761 +-fi dnl if $GCC
762 +-AC_SUBST(LIB_GCC)
763 +-
764 + ## Common for all window systems
765 + if test "$window_system" != "none"; then
766 + AC_DEFINE(HAVE_WINDOW_SYSTEM, 1, [Define if you have a window system.])
767 +--- a/src/Makefile.in
768 ++++ b/src/Makefile.in
769 +@@ -34,7 +34,6 @@
770 + CFLAGS = @CFLAGS@
771 + CPPFLAGS = @CPPFLAGS@
772 + LDFLAGS = @LDFLAGS@
773 +-LD_FIRSTFLAG=@LD_FIRSTFLAG@
774 + EXEEXT = @EXEEXT@
775 + version = @version@
776 + # Substitute an assignment for the MAKE variable, because
777 +@@ -100,10 +99,8 @@
778 + ## System-specific LDFLAGS.
779 + LD_SWITCH_SYSTEM=@LD_SWITCH_SYSTEM@
780 +
781 +-## This holds any special options for linking temacs only (ie, not
782 +-## used by configure). Not used elsewhere because it sometimes
783 +-## contains options that have to do with using Emacs's crt0,
784 +-## which are only good with temacs.
785 ++## This holds any special options for linking temacs only (i.e., not
786 ++## used by configure).
787 + LD_SWITCH_SYSTEM_TEMACS=@LD_SWITCH_SYSTEM_TEMACS@
788 +
789 + ## Flags to pass to ld only for temacs.
790 +@@ -121,14 +118,6 @@
791 + ## Some systems define this to request special libraries.
792 + LIBS_SYSTEM=@LIBS_SYSTEM@
793 +
794 +-## Where to find libgcc.a, if using gcc and necessary.
795 +-LIB_GCC=@LIB_GCC@
796 +-
797 +-CRT_DIR=@CRT_DIR@
798 +-## May use $CRT_DIR.
799 +-LIB_STANDARD=@LIB_STANDARD@
800 +-START_FILES = @START_FILES@
801 +-
802 + ## -lm, or empty.
803 + LIB_MATH=@LIB_MATH@
804 +
805 +@@ -381,17 +370,16 @@
806 +
807 + ## List of object files that make-docfile should not be told about.
808 + otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(GMALLOC_OBJ) $(RALLOC_OBJ) \
809 +- $(POST_ALLOC_OBJ) $(VMLIMIT_OBJ) $(WIDGET_OBJ) $(LIBOBJS)
810 ++ $(POST_ALLOC_OBJ) $(WIDGET_OBJ) $(LIBOBJS)
811 +
812 ++## All object files linked into temacs. $(VMLIMIT_OBJ) should be first.
813 ++ALLOBJS = $(VMLIMIT_OBJ) $(obj) $(otherobj)
814 +
815 + ## Configure inserts the file lisp.mk at this point, defining $lisp.
816 + @lisp_frag@
817 +
818 +
819 + ## Construct full set of libraries to be linked.
820 +-## Note that SunOS needs -lm to come before -lc; otherwise, you get
821 +-## duplicated symbols. If the standard libraries were compiled
822 +-## with GCC, we might need LIB_GCC again after them.
823 + LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) $(LIBIMAGE) \
824 + $(LIBX_OTHER) $(LIBSOUND) \
825 + $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(LIB_CLOCK_GETTIME) \
826 +@@ -401,7 +389,7 @@
827 + $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \
828 + $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
829 + $(LIBGNUTLS_LIBS) $(LIB_PTHREAD) $(LIB_PTHREAD_SIGMASK) \
830 +- $(LIB_GCC) $(LIB_MATH) $(LIB_STANDARD) $(LIB_GCC)
831 ++ $(LIB_MATH)
832 +
833 + all: emacs$(EXEEXT) $(OTHER_FILES)
834 + .PHONY: all
835 +@@ -448,7 +436,7 @@
836 + cd $(libsrc); $(MAKE) $(MFLAGS) make-docfile$(EXEEXT)
837 +
838 + buildobj.h: Makefile
839 +- echo "#define BUILDOBJ \"$(obj) $(otherobj) " "\"" > buildobj.h
840 ++ echo "#define BUILDOBJ \"$(ALLOBJS) " "\"" >$@
841 +
842 + globals.h: gl-stamp; @true
843 +
844 +@@ -460,14 +448,14 @@
845 + $(srcdir)/../build-aux/move-if-change gl-tmp globals.h
846 + echo timestamp > $@
847 +
848 +-$(obj) $(otherobj): globals.h
849 ++$(ALLOBJS): globals.h
850 +
851 + $(lib)/libgnu.a: $(config_h)
852 + cd $(lib) && $(MAKE) libgnu.a
853 +
854 +-temacs$(EXEEXT): $(START_FILES) stamp-oldxmenu $(obj) $(otherobj) $(lib)/libgnu.a
855 +- $(CC) $(LD_FIRSTFLAG) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \
856 +- -o temacs $(START_FILES) $(obj) $(otherobj) $(lib)/libgnu.a $(LIBES)
857 ++temacs$(EXEEXT): stamp-oldxmenu $(ALLOBJS) $(lib)/libgnu.a
858 ++ $(CC) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \
859 ++ -o temacs $(ALLOBJS) $(lib)/libgnu.a $(LIBES)
860 + test "$(CANNOT_DUMP)" = "yes" || \
861 + test "X$(PAXCTL)" = X || $(PAXCTL) -r temacs$(EXEEXT)
862 + test "$(CANNOT_DUMP)" = "yes" || test "X$(SETFATTR)" = X || \
863 +--- a/src/autodeps.mk
864 ++++ b/src/autodeps.mk
865 +@@ -2,5 +2,4 @@
866 +
867 + ## This is inserted in src/Makefile if AUTO_DEPEND=yes.
868 +
869 +-ALLOBJS=$(START_FILES) ${obj} ${otherobj}
870 + -include $(ALLOBJS:%.o=${DEPDIR}/%.d)
871 +--- a/src/deps.mk
872 ++++ b/src/deps.mk
873 +@@ -143,7 +143,7 @@
874 + dispextern.h lisp.h globals.h $(config_h) systime.h coding.h composite.h
875 + gmalloc.o: gmalloc.c $(config_h)
876 + ralloc.o: ralloc.c lisp.h $(config_h)
877 +-vm-limit.o: vm-limit.c mem-limits.h lisp.h globals.h $(config_h)
878 ++vm-limit.o: vm-limit.c lisp.h globals.h $(config_h)
879 + marker.o: marker.c buffer.h character.h lisp.h globals.h $(config_h)
880 + minibuf.o: minibuf.c syntax.h frame.h window.h keyboard.h systime.h \
881 + buffer.h commands.h character.h msdos.h $(INTERVALS_H) keymap.h \
882 +--- a/src/emacs.c
883 ++++ b/src/emacs.c
884 +@@ -522,32 +522,6 @@
885 + static char dump_tz[] = "UtC0";
886 + #endif
887 +
888 +-#ifndef ORDINARY_LINK
889 +-/* We don't include crtbegin.o and crtend.o in the link,
890 +- so these functions and variables might be missed.
891 +- Provide dummy definitions to avoid error.
892 +- (We don't have any real constructors or destructors.) */
893 +-#ifdef __GNUC__
894 +-
895 +-/* Define a dummy function F. Declare F too, to pacify gcc
896 +- -Wmissing-prototypes. */
897 +-#define DEFINE_DUMMY_FUNCTION(f) \
898 +- void f (void) ATTRIBUTE_CONST EXTERNALLY_VISIBLE; void f (void) {}
899 +-
900 +-#ifndef GCC_CTORS_IN_LIBC
901 +-DEFINE_DUMMY_FUNCTION (__do_global_ctors)
902 +-DEFINE_DUMMY_FUNCTION (__do_global_ctors_aux)
903 +-DEFINE_DUMMY_FUNCTION (__do_global_dtors)
904 +-/* GNU/Linux has a bug in its library; avoid an error. */
905 +-#ifndef GNU_LINUX
906 +-char * __CTOR_LIST__[2] EXTERNALLY_VISIBLE = { (char *) (-1), 0 };
907 +-#endif
908 +-char * __DTOR_LIST__[2] EXTERNALLY_VISIBLE = { (char *) (-1), 0 };
909 +-#endif /* GCC_CTORS_IN_LIBC */
910 +-DEFINE_DUMMY_FUNCTION (__main)
911 +-#endif /* __GNUC__ */
912 +-#endif /* ORDINARY_LINK */
913 +-
914 + /* Test whether the next argument in ARGV matches SSTR or a prefix of
915 + LSTR (at least MINLEN characters). If so, then if VALPTR is non-null
916 + (the argument is supposed to have a value) store in *VALPTR either
917 +--- a/src/vm-limit.c
918 ++++ b/src/vm-limit.c
919 +@@ -19,7 +19,37 @@
920 + #include <config.h>
921 + #include <unistd.h> /* for 'environ', on AIX */
922 + #include "lisp.h"
923 +-#include "mem-limits.h"
924 ++
925 ++#ifdef MSDOS
926 ++#include <dpmi.h>
927 ++extern int etext;
928 ++#endif
929 ++
930 ++/* Some systems need this before <sys/resource.h>. */
931 ++#include <sys/types.h>
932 ++
933 ++#ifdef HAVE_SYS_RESOURCE_H
934 ++# include <sys/time.h>
935 ++# include <sys/resource.h>
936 ++#else
937 ++# if HAVE_SYS_VLIMIT_H
938 ++# include <sys/vlimit.h> /* Obsolete, says glibc */
939 ++# endif
940 ++#endif
941 ++
942 ++/* Start of data. It is OK if this is approximate; it's used only as
943 ++ a heuristic. */
944 ++#ifdef DATA_START
945 ++# define data_start ((char *) DATA_START)
946 ++#else
947 ++extern char data_start[];
948 ++# ifndef HAVE_DATA_START
949 ++/* Initialize to nonzero, so that it's put into data and not bss.
950 ++ Link this file's object code first, so that this symbol is near the
951 ++ start of data. */
952 ++char data_start[1] = { 1 };
953 ++# endif
954 ++#endif
955 +
956 + /*
957 + Level number of warnings already issued.
958 +@@ -43,6 +73,14 @@
959 + /* Number of bytes of writable memory we can expect to be able to get. */
960 + static size_t lim_data;
961 +
962 ++/* Return true if PTR cannot be represented as an Emacs Lisp object. */
963 ++static bool
964 ++exceeds_lisp_ptr (void *ptr)
965 ++{
966 ++ return (! USE_LSB_TAG
967 ++ && VAL_MAX < UINTPTR_MAX
968 ++ && ((uintptr_t) ptr & ~DATA_SEG_BITS) >> VALBITS != 0);
969 ++}
970 +
971 + #if defined (HAVE_GETRLIMIT) && defined (RLIMIT_AS)
972 + static void
973 +@@ -169,6 +207,8 @@
974 + {
975 + #ifdef REL_ALLOC
976 + extern POINTER (*real_morecore) (ptrdiff_t);
977 ++#else
978 ++ POINTER (*real_morecore) (ptrdiff_t) = 0;
979 + #endif
980 + extern POINTER (*__morecore) (ptrdiff_t);
981 +
982 +@@ -182,13 +222,8 @@
983 + five_percent = lim_data / 20;
984 +
985 + /* Find current end of memory and issue warning if getting near max */
986 +-#ifdef REL_ALLOC
987 +- if (real_morecore)
988 +- cp = (char *) (*real_morecore) (0);
989 +- else
990 +-#endif
991 +- cp = (char *) (*__morecore) (0);
992 +- data_size = (char *) cp - (char *) data_space_start;
993 ++ cp = (real_morecore ? real_morecore : __morecore) (0);
994 ++ data_size = cp - data_space_start;
995 +
996 + if (!warn_function)
997 + return;
998 +@@ -235,49 +270,10 @@
999 + warnlevel = warned_85;
1000 + }
1001 +
1002 +- if (EXCEEDS_LISP_PTR (cp))
1003 ++ if (exceeds_lisp_ptr (cp))
1004 + (*warn_function) ("Warning: memory in use exceeds lisp pointer size");
1005 + }
1006 +
1007 +-#if !defined (CANNOT_DUMP) || !defined (SYSTEM_MALLOC)
1008 +-/* Some systems that cannot dump also cannot implement these. */
1009 +-
1010 +-/*
1011 +- * Return the address of the start of the data segment prior to
1012 +- * doing an unexec. After unexec the return value is undefined.
1013 +- * See crt0.c for further information and definition of data_start.
1014 +- *
1015 +- * Apparently, on BSD systems this is etext at startup. On
1016 +- * USG systems (swapping) this is highly mmu dependent and
1017 +- * is also dependent on whether or not the program is running
1018 +- * with shared text. Generally there is a (possibly large)
1019 +- * gap between end of text and start of data with shared text.
1020 +- *
1021 +- */
1022 +-
1023 +-char *
1024 +-start_of_data (void)
1025 +-{
1026 +-#ifdef BSD_SYSTEM
1027 +- extern char etext;
1028 +- return (POINTER)(&etext);
1029 +-#elif defined DATA_START
1030 +- return ((POINTER) DATA_START);
1031 +-#elif defined ORDINARY_LINK
1032 +- /*
1033 +- * This is a hack. Since we're not linking crt0.c or pre_crt0.c,
1034 +- * data_start isn't defined. We take the address of environ, which
1035 +- * is known to live at or near the start of the system crt0.c, and
1036 +- * we don't sweat the handful of bytes that might lose.
1037 +- */
1038 +- return ((POINTER) &environ);
1039 +-#else
1040 +- extern int data_start;
1041 +- return ((POINTER) &data_start);
1042 +-#endif
1043 +-}
1044 +-#endif /* (not CANNOT_DUMP or not SYSTEM_MALLOC) */
1045 +-
1046 + /* Enable memory usage warnings.
1047 + START says where the end of pure storage is.
1048 + WARNFUN specifies the function to call to issue a warning. */
1049 +@@ -287,10 +283,7 @@
1050 + {
1051 + extern void (* __after_morecore_hook) (void); /* From gmalloc.c */
1052 +
1053 +- if (start)
1054 +- data_space_start = start;
1055 +- else
1056 +- data_space_start = start_of_data ();
1057 ++ data_space_start = start ? start : data_start;
1058 +
1059 + warn_function = warnfun;
1060 + __after_morecore_hook = check_memory_limits;
1061
1062 diff --git a/app-editors/emacs/files/emacs-24.3-giflib-5.patch b/app-editors/emacs/files/emacs-24.3-giflib-5.patch
1063 new file mode 100644
1064 index 0000000..992a811
1065 --- /dev/null
1066 +++ b/app-editors/emacs/files/emacs-24.3-giflib-5.patch
1067 @@ -0,0 +1,168 @@
1068 +commit f3606ef766bcec86789316a05949f1e67a51e7c1
1069 +Author: Barry Fishman <barry_fishman@×××.org>
1070 +Date: Wed Oct 9 20:37:44 2013 -0400
1071 +
1072 + Handle giflib 5 changes (tiny change)
1073 +
1074 + * configure.ac: Update for giflib 5.
1075 +
1076 + * src/image.c (GIFLIB_MAJOR): Ensure it's defined.
1077 + (DGifOpen, DGifOpenFileName): Handle giflib 5 syntax. (Bug#15531)
1078 +
1079 +commit be316ede5fffb724852ee225489e70778d240bb0
1080 +Author: Paul Eggert <eggert@×××××××.edu>
1081 +Date: Tue Jan 7 13:14:32 2014 -0800
1082 +
1083 + Fix misdisplay of interlaced GIFs with libgif5.
1084 +
1085 + * image.c (gif_load): libgif5 deinterlaces for us, so don't do
1086 + it again.
1087 +
1088 + Fixes: debbugs:16372
1089 +
1090 +--- a/configure.ac
1091 ++++ b/configure.ac
1092 +@@ -2674,8 +2674,9 @@
1093 + || test "${HAVE_W32}" = "yes"; then
1094 + AC_CHECK_HEADER(gif_lib.h,
1095 + # EGifPutExtensionLast only exists from version libungif-4.1.0b1.
1096 +-# Earlier versions can crash Emacs.
1097 +- [AC_CHECK_LIB(gif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=maybe)])
1098 ++# Earlier versions can crash Emacs, but version 5.0 removes EGifPutExtensionLast.
1099 ++ [AC_CHECK_LIB(gif, GifMakeMapObject, HAVE_GIF=yes,
1100 ++ [AC_CHECK_LIB(gif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=maybe)])])
1101 +
1102 + if test "$HAVE_GIF" = yes; then
1103 + LIBGIF=-lgif
1104 +--- a/src/image.c
1105 ++++ b/src/image.c
1106 +@@ -7095,14 +7095,25 @@
1107 +
1108 + #endif /* HAVE_NTGUI */
1109 +
1110 ++#ifndef GIFLIB_MAJOR
1111 ++#define GIFLIB_MAJOR 0
1112 ++#endif
1113 ++#ifndef GIFLIB_MINOR
1114 ++#define GIFLIB_MINOR 0
1115 ++#endif
1116 +
1117 + #ifdef WINDOWSNT
1118 +
1119 + /* GIF library details. */
1120 + DEF_IMGLIB_FN (int, DGifCloseFile, (GifFileType *));
1121 + DEF_IMGLIB_FN (int, DGifSlurp, (GifFileType *));
1122 ++#if GIFLIB_MAJOR < 5
1123 + DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc));
1124 + DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *));
1125 ++#else
1126 ++DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc, int *));
1127 ++DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *, int *));
1128 ++#endif
1129 +
1130 + static bool
1131 + init_gif_functions (void)
1132 +@@ -7192,7 +7203,11 @@
1133 + }
1134 +
1135 + /* Open the GIF file. */
1136 ++#if GIFLIB_MAJOR < 5
1137 + gif = fn_DGifOpenFileName (SSDATA (file));
1138 ++#else
1139 ++ gif = fn_DGifOpenFileName (SSDATA (file), NULL);
1140 ++#endif
1141 + if (gif == NULL)
1142 + {
1143 + image_error ("Cannot open `%s'", file, Qnil);
1144 +@@ -7213,7 +7228,11 @@
1145 + memsrc.len = SBYTES (specified_data);
1146 + memsrc.index = 0;
1147 +
1148 ++#if GIFLIB_MAJOR < 5
1149 + gif = fn_DGifOpen (&memsrc, gif_read_from_memory);
1150 ++#else
1151 ++ gif = fn_DGifOpen (&memsrc, gif_read_from_memory, NULL);
1152 ++#endif
1153 + if (!gif)
1154 + {
1155 + image_error ("Cannot open memory source `%s'", img->spec, Qnil);
1156 +@@ -7225,7 +7244,11 @@
1157 + if (!check_image_size (f, gif->SWidth, gif->SHeight))
1158 + {
1159 + image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
1160 ++#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
1161 + fn_DGifCloseFile (gif);
1162 ++#else
1163 ++ fn_DGifCloseFile (gif, NULL);
1164 ++#endif
1165 + return 0;
1166 + }
1167 +
1168 +@@ -7234,7 +7257,11 @@
1169 + if (rc == GIF_ERROR || gif->ImageCount <= 0)
1170 + {
1171 + image_error ("Error reading `%s'", img->spec, Qnil);
1172 ++#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
1173 + fn_DGifCloseFile (gif);
1174 ++#else
1175 ++ fn_DGifCloseFile (gif, NULL);
1176 ++#endif
1177 + return 0;
1178 + }
1179 +
1180 +@@ -7246,7 +7273,11 @@
1181 + {
1182 + image_error ("Invalid image number `%s' in image `%s'",
1183 + image_number, img->spec);
1184 ++#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
1185 + fn_DGifCloseFile (gif);
1186 ++#else
1187 ++ fn_DGifCloseFile (gif, NULL);
1188 ++#endif
1189 + return 0;
1190 + }
1191 + }
1192 +@@ -7264,14 +7295,22 @@
1193 + if (!check_image_size (f, width, height))
1194 + {
1195 + image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
1196 ++#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
1197 + fn_DGifCloseFile (gif);
1198 ++#else
1199 ++ fn_DGifCloseFile (gif, NULL);
1200 ++#endif
1201 + return 0;
1202 + }
1203 +
1204 + /* Create the X image and pixmap. */
1205 + if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
1206 + {
1207 ++#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
1208 + fn_DGifCloseFile (gif);
1209 ++#else
1210 ++ fn_DGifCloseFile (gif, NULL);
1211 ++#endif
1212 + return 0;
1213 + }
1214 +
1215 +@@ -7370,7 +7409,7 @@
1216 + }
1217 +
1218 + /* Apply the pixel values. */
1219 +- if (gif->SavedImages[j].ImageDesc.Interlace)
1220 ++ if (GIFLIB_MAJOR < 5 && gif->SavedImages[j].ImageDesc.Interlace)
1221 + {
1222 + int row, pass;
1223 +
1224 +@@ -7447,7 +7486,11 @@
1225 + Fcons (make_number (gif->ImageCount),
1226 + img->lisp_data));
1227 +
1228 ++#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
1229 + fn_DGifCloseFile (gif);
1230 ++#else
1231 ++ fn_DGifCloseFile (gif, NULL);
1232 ++#endif
1233 +
1234 + /* Maybe fill in the background field while we have ximg handy. */
1235 + if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
1236
1237 diff --git a/app-editors/emacs/files/emacs-24.3-jpeg-version.patch b/app-editors/emacs/files/emacs-24.3-jpeg-version.patch
1238 new file mode 100644
1239 index 0000000..a5845c0
1240 --- /dev/null
1241 +++ b/app-editors/emacs/files/emacs-24.3-jpeg-version.patch
1242 @@ -0,0 +1,25 @@
1243 +commit ff3878d749591ebf78da532ec1eb6fa00cb5757d
1244 +Author: Andreas Schwab <schwab@××××.de>
1245 +Date: Mon Mar 23 11:55:24 2015 +0100
1246 +
1247 + * configure.ac: Fix jpeg version check to work with gcc >= 5.
1248 +
1249 +--- a/configure.ac
1250 ++++ b/configure.ac
1251 +@@ -2598,10 +2598,12 @@
1252 + AH_TEMPLATE(HAVE_JPEG, [Define to 1 if you have the jpeg library (-ljpeg).])dnl
1253 + if test "${HAVE_JPEG}" = "yes"; then
1254 + AC_DEFINE(HAVE_JPEG)
1255 +- AC_EGREP_CPP([version= *(6[2-9]|[7-9][0-9])],
1256 +- [#include <jpeglib.h>
1257 +- version=JPEG_LIB_VERSION
1258 +-],
1259 ++ AC_EGREP_CPP([version 6b or later],
1260 ++ [#include <jpeglib.h>
1261 ++ #if JPEG_LIB_VERSION >= 62
1262 ++ version 6b or later
1263 ++ #endif
1264 ++ ],
1265 + [AC_DEFINE(HAVE_JPEG)],
1266 + [AC_MSG_WARN([libjpeg found, but not version 6b or later])
1267 + HAVE_JPEG=no])
1268
1269 diff --git a/app-editors/emacs/metadata.xml b/app-editors/emacs/metadata.xml
1270 new file mode 100644
1271 index 0000000..720733b
1272 --- /dev/null
1273 +++ b/app-editors/emacs/metadata.xml
1274 @@ -0,0 +1,44 @@
1275 +<?xml version="1.0" encoding="UTF-8"?>
1276 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
1277 +<pkgmetadata>
1278 +<maintainer type="project">
1279 + <email>gnu-emacs@g.o</email>
1280 + <name>Gentoo GNU Emacs project</name>
1281 +</maintainer>
1282 +<longdescription>
1283 + GNU Emacs is an extensible, customizable text editor - and more. At its core
1284 + is an interpreter for Emacs Lisp, a dialect of the Lisp programming language
1285 + with extensions to support text editing. The features of GNU Emacs include:
1286 + * Content-sensitive editing modes, including syntax coloring, for a variety
1287 + of file types including plain text, source code, and HTML.
1288 + * Complete built-in documentation, including a tutorial for new users.
1289 + * Full Unicode support for nearly all human languages and their scripts.
1290 + * Highly customizable, using Emacs Lisp code or a graphical interface.
1291 + * A large number of extensions that add other functionality, including a
1292 + project planner, mail and news reader, debugger interface, calendar, and
1293 + more. Many of these extensions are distributed with GNU Emacs; others are
1294 + available separately.
1295 +</longdescription>
1296 +<use>
1297 + <flag name="athena">Enable the MIT Athena widget set
1298 + (<pkg>x11-libs/libXaw</pkg>)</flag>
1299 + <flag name="gconf">Use <pkg>gnome-base/gconf</pkg> to read the system
1300 + font name</flag>
1301 + <flag name="gsettings">Use gsettings (<pkg>dev-libs/glib</pkg>) to read the
1302 + system font name</flag>
1303 + <flag name="gtk3">Prefer version 3 of the GIMP Toolkit to version 2
1304 + (<pkg>x11-libs/gtk+</pkg>)</flag>
1305 + <flag name="gzip-el">Compress bundled Emacs Lisp source</flag>
1306 + <flag name="imagemagick">Use <pkg>media-gfx/imagemagick</pkg> for image
1307 + processing</flag>
1308 + <flag name="libxml2">Use <pkg>dev-libs/libxml2</pkg> to parse XML instead
1309 + of the internal Lisp implementations</flag>
1310 + <flag name="source">Install C source files and make them available for
1311 + find-function</flag>
1312 + <flag name="toolkit-scroll-bars">Use the selected toolkit's scrollbars in
1313 + preference to Emacs' own scrollbars</flag>
1314 + <flag name="wide-int">Prefer wide Emacs integers (typically 62-bit).
1315 + This option has an effect only on architectures where "long" and
1316 + "long long" types have different size.</flag>
1317 +</use>
1318 +</pkgmetadata>