aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorAdrian Robert2008-07-15 18:15:18 +0000
committerAdrian Robert2008-07-15 18:15:18 +0000
commitedfda78355c5528eee489fa8a7f9c73bf8e734f2 (patch)
tree78d2414d9791e1efc17ec9b35b438ae35602340a /lib-src
parent1391cd548782097e34d7856ec4f20ca90bdf2c26 (diff)
downloademacs-edfda78355c5528eee489fa8a7f9c73bf8e734f2.tar.gz
emacs-edfda78355c5528eee489fa8a7f9c73bf8e734f2.zip
merging Emacs.app (NeXTstep port)
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/.gitignore1
-rw-r--r--lib-src/ChangeLog10
-rw-r--r--lib-src/Makefile.in32
-rw-r--r--lib-src/mac-fix-env.m71
-rw-r--r--lib-src/make-docfile.c11
5 files changed, 124 insertions, 1 deletions
diff --git a/lib-src/.gitignore b/lib-src/.gitignore
index 67ce7f736b5..f1128dd36fc 100644
--- a/lib-src/.gitignore
+++ b/lib-src/.gitignore
@@ -11,6 +11,7 @@ etags
11fakemail 11fakemail
12getopt.h 12getopt.h
13hexl 13hexl
14mac-fix-env
14make-docfile 15make-docfile
15movemail 16movemail
16obj 17obj
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 6347c3a8e5a..20a16c1640c 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,13 @@
12008-07-15 Adrian Robert <Adrian.B.Robert@gmail.com>
2
3 * .cvsignore: Add mac-fix-env.
4 * mac-fix-env.m: New file, automatically update
5 ~/.MacOSX/environment.plist on OS X systems to expose environment
6 variables inside Emacs started from icon.
7 * Makefile.in: Add -universal to CFLAGS on OS X, add mac-fix-env to
8 programs to build.
9 * make-docfile.c: Add .m to list of file extensions.
10
12008-07-12 Dan Nicolaescu <dann@ics.uci.edu> 112008-07-12 Dan Nicolaescu <dann@ics.uci.edu>
2 12
3 * movemail.c (main): Use int instead of WAITTYPE. 13 * movemail.c (main): Use int instead of WAITTYPE.
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in
index 08e83126b73..9b537ecfbea 100644
--- a/lib-src/Makefile.in
+++ b/lib-src/Makefile.in
@@ -144,6 +144,23 @@ MOVE_FLAGS=
144#define NOT_C_CODE 144#define NOT_C_CODE
145#include "../src/config.h" 145#include "../src/config.h"
146 146
147#if defined(COCOA)
148/* Build these programs as universal binaries. */
149CFLAGS := $(CFLAGS) -universal
150/* Add mac-fix-env for OS X systems running NS version. */
151INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} b2m${EXEEXT} ebrowse${EXEEXT} mac-fix-env${EXEEXT}
152#endif
153
154/* Some platforms that the GNUstep port runs on put strip options in
155 INSTALL_PROGRAM which cause errors. But, not being sure all other
156 platforms are setting this, we will only use the alternative
157 INSTALL_SCRIPT variable on GNUstep/Cocoa builds. */
158#ifndef HAVE_NS
159INSTALL_SCRIPT = @INSTALL_PROGRAM@
160#else
161INSTALL_SCRIPT = @INSTALL_SCRIPT@
162#endif
163
147/* Some machines don\'t find the standard C libraries in the usual place. */ 164/* Some machines don\'t find the standard C libraries in the usual place. */
148#ifndef ORDINARY_LINK 165#ifndef ORDINARY_LINK
149#ifndef LIB_STANDARD_LIBSRC 166#ifndef LIB_STANDARD_LIBSRC
@@ -253,12 +270,22 @@ CPP_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
253BASE_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \ 270BASE_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
254 -I. -I../src -I${srcdir} -I${srcdir}/../src ${CPPFLAGS} ${CFLAGS} 271 -I. -I../src -I${srcdir} -I${srcdir}/../src ${CPPFLAGS} ${CFLAGS}
255 272
273.SUFFIXES: .m
274
256/* This is the default compilation command. 275/* This is the default compilation command.
257 But we should never rely on it, because some make version 276 But we should never rely on it, because some make version
258 failed to find it for getopt.o. 277 failed to find it for getopt.o.
259 Using an explicit command made it work. */ 278 Using an explicit command made it work. */
260.c.o: 279.c.o:
261 ${CC} -c ${CPP_CFLAGS} $< 280 ${CC} -c ${CPP_CFLAGS} $<
281#ifdef HAVE_NS
282.m.o:
283#ifdef GNUSTEP
284 $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -fgnu-runtime -Wno-import -fconstant-string-class=NSConstantString $<
285#else
286 $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
287#endif
288#endif
262 289
263all: ${DONT_INSTALL} ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS} 290all: ${DONT_INSTALL} ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
264 291
@@ -455,3 +482,8 @@ update-game-score${EXEEXT}: update-game-score.o $(GETOPTDEPS)
455update-game-score.o: ${srcdir}/update-game-score.c ../src/config.h $(GETOPT_H) 482update-game-score.o: ${srcdir}/update-game-score.c ../src/config.h $(GETOPT_H)
456 $(CC) -c ${CPP_CFLAGS} ${srcdir}/update-game-score.c \ 483 $(CC) -c ${CPP_CFLAGS} ${srcdir}/update-game-score.c \
457 -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" 484 -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\""
485
486#if defined(COCOA)
487mac-fix-env: ${srcdir}/mac-fix-env.m
488 $(CC) -o mac-fix-env ${srcdir}/mac-fix-env.m -prebind -framework Foundation
489#endif
diff --git a/lib-src/mac-fix-env.m b/lib-src/mac-fix-env.m
new file mode 100644
index 00000000000..01798e56f49
--- /dev/null
+++ b/lib-src/mac-fix-env.m
@@ -0,0 +1,71 @@
1/* mac-fix-env: A small utility to pick up the shell environment on MacOS X
2 and insert it into the file ~/.MacOSX/environment.plist
3 creating if necessary.
4 Copyright (C) 1989, 1993, 2005, 2008 Free Software Foundation, Inc.
5
6This file is part of GNU Emacs.
7
8GNU Emacs is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 3, or (at your option)
11any later version.
12
13GNU Emacs is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with GNU Emacs; see the file COPYING. If not, write to
20the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21Boston, MA 02110-1301, USA.
22
23 usage:
24 Run from command line (in Terminal) once or whenever path changes:
25
26 /Applications/Emacs.app/Contents/MacOS/bin/mac-fix-env
27
28 (change initial part to where you installed Emacs).
29*/
30
31#import <Foundation/Foundation.h>
32#include <stdlib.h>
33
34int main(int argc, char *argv[])
35{
36 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
37 NSMutableDictionary *envPlist;
38 NSString *file = [[NSHomeDirectory()
39 stringByAppendingPathComponent:@".MacOSX"]
40 stringByAppendingPathComponent:@"environment.plist"];
41 NSString *path = [NSString stringWithCString: getenv("PATH")];
42
43 envPlist = [[NSDictionary dictionaryWithContentsOfFile: file] mutableCopy];
44 if (envPlist == nil)
45 {
46 // create
47 NSString *dir = [file stringByDeletingLastPathComponent];
48 envPlist = [NSMutableDictionary dictionaryWithCapacity: 5];
49
50 if ([[NSFileManager defaultManager] fileExistsAtPath: dir] == NO)
51 {
52 if ([[NSFileManager defaultManager] createDirectoryAtPath:dir
53 attributes:nil]==NO)
54 {
55 NSLog(@":\nCould not create directory at '%@'; aborting.",dir);
56 return 1;
57 }
58 }
59 }
60
61 [envPlist setObject: path forKey: @"PATH"];
62
63 if ([envPlist writeToFile: file atomically: YES] == NO)
64 {
65 NSLog(@":\nCould not write file at '%@'; aborting.", file);
66 return 1;
67 }
68
69 NSLog(@":\nWrote file to '%@'.\nPlease inspect it to make sure PATH is correct.", file);
70 return 0;
71}
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index 81071047446..945a92076d2 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -533,7 +533,7 @@ write_c_args (out, func, buf, minargs, maxargs)
533} 533}
534 534
535/* Read through a c file. If a .o file is named, 535/* Read through a c file. If a .o file is named,
536 the corresponding .c file is read instead. 536 the corresponding .c or .m file is read instead.
537 Looks for DEFUN constructs such as are defined in ../src/lisp.h. 537 Looks for DEFUN constructs such as are defined in ../src/lisp.h.
538 Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED. */ 538 Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED. */
539 539
@@ -555,6 +555,15 @@ scan_c_file (filename, mode)
555 555
556 infile = fopen (filename, mode); 556 infile = fopen (filename, mode);
557 557
558 if (infile == NULL && extension == 'o')
559 {
560 /* try .m */
561 filename[strlen (filename) - 1] = 'm';
562 infile = fopen (filename, mode);
563 if (infile == NULL)
564 filename[strlen (filename) - 1] = 'c'; /* don't confuse people */
565 }
566
558 /* No error if non-ex input file */ 567 /* No error if non-ex input file */
559 if (infile == NULL) 568 if (infile == NULL)
560 { 569 {