public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/hardened-dev:musl commit in: app-editors/emacs/files/, app-editors/emacs/
@ 2015-02-07 18:57 Anthony G. Basile
  0 siblings, 0 replies; only message in thread
From: Anthony G. Basile @ 2015-02-07 18:57 UTC (permalink / raw
  To: gentoo-commits

commit:     ce73c25b148e24f7fe94ca6c888820d35c5b0de1
Author:     Felix Janda <felix.janda <AT> posteo <DOT> de>
AuthorDate: Thu Feb  5 17:45:54 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Feb  7 18:58:50 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=ce73c25b

app-editors/emacs: LD_PRELOAD hack from Rich Felker

---
 app-editors/emacs/emacs-24.4-r99.ebuild            | 348 +++++++++++++++++++++
 .../files/emacs-24.3-alloc-invalid-frees.patch     |  58 ++++
 app-editors/emacs/files/emacs-24.3-stderr.patch    |  11 +
 app-editors/emacs/files/emacs-24.4-configure.patch |  10 +
 app-editors/emacs/files/emacs-24.4-lisp.patch      |  10 +
 .../emacs/files/emacs-24.4-preload-hack.patch      |  11 +
 app-editors/emacs/files/preload.c                  |  88 ++++++
 app-editors/emacs/metadata.xml                     |  46 +++
 8 files changed, 582 insertions(+)

diff --git a/app-editors/emacs/emacs-24.4-r99.ebuild b/app-editors/emacs/emacs-24.4-r99.ebuild
new file mode 100644
index 0000000..385d930
--- /dev/null
+++ b/app-editors/emacs/emacs-24.4-r99.ebuild
@@ -0,0 +1,348 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-editors/emacs/emacs-24.4-r2.ebuild,v 1.1 2015/01/23 20:38:44 ulm Exp $
+
+EAPI=5
+
+inherit elisp-common eutils flag-o-matic multilib readme.gentoo
+
+DESCRIPTION="The extensible, customizable, self-documenting real-time display editor"
+HOMEPAGE="http://www.gnu.org/software/emacs/"
+SRC_URI="mirror://gnu/emacs/${P}.tar.xz
+	http://dev.gentoo.org/~ulm/emacs/${P}-patches-3.tar.xz"
+
+LICENSE="GPL-3+ FDL-1.3+ BSD HPND MIT W3C unicode PSF-2"
+SLOT="24"
+KEYWORDS="amd64 ~arm ~mips ~ppc ~x86"
+IUSE="acl alsa aqua athena dbus games gconf gfile gif gnutls gpm gsettings gtk +gtk3 gzip-el hesiod imagemagick +inotify jpeg kerberos libxml2 livecd m17n-lib motif pax_kernel png selinux sound source svg tiff toolkit-scroll-bars wide-int X Xaw3d xft +xpm zlib"
+REQUIRED_USE="?? ( aqua X )"
+
+RDEPEND="sys-libs/ncurses
+	>=app-admin/eselect-emacs-1.16
+	>=app-emacs/emacs-common-gentoo-1.4-r1[games?,X?]
+	net-libs/liblockfile
+	acl? ( virtual/acl )
+	alsa? ( media-libs/alsa-lib )
+	dbus? ( sys-apps/dbus )
+	gfile? ( >=dev-libs/glib-2.28.6 )
+	gnutls? ( net-libs/gnutls )
+	gpm? ( sys-libs/gpm )
+	hesiod? ( net-dns/hesiod )
+	kerberos? ( virtual/krb5 )
+	libxml2? ( >=dev-libs/libxml2-2.2.0 )
+	selinux? ( sys-libs/libselinux )
+	zlib? ( sys-libs/zlib )
+	X? (
+		x11-libs/libXmu
+		x11-libs/libXt
+		x11-misc/xbitmaps
+		gconf? ( >=gnome-base/gconf-2.26.2 )
+		gsettings? ( >=dev-libs/glib-2.28.6 )
+		gif? ( media-libs/giflib )
+		jpeg? ( virtual/jpeg:0= )
+		png? ( >=media-libs/libpng-1.4:0= )
+		svg? ( >=gnome-base/librsvg-2.0 )
+		tiff? ( media-libs/tiff )
+		xpm? ( x11-libs/libXpm )
+		imagemagick? ( >=media-gfx/imagemagick-6.6.2 )
+		xft? (
+			media-libs/fontconfig
+			media-libs/freetype
+			x11-libs/libXft
+			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 )
+			!motif? (
+				Xaw3d? ( x11-libs/libXaw3d )
+				!Xaw3d? ( athena? ( x11-libs/libXaw ) )
+			)
+		)
+	)"
+
+DEPEND="${RDEPEND}
+	virtual/pkgconfig
+	gzip-el? ( app-arch/gzip )
+	pax_kernel? (
+		sys-apps/attr
+		sys-apps/paxctl
+	)"
+
+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_prepare() {
+	EPATCH_SUFFIX=patch epatch
+
+	epatch "${FILESDIR}/${PN}-24.3-stderr.patch"
+	epatch "${FILESDIR}/${PN}-24.3-alloc-invalid-frees.patch"
+	epatch "${FILESDIR}/${PN}-24.4-configure.patch"
+	epatch "${FILESDIR}/${PN}-24.4-preload-hack.patch"
+	epatch "${FILESDIR}/${PN}-24.4-lisp.patch"
+
+	epatch_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"
+
+	#AT_M4DIR=m4 eautoreconf
+}
+
+src_configure() {
+	strip-flags
+	filter-flags -pie					#526948
+
+	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
+
+	local myconf
+
+	if use alsa; then
+		use sound || ewarn \
+			"USE flag \"alsa\" overrides \"-sound\"; enabling sound support."
+		myconf+=" --with-sound=alsa"
+	else
+		myconf+=" --with-sound=$(usex sound oss)"
+	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
+		if use gtk; then
+			einfo "Configuring to build with GIMP Toolkit (GTK+)"
+			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
+
+	# Save version information in the Emacs binary. It will be available
+	# in variable "system-configuration-options".
+	myconf+=" GENTOO_PACKAGE=${CATEGORY}/${PF}"
+
+	econf \
+		--program-suffix="-${EMACS_SUFFIX}" \
+		--infodir="${EPREFIX}"/usr/share/info/${EMACS_SUFFIX} \
+		--localstatedir="${EPREFIX}"/var \
+		--enable-locallisppath="${EPREFIX}/etc/emacs:${EPREFIX}${SITELISP}" \
+		--with-gameuser="${GAMES_USER_DED:-games}" \
+		--without-compress-install \
+		--with-file-notification=$(usev gfile || usev inotify || echo no) \
+		$(use_enable acl) \
+		$(use_with dbus) \
+		$(use_with gnutls) \
+		$(use_with gpm) \
+		$(use_with hesiod) \
+		$(use_with kerberos) $(use_with kerberos kerberos5) \
+		$(use_with libxml2 xml2) \
+		$(use_with selinux) \
+		$(use_with wide-int) \
+		$(use_with zlib) \
+		${myconf}
+}
+
+src_compile() {
+	echo $S
+	$(tc-getCC) -shared -fPIC -o preload.so "${FILESDIR}/preload.c" || die
+
+	export SANDBOX_ON=0			# for the unbelievers, see Bug #131505
+	emake
+}
+
+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
+
+	if use gzip-el; then
+		# compress .el files when a corresponding .elc exists
+		find "${ED}"/usr/share/emacs/${FULL_VERSION}/lisp -type f \
+			-name "*.elc" -print | sed 's/\.elc$/.el/' | xargs gzip -9n
+		assert "gzip .el failed"
+	fi
+
+	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
+	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
+
+	local pvr
+	for pvr in ${REPLACING_VERSIONS}; do
+		[[ ${pvr%%[-_]*} = 24.[12] ]] && FORCE_PRINT_ELOG=1
+	done
+	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-alloc-invalid-frees.patch b/app-editors/emacs/files/emacs-24.3-alloc-invalid-frees.patch
new file mode 100644
index 0000000..1638e5f
--- /dev/null
+++ b/app-editors/emacs/files/emacs-24.3-alloc-invalid-frees.patch
@@ -0,0 +1,58 @@
+From http://www.openwall.com/lists/musl/2015/02/03/1
+
+--- emacs-24.3.orig/src/alloc.c
++++ emacs-24.3/src/alloc.c
+@@ -47,6 +47,13 @@
+ 
+ #include <verify.h>
+ 
++static void *initial_brk;
++__attribute__((__constructor__))
++static void init()
++{
++	initial_brk = sbrk(0);
++}
++
+ /* GC_CHECK_MARKED_OBJECTS means do sanity checks on allocated objects.
+    Doable only if GC_MARK_STACK.  */
+ #if ! GC_MARK_STACK
+@@ -699,6 +706,14 @@
+ {
+   void *val;
+ 
++  if (block && block < initial_brk) {
++    size_t len = (char *)initial_brk - (char *)block;
++    if (len > size) len = size;
++    void *p = xmalloc(size);
++    memcpy(p, block, len);
++    return p;
++  }
++
+   MALLOC_BLOCK_INPUT;
+   /* We must call malloc explicitly when BLOCK is 0, since some
+      reallocs don't do this.  */
+@@ -720,6 +735,7 @@
+ void
+ xfree (void *block)
+ {
++  if (block < initial_brk) return;
+   if (!block)
+     return;
+   MALLOC_BLOCK_INPUT;
+@@ -910,6 +926,7 @@
+ static void
+ lisp_free (void *block)
+ {
++  if (block < initial_brk) return;
+   MALLOC_BLOCK_INPUT;
+   free (block);
+ #if GC_MARK_STACK && !defined GC_MALLOC_CHECK
+@@ -1117,6 +1134,8 @@
+ {
+   struct ablock *ablock = block;
+   struct ablocks *abase = ABLOCK_ABASE (ablock);
++
++  if (block < initial_brk) return;
+ 
+   MALLOC_BLOCK_INPUT;
+ #if GC_MARK_STACK && !defined GC_MALLOC_CHECK

diff --git a/app-editors/emacs/files/emacs-24.3-stderr.patch b/app-editors/emacs/files/emacs-24.3-stderr.patch
new file mode 100644
index 0000000..a3beb9f
--- /dev/null
+++ b/app-editors/emacs/files/emacs-24.3-stderr.patch
@@ -0,0 +1,11 @@
+--- a/emacs-24.3/src/print.c
++++ b/emacs-24.3/src/print.c
+@@ -733,7 +733,7 @@
+   print_output_debug_flag = x;
+ }
+ 
+-#if defined (GNU_LINUX)
++#if 0
+ 
+ /* This functionality is not vitally important in general, so we rely on
+    non-portable ability to use stderr as lvalue.  */

diff --git a/app-editors/emacs/files/emacs-24.4-configure.patch b/app-editors/emacs/files/emacs-24.4-configure.patch
new file mode 100644
index 0000000..8c63009
--- /dev/null
+++ b/app-editors/emacs/files/emacs-24.4-configure.patch
@@ -0,0 +1,10 @@
+--- a/configure.ac	2015-02-03 20:27:53.649248696 -0100
++++ b/configure.ac	2015-02-03 20:29:40.708910266 -0100
+@@ -2004,6 +2004,7 @@
+   ## darwin ld insists on the use of malloc routines in the System framework.
+   darwin|sol2-10) system_malloc=yes ;;
+ esac
++system_malloc=yes
+ 
+ GMALLOC_OBJ=
+ if test "${system_malloc}" = "yes"; then

diff --git a/app-editors/emacs/files/emacs-24.4-lisp.patch b/app-editors/emacs/files/emacs-24.4-lisp.patch
new file mode 100644
index 0000000..bc8a3f7
--- /dev/null
+++ b/app-editors/emacs/files/emacs-24.4-lisp.patch
@@ -0,0 +1,10 @@
+--- a/src/lisp.h	2015-02-03 20:42:39.233177373 -0100
++++ b/src/lisp.h	2015-02-03 20:44:01.780145394 -0100
+@@ -270,6 +270,7 @@
+    This can be used in #if, e.g., '#if VAL_MAX < UINTPTR_MAX' below.  */
+ #define VAL_MAX (EMACS_INT_MAX >> (GCTYPEBITS - 1))
+ 
++#define USE_LSB_TAG 1
+ /* Unless otherwise specified, use USE_LSB_TAG on systems where:  */
+ #ifndef USE_LSB_TAG
+ /* 1.  We know malloc returns a multiple of 8.  */

diff --git a/app-editors/emacs/files/emacs-24.4-preload-hack.patch b/app-editors/emacs/files/emacs-24.4-preload-hack.patch
new file mode 100644
index 0000000..8bed0bd
--- /dev/null
+++ b/app-editors/emacs/files/emacs-24.4-preload-hack.patch
@@ -0,0 +1,11 @@
+--- a/src/Makefile.in	2014-05-26 16:50:55.000000000 -0100
++++ b/src/Makefile.in	2015-02-03 20:25:11.915270649 -0100
+@@ -292,7 +292,7 @@
+ 
+ GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
+ 
+-RUN_TEMACS = ./temacs
++RUN_TEMACS = LD_PRELOAD=../preload.so ./temacs
+ 
+ ## Invoke ../nt/addsection for MinGW, ":" elsewhere.
+ TEMACS_POST_LINK = @TEMACS_POST_LINK@

diff --git a/app-editors/emacs/files/preload.c b/app-editors/emacs/files/preload.c
new file mode 100644
index 0000000..65cdcef
--- /dev/null
+++ b/app-editors/emacs/files/preload.c
@@ -0,0 +1,88 @@
+// http://www.openwall.com/lists/musl/2015/02/03/1
+#include <pthread.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dlfcn.h>
+#include <unistd.h>
+#include <stdio.h>
+
+static void *(*real_malloc)(size_t);
+static void *initial_brk;
+
+static pthread_once_t once_control[1];
+static void once_func()
+{
+	real_malloc = dlsym(RTLD_NEXT, "malloc");
+	initial_brk = sbrk(0);
+}
+
+static int cmp(const void *a, const void *b)
+{
+	void *aa = *(void **)a, *bb = *(void **)b;
+	return aa < bb ? -1 : aa > bb ? 1 : 0;
+}
+
+void *malloc(size_t n)
+{
+	size_t i, j, k;
+	pthread_once(once_control, once_func);
+	if (n < 100000 || n > (size_t)-1/2) {
+		void *p;
+		do p = real_malloc(n);
+		while (p > sbrk(0) || (p && p < initial_brk));
+		return p;
+	}
+	size_t cnt = n/16384;
+	void **list = real_malloc(sizeof *list * cnt);
+	if (!list) return 0;
+	for (i=0; i<cnt; i++) list[i] = 0;
+	for (i=0; i<cnt; i++) {
+		list[i] = real_malloc(65536 - 2*sizeof(size_t));
+		if (!list[i]) goto fail;
+		if (i<cnt/4) continue;
+		size_t base = 0;
+		qsort(list, i+1, sizeof(void *), cmp);
+		for (j=0; j<i; j++) {
+			char *p = list[base];
+			char *s = list[j];
+			char *z = list[j+1];
+			if (z-s > 65536) {
+				base = j+1;
+				continue;
+			}
+			if (z-p < n+64) {
+				continue;
+			}
+			for (k=0; k<base; k++) free(list[k]);
+			*(size_t *)(p-sizeof(size_t)) = z-p | 1;
+			*(size_t *)(z-2*sizeof(size_t)) = z-p | 1;
+			for (k=j+1; k<i+1; k++) free(list[k]);
+			free(list);
+			return p;
+		}
+	}
+fail:
+	for (i=0; i<cnt; i++) free(list[i]);
+	free(list);
+	return 0;
+}
+
+void *calloc(size_t n, size_t m)
+{
+	if ((size_t)-1/n <= m) n *= m;
+	else n = (size_t)-1;
+	void *p = malloc(n);
+	if (p) memset(p, 0, n);
+	return p;
+}
+
+void *realloc(void *p, size_t n)
+{
+	void *q = malloc(n);
+	if (!q) return 0;
+	size_t l = *(size_t *)((char *)p - sizeof(size_t)) & -8;
+	memcpy(q, p, l<n ? l : n);
+	free(p);
+	return q;
+}

diff --git a/app-editors/emacs/metadata.xml b/app-editors/emacs/metadata.xml
new file mode 100644
index 0000000..88ecff5
--- /dev/null
+++ b/app-editors/emacs/metadata.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>emacs</herd>
+<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='games'>Support shared score files for games</flag>
+  <flag name='gconf'>Use <pkg>gnome-base/gconf</pkg> to read the system
+    font name</flag>
+  <flag name='gfile'>Use gfile (<pkg>dev-libs/glib</pkg>) for file
+    notification</flag>
+  <flag name='gsettings'>Use gsettings (<pkg>dev-libs/glib</pkg>) to read the
+    system font name</flag>
+  <flag name='gtk3'>Link against version 3 of the GIMP Toolkit instead of
+    version 2 (<pkg>x11-libs/gtk+</pkg>)</flag>
+  <flag name='gzip-el'>Compress bundled Emacs Lisp source</flag>
+  <flag name='hesiod'>Enable support for <pkg>net-dns/hesiod</pkg></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='pax_kernel'>Enable building under a PaX enabled kernel</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>


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-02-07 18:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-07 18:57 [gentoo-commits] proj/hardened-dev:musl commit in: app-editors/emacs/files/, app-editors/emacs/ Anthony G. Basile

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox