merging Emacs.app (NeXTstep port)
This commit is contained in:
1
lib-src/.gitignore
vendored
1
lib-src/.gitignore
vendored
@@ -11,6 +11,7 @@ etags
|
||||
fakemail
|
||||
getopt.h
|
||||
hexl
|
||||
mac-fix-env
|
||||
make-docfile
|
||||
movemail
|
||||
obj
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
2008-07-15 Adrian Robert <Adrian.B.Robert@gmail.com>
|
||||
|
||||
* .cvsignore: Add mac-fix-env.
|
||||
* mac-fix-env.m: New file, automatically update
|
||||
~/.MacOSX/environment.plist on OS X systems to expose environment
|
||||
variables inside Emacs started from icon.
|
||||
* Makefile.in: Add -universal to CFLAGS on OS X, add mac-fix-env to
|
||||
programs to build.
|
||||
* make-docfile.c: Add .m to list of file extensions.
|
||||
|
||||
2008-07-12 Dan Nicolaescu <dann@ics.uci.edu>
|
||||
|
||||
* movemail.c (main): Use int instead of WAITTYPE.
|
||||
|
||||
@@ -144,6 +144,23 @@ MOVE_FLAGS=
|
||||
#define NOT_C_CODE
|
||||
#include "../src/config.h"
|
||||
|
||||
#if defined(COCOA)
|
||||
/* Build these programs as universal binaries. */
|
||||
CFLAGS := $(CFLAGS) -universal
|
||||
/* Add mac-fix-env for OS X systems running NS version. */
|
||||
INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} b2m${EXEEXT} ebrowse${EXEEXT} mac-fix-env${EXEEXT}
|
||||
#endif
|
||||
|
||||
/* Some platforms that the GNUstep port runs on put strip options in
|
||||
INSTALL_PROGRAM which cause errors. But, not being sure all other
|
||||
platforms are setting this, we will only use the alternative
|
||||
INSTALL_SCRIPT variable on GNUstep/Cocoa builds. */
|
||||
#ifndef HAVE_NS
|
||||
INSTALL_SCRIPT = @INSTALL_PROGRAM@
|
||||
#else
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
#endif
|
||||
|
||||
/* Some machines don\'t find the standard C libraries in the usual place. */
|
||||
#ifndef ORDINARY_LINK
|
||||
#ifndef LIB_STANDARD_LIBSRC
|
||||
@@ -253,12 +270,22 @@ CPP_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
|
||||
BASE_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
|
||||
-I. -I../src -I${srcdir} -I${srcdir}/../src ${CPPFLAGS} ${CFLAGS}
|
||||
|
||||
.SUFFIXES: .m
|
||||
|
||||
/* This is the default compilation command.
|
||||
But we should never rely on it, because some make version
|
||||
failed to find it for getopt.o.
|
||||
Using an explicit command made it work. */
|
||||
.c.o:
|
||||
${CC} -c ${CPP_CFLAGS} $<
|
||||
#ifdef HAVE_NS
|
||||
.m.o:
|
||||
#ifdef GNUSTEP
|
||||
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -fgnu-runtime -Wno-import -fconstant-string-class=NSConstantString $<
|
||||
#else
|
||||
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
|
||||
#endif
|
||||
#endif
|
||||
|
||||
all: ${DONT_INSTALL} ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
|
||||
|
||||
@@ -455,3 +482,8 @@ update-game-score${EXEEXT}: update-game-score.o $(GETOPTDEPS)
|
||||
update-game-score.o: ${srcdir}/update-game-score.c ../src/config.h $(GETOPT_H)
|
||||
$(CC) -c ${CPP_CFLAGS} ${srcdir}/update-game-score.c \
|
||||
-DHAVE_SHARED_GAME_DIR="\"$(gamedir)\""
|
||||
|
||||
#if defined(COCOA)
|
||||
mac-fix-env: ${srcdir}/mac-fix-env.m
|
||||
$(CC) -o mac-fix-env ${srcdir}/mac-fix-env.m -prebind -framework Foundation
|
||||
#endif
|
||||
|
||||
71
lib-src/mac-fix-env.m
Normal file
71
lib-src/mac-fix-env.m
Normal file
@@ -0,0 +1,71 @@
|
||||
/* mac-fix-env: A small utility to pick up the shell environment on MacOS X
|
||||
and insert it into the file ~/.MacOSX/environment.plist
|
||||
creating if necessary.
|
||||
Copyright (C) 1989, 1993, 2005, 2008 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Emacs.
|
||||
|
||||
GNU Emacs is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Emacs is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Emacs; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
usage:
|
||||
Run from command line (in Terminal) once or whenever path changes:
|
||||
|
||||
/Applications/Emacs.app/Contents/MacOS/bin/mac-fix-env
|
||||
|
||||
(change initial part to where you installed Emacs).
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSMutableDictionary *envPlist;
|
||||
NSString *file = [[NSHomeDirectory()
|
||||
stringByAppendingPathComponent:@".MacOSX"]
|
||||
stringByAppendingPathComponent:@"environment.plist"];
|
||||
NSString *path = [NSString stringWithCString: getenv("PATH")];
|
||||
|
||||
envPlist = [[NSDictionary dictionaryWithContentsOfFile: file] mutableCopy];
|
||||
if (envPlist == nil)
|
||||
{
|
||||
// create
|
||||
NSString *dir = [file stringByDeletingLastPathComponent];
|
||||
envPlist = [NSMutableDictionary dictionaryWithCapacity: 5];
|
||||
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath: dir] == NO)
|
||||
{
|
||||
if ([[NSFileManager defaultManager] createDirectoryAtPath:dir
|
||||
attributes:nil]==NO)
|
||||
{
|
||||
NSLog(@":\nCould not create directory at '%@'; aborting.",dir);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[envPlist setObject: path forKey: @"PATH"];
|
||||
|
||||
if ([envPlist writeToFile: file atomically: YES] == NO)
|
||||
{
|
||||
NSLog(@":\nCould not write file at '%@'; aborting.", file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
NSLog(@":\nWrote file to '%@'.\nPlease inspect it to make sure PATH is correct.", file);
|
||||
return 0;
|
||||
}
|
||||
@@ -533,7 +533,7 @@ write_c_args (out, func, buf, minargs, maxargs)
|
||||
}
|
||||
|
||||
/* Read through a c file. If a .o file is named,
|
||||
the corresponding .c file is read instead.
|
||||
the corresponding .c or .m file is read instead.
|
||||
Looks for DEFUN constructs such as are defined in ../src/lisp.h.
|
||||
Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED. */
|
||||
|
||||
@@ -555,6 +555,15 @@ scan_c_file (filename, mode)
|
||||
|
||||
infile = fopen (filename, mode);
|
||||
|
||||
if (infile == NULL && extension == 'o')
|
||||
{
|
||||
/* try .m */
|
||||
filename[strlen (filename) - 1] = 'm';
|
||||
infile = fopen (filename, mode);
|
||||
if (infile == NULL)
|
||||
filename[strlen (filename) - 1] = 'c'; /* don't confuse people */
|
||||
}
|
||||
|
||||
/* No error if non-ex input file */
|
||||
if (infile == NULL)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user