unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ken Raeburn <raeburn@raeburn.org>
To: Emacs Developers <emacs-devel@gnu.org>
Subject: buildobj.lst and Windows builds - a tiny bit of help needed?
Date: Sun, 23 Aug 2009 03:50:30 -0400	[thread overview]
Message-ID: <4CC1CF5E-088F-459E-BCF7-61DEFA747DE1@raeburn.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 1328 bytes --]

As part of trying to make CANNOT_DUMP builds work better, I want to  
have the list of object files, currently written into buildobj.lst by  
make and read back by temacs during loadup, compiled into the  
executable instead.  (Snarf-documentation needs the list to know which  
bits of documentation to extract from the generated DOC file, since  
some symbols appear in multiple source files.)  I've created a simple  
patch to create a header file on UNIX that doc.c can include to get  
the list instead of opening a file and growing a buffer to read the  
contents into; it just needs to define one macro that expands to a  
string initializer.  I've made an attempt to write the changes for the  
Windows build process, but I don't currently have a machine to test  
them, especially with all the permutations of make versions and shells  
to run under them.

Could someone with the relevant expertise and/or equipment please take  
a minute and let me know the right way to make this change?  I think  
it should be pretty straightforward, as you can see from the changes  
in the attached diff, but it does involve make commands that have to  
write double-quotes and backslashes to files (and thus get the quoting  
right), and an object file list that is supposedly too long to process  
on one command line...

Ken



[-- Attachment #2: buildobj.diff --]
[-- Type: application/octet-stream, Size: 4965 bytes --]

Index: src/Makefile.in
===================================================================
RCS file: /sources/emacs/emacs/src/Makefile.in,v
retrieving revision 1.445
diff -p -u -r1.445 Makefile.in
--- src/Makefile.in	23 Aug 2009 04:43:12 -0000	1.445
+++ src/Makefile.in	23 Aug 2009 07:28:51 -0000
@@ -938,8 +938,10 @@ ${etc}DOC: ${libsrc}make-docfile${EXEEXT
 ${libsrc}make-docfile${EXEEXT}:
 	cd ${libsrc}; ${MAKE} ${MFLAGS} make-docfile${EXEEXT}
 
+buildobj.h: Makefile
+	echo "#define BUILDOBJ \"${obj} ${otherobj} " OBJECTS_MACHINE "\"" > buildobj.h
+
 temacs${EXEEXT}: $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} ${otherobj} OBJECTS_MACHINE prefix-args${EXEEXT}
-	echo "${obj} ${otherobj} " OBJECTS_MACHINE > buildobj.lst
 #ifdef NS_IMPL_GNUSTEP
 	$(CC) -rdynamic YMF_PASS_LDFLAGS ( ${TEMACS_LDFLAGS} \
 	-L@GNUSTEP_SYSTEM_LIBRARIES@ -lgnustep-gui -lgnustep-base \
@@ -1064,7 +1066,8 @@ dispnew.o: dispnew.c systime.h commands.
    disptab.h indent.h $(INTERVALS_H) \
    xterm.h blockinput.h atimer.h character.h msdos.h composite.h keyboard.h \
    syssignal.h $(config_h)
-doc.o: doc.c $(config_h) epaths.h buffer.h keyboard.h keymap.h character.h
+doc.o: doc.c $(config_h) epaths.h buffer.h keyboard.h keymap.h character.h \
+   buildobj.h
 doprnt.o: doprnt.c character.h $(config_h)
 dosfns.o: buffer.h termchar.h termhooks.h frame.h blockinput.h window.h \
    msdos.h dosfns.h dispextern.h charset.h coding.h atimer.h systime.h \
@@ -1284,7 +1287,7 @@ mostlyclean:
 	rm -f temacs${EXEEXT} prefix-args${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a
 	rm -f ../etc/DOC
 	rm -f bootstrap-emacs${EXEEXT} emacs-${version}${EXEEXT}
-	rm -f buildobj.lst
+	rm -f buildobj.h
 clean: mostlyclean
 	rm -f emacs-*.*.*${EXEEXT} emacs${EXEEXT}
 #ifdef HAVE_NS
Index: src/doc.c
===================================================================
RCS file: /sources/emacs/emacs/src/doc.c,v
retrieving revision 1.134
diff -p -u -r1.134 doc.c
--- src/doc.c	8 Jan 2009 03:15:32 -0000	1.134
+++ src/doc.c	23 Aug 2009 07:28:51 -0000
@@ -42,6 +42,7 @@ along with GNU Emacs.  If not, see <http
 #include "keyboard.h"
 #include "character.h"
 #include "keymap.h"
+#include "buildobj.h"
 
 #ifdef HAVE_INDEX
 extern char *index P_ ((const char *, int));
@@ -552,6 +553,7 @@ store_function_docstring (fun, offset)
     }
 }
 
+static const char buildobj[] = BUILDOBJ;
 
 DEFUN ("Snarf-documentation", Fsnarf_documentation, Ssnarf_documentation,
        1, 1, 0,
@@ -598,32 +600,9 @@ the same file name is found in the `doc-
   /* Vbuild_files is nil when temacs is run, and non-nil after that.  */
   if (NILP (Vbuild_files))
   {
-    size_t cp_size = 0;
-    size_t to_read;
-    int nr_read;
-    char *cp = NULL;
-    char *beg, *end;
-
-    fd = emacs_open ("buildobj.lst", O_RDONLY, 0);
-    if (fd < 0)
-      report_file_error ("Opening file buildobj.lst", Qnil);
+    const char *beg, *end;
 
-    filled = 0;
-    for (;;)
-      {
-        cp_size += 1024;
-        to_read = cp_size - 1 - filled;
-        cp = xrealloc (cp, cp_size);
-        nr_read = emacs_read (fd, &cp[filled], to_read);
-        filled += nr_read;
-        if (nr_read < to_read)
-          break;
-      }
-
-    emacs_close (fd);
-    cp[filled] = 0;
-
-    for (beg = cp; *beg; beg = end)
+    for (beg = buildobj; *beg; beg = end)
       {
         int len;
 
@@ -639,8 +618,6 @@ the same file name is found in the `doc-
         if (len > 0)
           Vbuild_files = Fcons (make_string (beg, len), Vbuild_files);
       }
-
-    xfree (cp);
   }
 
   fd = emacs_open (name, O_RDONLY, 0);
