Emacs by default uses its own malloc, but the emacs developers have suggested that I try to build it so that it uses Cygwin's malloc. (See http://lists.gnu.org/archive/html/emacs-devel/2009-12/threads.html#00369 for the context if you're curious.) When I try to do this, the build fails as follows:

gcc -o temacs ecrt0.o dispnew.o frame.o scroll.o xdisp.o menu.o window.o charset.o coding.o category.o ccl.o character.o chartab.o cm.o term.o terminal.o xfaces.o emacs.o keyboard.o macros.o keymap.o sysdep.o buffer.o filelock.o insdel.o marker.o minibuf.o fileio.o dired.o filemode.o cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o alloc.o data.o doc.o editfns.o callint.o eval.o floatfns.o fns.o font.o print.o lread.o syntax.o unexcw.o bytecode.o process.o callproc.o region-cache.o sound.o atimer.o doprnt.o strftime.o intervals.o textprop.o composite.o md5.o sheap.o terminfo.o lastfile.o vm-limit.o getloadavg.o -lcurses -lg `gcc -print-libgcc-file-name` -lm -lc `gcc -print-libgcc-file-name` vm-limit.o:vm-limit.c:(.text+0x17): undefined reference to `___after_morecore_hook'
vm-limit.o:vm-limit.c:(.text+0x6c): undefined reference to `___morecore'

Is this one of those situations where the libraries are listed in the wrong order in the gcc command? Or is there something else going on? I'm attaching my .cygport and .src.patch files in case it's more subtle and someone else wants to give it a try.

Ken

DESCRIPTION="Emacs is the extensible, customizable, self-documenting real-time 
display editor."
HOMEPAGE="http://www.gnu.org/software/emacs/";
# SRC_URI="http://ftp.gnu.org/pub/gnu/emacs/emacs-${PV}.tar.gz";
SRC_URI="ftp://alpha.gnu.org/gnu/emacs/pretest/emacs-${PV}.tar.gz";

PKG_NAMES="${PN} ${PN}-el ${PN}-X11"
PKG_HINTS="setup ${PN}-el ${PN}-X11"
PKG_CONTENTS[0]="--exclude=usr/share/${PN}/${PV}/lisp*el.gz \
                 --exclude=usr/share/${PN}/${PV}/leim*el.gz \
                 --exclude=usr/share/${PN}/${PV}/etc/make_shortcut.sh \
                 --exclude=usr/bin/emacs-X11.exe \
                 --exclude=etc/postinstall/emacs-X11.sh \
                 --exclude=etc/preremove/emacs-X11.sh \
                 *"
PKG_CONTENTS[1]="--exclude=usr/share/${PN}/${PV}/lisp*el \
                 --exclude=usr/share/${PN}/${PV}/leim*el \
                 --exclude=usr/share/${PN}/${PV}/lisp*elc \
                 --exclude=usr/share/${PN}/${PV}/leim*elc \
                 --exclude=usr/share/${PN}/${PV}/lisp/COPYING \
                 --exclude=usr/share/${PN}/${PV}/lisp/README \
                 --exclude=usr/share/${PN}/${PV}/lisp/calc/README \
                 --exclude=usr/share/${PN}/${PV}/lisp/calc/README.prev \
                 --exclude=usr/share/${PN}/${PV}/lisp/international/README \
                 --exclude=usr/share/${PN}/${PV}/lisp/term/README \
                 --exclude=usr/share/${PN}/${PV}/lisp/nxml/TODO \
                 --exclude=usr/share/${PN}/${PV}/lisp/forms-d2.dat \
                 usr/share/${PN}/${PV}/lisp \
                 usr/share/${PN}/${PV}/leim"
PKG_CONTENTS[2]="usr/bin/emacs-X11.exe \
                 etc/postinstall/emacs-X11.sh \
                 etc/preremove/emacs-X11.sh \
                 usr/share/${PN}/${PV}/etc/make_shortcut.sh"

DIFF_EXCLUDES="loaddefs.el config.in *.elc"

src_compile() {
        cd ${S}
        cygautoreconf
        cd ${B}
        # build non-X11 binary first
        cygconf --with-x=no
        cygmake
        # save non-X11 binary
        cp -v src/emacs.exe emacs-nox.exe
        # cleanup build dir
        make distclean
        # build X11 binary
        cygconf
        cygmake
        # restore non-X11 binary
        mv -v emacs-nox.exe src/emacs-nox.exe
        cp -v src/emacs.exe src/emacs-X11.exe
}

src_install() {
        cd ${B}
        cyginstall
        # additionally install non-X11 binary
        dobin src/emacs-nox.exe
        dobin src/emacs-X11.exe
        # install windows icon
        cp -v ${S}/nt/icons/emacs.ico ${D}/usr/share/emacs/${PV}/etc/
        # install postinstall/preremove scripts for sub packages
        dodir /etc/postinstall
        cp -v ${C}/emacs-X11.postinstall.sh ${D}/etc/postinstall/emacs-X11.sh
        dodir /etc/preremove
        cp -v ${C}/emacs-X11.preremove.sh ${D}/etc/preremove/emacs-X11.sh
        # install script for making desktop shortcut
        install ${C}/make_shortcut.sh ${D}/usr/share/emacs/${PV}/etc/
        cp -v ${C}/emacs.xml ${D}/usr/share/emacs/${PV}/etc/
        # remove some files that do not need to be packaged
        cd ${D}
        rm -fv  usr/bin/emacs-${PV}.exe \
                usr/bin/emacs.exe \
                usr/bin/b2m.exe \
                usr/bin/rcs-checkin \
                usr/bin/ctags.exe \
                usr/bin/etags.exe \
                usr/share/man/man1/ctags* \
                usr/share/man/man1/etags*
}

### Local Variables:
### mode: sh
### End:
--- origsrc/emacs-23.1.90/src/s/cygwin.h        2009-12-08 20:01:43.000000000 
-0500
+++ src/emacs-23.1.90/src/s/cygwin.h    2009-12-09 09:55:20.343750000 -0500
@@ -130,7 +130,9 @@ along with GNU Emacs.  If not, see <http
    memalign and on Cygwin, that becomes the Cygwin-supplied memalign.
    As malloc is not the Cygwin malloc, the Cygwin memalign always
    returns ENOSYS.  A workaround is to set G_SLICE=always-malloc. */
-#define G_SLICE_ALWAYS_MALLOC
+/* #define G_SLICE_ALWAYS_MALLOC */
+
+#define SYSTEM_MALLOC
 
 /* the end */
 

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to