diff options
author | 2015-02-05 18:45:54 +0100 | |
---|---|---|
committer | 2015-02-07 13:58:50 -0500 | |
commit | ce73c25b148e24f7fe94ca6c888820d35c5b0de1 (patch) | |
tree | ed10594c19752b5b7834726c93104445fb24a6b8 | |
parent | app-portage/portage-utils: remove ChangeLog (diff) | |
download | hardened-dev-ce73c25b148e24f7fe94ca6c888820d35c5b0de1.tar.gz hardened-dev-ce73c25b148e24f7fe94ca6c888820d35c5b0de1.tar.bz2 hardened-dev-ce73c25b148e24f7fe94ca6c888820d35c5b0de1.zip |
app-editors/emacs: LD_PRELOAD hack from Rich Felker
-rw-r--r-- | app-editors/emacs/Manifest | 10 | ||||
-rw-r--r-- | app-editors/emacs/emacs-24.4-r99.ebuild | 348 | ||||
-rw-r--r-- | app-editors/emacs/files/emacs-24.3-alloc-invalid-frees.patch | 58 | ||||
-rw-r--r-- | app-editors/emacs/files/emacs-24.3-stderr.patch | 11 | ||||
-rw-r--r-- | app-editors/emacs/files/emacs-24.4-configure.patch | 10 | ||||
-rw-r--r-- | app-editors/emacs/files/emacs-24.4-lisp.patch | 10 | ||||
-rw-r--r-- | app-editors/emacs/files/emacs-24.4-preload-hack.patch | 11 | ||||
-rw-r--r-- | app-editors/emacs/files/preload.c | 88 | ||||
-rw-r--r-- | app-editors/emacs/metadata.xml | 46 |
9 files changed, 592 insertions, 0 deletions
diff --git a/app-editors/emacs/Manifest b/app-editors/emacs/Manifest new file mode 100644 index 00000000..8fb0f513 --- /dev/null +++ b/app-editors/emacs/Manifest @@ -0,0 +1,10 @@ +AUX emacs-24.3-alloc-invalid-frees.patch 1312 SHA256 f9d44c64663d546bfd1010230f8f7cdfdbce1d7320bf166d86045ff00ec6d498 SHA512 197c2146a2c6a820b8d01fa48e306c8ee083c2407d83589e0b18be8453e03438be1c64a010c06b9d68f2393ae4cccf86780ce8b17cd42335847f91f671ffaf2d WHIRLPOOL 2eb68ff289594b56117a26001b556c808336805771d62344183f9387aa459cb549e90476ae3f0216f0d42cdc1610b5de729d9cb8d19fb2cce679b39c196c7603 +AUX emacs-24.3-stderr.patch 277 SHA256 1fc337fac4e28cf20eed65f88cfcf94b46339408cceadc8a0d17bce969ae6d3a SHA512 370cb1d053530824050eec6b9f02f0eed0e91270940551712f7308ffd4657bba39513d9ab94d47306bbac1e507283a97326e6f366e47f64d093e794a25684b56 WHIRLPOOL 8ad5ab8c6cdaea01fcd784ef3993fbdd9c8e00d2f6aa12c70fc63a8da0e7e1513be45f74aa7b415c1b488cc73c9a1d2fc1f5c0283bfc0ad0a3417bd183bbb92d +AUX emacs-24.4-configure.patch 334 SHA256 696710ea84e88a364bd89c9c66393b01b2b8782d2bd0fc08166e64b67b24b0fe SHA512 d75df3a772713e08b45759b58c92944a1719ce291069f111d296b15c7de86f7a9a89d023fa3ccd191390d8a79a671d0a60116f039cf6f57ebeeb7baa14f7af29 WHIRLPOOL 6420f6a5f8009096aa71f2e64d920dec6a1436bbb83c26c2a0d4180555b6e251ebfa92be801ddcf70bd840cb9afd56f99a84ad50be7361289baefe83e35ca52b +AUX emacs-24.4-lisp.patch 421 SHA256 da45d30d4e305ba5220749d3ac884aaeac395bc896839a5e7a24fb112912cbff SHA512 7dda7632f7af4207c94bf2b4384d07bb13ef4562ade02393c668b35ff48d7b64d95a9c05d8700c2ba272abf69e8b9c38a690b10afa86b8857a2ba34cb344f3a3 WHIRLPOOL 28e3346a1b47f8421d56ec37005a806828f1f6995cd4dc213ac8a6011457a7d1d0524f8418a2801e176c5ea09cb5910cd6432a55c592d679f7752c3df23ca339 +AUX emacs-24.4-preload-hack.patch 343 SHA256 289febdc960bee609514fe5291fb3d60cc9b505345853370aa94b9bd9ccb5fd2 SHA512 ee765cc9f3a84b48c00a0c8a36934af6da737fa6b9f9d993e0e5e1c8b9f05cf7b1f96c260daba10e4b4df149abcf8ea125cf8d6ebbe5e2c0d508007e381ecd6b WHIRLPOOL f5c1c6313392325949edc955d9f1b3dc74395ff18cd214f5bef6f8f77ce1975233c870101a03d5218da007a61f3107474ef461d129313b00b07da762970b749a +AUX preload.c 1868 SHA256 3498abf641e809c06bf6a265d54880e93ee31f7abf81210856b6dbef7d267129 SHA512 6268255b7afa8455ad7ce63ef6f01a7d114b53fbb3dc557b187de0ee6514b33b3419d70b8d7984dc289f5eed075a30b508133147821f77c4345df5cbd62e616e WHIRLPOOL 0c72d97de94cf5e1cf6a8ee4f8f42800d63f35465ea22f8c409857620ecc37e304ff6c2c4670659a063e5f275488fcdd1b45226d9d0130c4506480df7708bff6 +DIST emacs-24.4-patches-3.tar.xz 3780 SHA256 2dd1ba1e9cca9121731d14da30ecf3eb720c07e9644a7b9d75e3f02ebc2089d7 SHA512 dde60b26a7dffca1f80937af406ec8a7b4dd8c2563f57c290629acc4767ef38075fcc42ca62c5f172c972fc3cb6c2c0539d3db641386edc68a842bc6cf81237c WHIRLPOOL 3da7034ac9ce495f57ad5bd82f6f8a4d8a4baddd4126b6753423f5cf58aa01873838e22b2908b8c2e4cd48590dd7fb7ea3a520e1bf43be7d0eaf02583bdc9f6f +DIST emacs-24.4.tar.xz 39733124 SHA256 47e391170db4ca0a3c724530c7050655f6d573a711956b4cd84693c194a9d4fd SHA512 f51f88a4736a3f153ef01f3ad710571e967cd3d0c0112b066169a4040725d370ec29b14a4ca8fa3e3f4c657c726ba8e64c3ac4e390b8e911ea47a3afb5ac755c WHIRLPOOL eae38c2382731fecf0ccf8f717f8c96cc130d01a893ff560caecde903294eb843660492761ea8cce9920b79bfc55e821921924e27c040f25355110f56cd2255b +EBUILD emacs-24.4-r99.ebuild 10874 SHA256 d916009ab08d1a0524cde4dcc1952040153b9cdc103c180851474a7aa2c2d41b SHA512 3ce45d8df2eccbbdd9965dff8f1859fd6a7eb8eee4ee12d9688dbb78632bb428f34a8faaa52f7169feff3e654ae4b0365b0213f1c6a01e783661670915586d59 WHIRLPOOL cfaf1a03f7c02f184ae091a5d19fe1ffb0e207901c6fd18519bbf78a6f58399f618bd0e2961832025e63f7ba94823f1cdbfb138a74e22e63831a8b1d3177962b +MISC metadata.xml 2489 SHA256 21b3602d37aa25bca31b05ea810b37ee2192f4e53b8f8daeb814d9dca59d03d7 SHA512 4f3d663cd61253ae3390c55c5974dd3cc22dbf1306a823c3cb71794d09eaf28d7727c7e24f66f02dbd8d3845894f3a8cafa5ddaf330c1bbb7f99d8130ece077c WHIRLPOOL bcefdded503fa9cebea943952d3f56847002cb5ddc10f5adbd774301b648d1b12a09da7e493694f9cbbb19e8b53b66132cbd2e0141ded41b226415cfdbbcf8f6 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 00000000..385d9306 --- /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 00000000..1638e5fc --- /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 00000000..a3beb9fc --- /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 00000000..8c630091 --- /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 00000000..bc8a3f7f --- /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 00000000..8bed0bd1 --- /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 00000000..65cdceff --- /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 00000000..88ecff51 --- /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> |