Index: src/makefile.w32-in
===================================================================
RCS file: /sources/emacs/emacs/src/makefile.w32-in,v
retrieving revision 1.77
diff -p -u -r1.77 makefile.w32-in
--- src/makefile.w32-in	11 Mar 2009 01:02:07 -0000	1.77
+++ src/makefile.w32-in	23 Aug 2009 07:28:51 -0000
@@ -178,10 +178,16 @@ $(TEMACS):      $(TLIB0) $(TLIB1) $(TLIB
 		  ../nt/$(BLD)/addsection.exe
 	$(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS)
 	"../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 21
-	echo $(OBJ0) > $(BLD)/buildobj.lst
-	echo $(OBJ1) >> $(BLD)/buildobj.lst
-	echo $(WIN32OBJ) >> $(BLD)/buildobj.lst
-	echo $(FONTOBJ) >> $(BLD)/buildobj.lst
+
+# This omits firstfile.${O}, but there's no documentation in there
+# anyways.
+$(SRC)/buildobj.h: Makefile
+	echo "#define BUILDOBJ \"\\"  > $(SRC)/buildobj.h
+	echo $(OBJ0)            "\\" >> $(SRC)/buildobj.h
+	echo $(OBJ1)            "\\" >> $(SRC)/buildobj.h
+	echo $(WIN32OBJ)        "\\" >> $(SRC)/buildobj.h
+	echo $(FONTOBJ)         "\\" >> $(SRC)/buildobj.h
+	echo "\""                    >> $(SRC)/buildobj.h
 
 bootstrap: bootstrap-emacs
 
@@ -580,6 +586,7 @@ $(BLD)/dispnew.$(O) : \
 $(BLD)/doc.$(O) : \
 	$(SRC)/doc.c \
 	$(CONFIG_H) \
+	$(SRC)/buildobj.h \
 	$(EMACS_ROOT)/nt/inc/unistd.h \
 	$(EMACS_ROOT)/nt/inc/sys/file.h \
 	$(EMACS_ROOT)/nt/inc/sys/time.h \

[-- Attachment #3: Type: text/plain, Size: 1 bytes --]



             reply	other threads:[~2009-08-23  7:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-23  7:50 Ken Raeburn [this message]
2009-08-23  8:30 ` buildobj.lst and Windows builds - a tiny bit of help needed? Jason Rumney
2009-08-23 10:48   ` Ken Raeburn
2009-08-23 16:42     ` Jason Rumney
2009-08-23 18:02       ` Eli Zaretskii
2009-08-23 18:43         ` Ken Raeburn
2009-08-23 20:17           ` Eli Zaretskii
2009-08-23 21:07             ` Ken Raeburn
2009-08-24  3:19               ` Eli Zaretskii
2009-08-24  4:16                 ` Ken Raeburn
2009-08-24 18:22                   ` Eli Zaretskii
2009-08-26  7:08                     ` Ken Raeburn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CC1CF5E-088F-459E-BCF7-61DEFA747DE1@raeburn.org \
    --to=raeburn@raeburn.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).