diff options
author | Eli Zaretskii <eliz@gnu.org> | 2013-05-16 15:48:54 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2013-05-16 15:48:54 +0300 |
commit | df065a0b9a1ad4be56ffd30bba934b940e85c2c3 (patch) | |
tree | 55c7ca0dd3993d45d3bb54877fb31f025b0ca0ea /lib-src | |
parent | dcfda130117b8a79f4253197b48cf09ba35a3b72 (diff) | |
parent | f1e496a5c86d88c2d6f92c5083b1a9ee11f90109 (diff) | |
download | emacs-df065a0b9a1ad4be56ffd30bba934b940e85c2c3.tar.gz |
Support building Emacs on MS-Windows using the Posix configury.
lib/Makefile.am: If building for MS-Windows, include
nt/gnulib.mk instead of lib/gnulib.mk.
configure.ac: Adapt to MSYS build on MS-Windows.
Makefile.in (NTDIR): New variable, for the MSYS build on
MS-Windows.
(SUBDIR): Add $(NTDIR).
(.PHONY): Add epaths-force-w32.
(msys_to_w32): New variable.
(epaths-force-w32, install-nt, uninstall-nt): New targets.
(lib-src src): Add $(NTLIB) to prerequisites.
(lib lib-src lisp leim nt): Add 'nt'.
(config.status): Use $(CFG).
(.PHONY): Add install-$(NTDIR) and uninstall-$(NTDIR).
(install, install-arch-dep): Add install-$(NTDIR).
(uninstall): Depend on uninstall-$(NTDIR).
(mostlyclean, clean, distclean, bootstrap-clean): Add 'nt'.
* GNUmakefile (CFG): New variable, uses mingw-cfg.site as
CONFIG_SITE for the MSYS build on MS-Windows.
(Makefile): Use $(CFG).
.bzrignore: Ignore *.res, *.tmp, and *.map. Remove
src/emacs.res.
etc/NEWS: Advertise the MSYS build on MS-Windows.
leim/Makefile.in (leim-list.el, check-declare): Use reveal-filename.
lib-src/update-game-score.c [WINDOWSNT]: Include "ntlib.h".
lib-src/ntlib.h (sleep): Update prototype.
(geteuid): Add prototype.
lib-src/ntlib.c (sleep): Now returns an unsigned value.
(getgid): New function.
lib-src/Makefile.in (CLIENTW, LIB_WSOCK32, LIBS_ECLIENT, NTLIB)
(CLIENTRES, WINDRES, NTINC, NTDEPS): New variables.
(INSTALLABLES): Add $(CLIENTW).
(LIBS_MOVE): Use $(LIB_WSOCK32).
($(DESTDIR)${archlibdir}): Use $(EXEEXT) on update-game-score.
(test-distrib${EXEEXT}): Use $(EXEEXT) on test-distrib.
(etags${EXEEXT}, ebrowse${EXEEXT}, ctags${EXEEXT})
(profile${EXEEXT}, make-docfile${EXEEXT}, movemail${EXEEXT})
(emacsclient${EXEEXT}, hexl${EXEEXT}, update-game-score${EXEEXT}):
Add $(NTLIB) to prerequisites. Use $(EXEEXT).
(pop.o): Add pop.h to prerequisites.
(emacsclientw${EXEEXT}, ntlib.o): New targets.
(emacsclient.res): New target.
lisp/subr.el (reveal-filename): New function.
lisp/loadup.el: Compute Emacs executable versions on MS-Windows,
where executables have the .exe extension. Add a hard link
emacs-XX.YY.ZZ.exe on MS-Windows.
lisp/Makefile.in (XARGS_LIMIT): New variable.
(custom-deps, finder-data, autoloads)
($(MH_E_DIR)/mh-loaddefs.el, $(TRAMP_DIR)/tramp-loaddefs.el)
($(CAL_DIR)/cal-loaddefs.el, $(CAL_DIR)/diary-loaddefs.el)
($(CAL_DIR)/hol-loaddefs.el): Use reveal-filename.
(compile-main): Limit xargs according to $(XARGS_LIMIT).
nt/msysconfig.sh: New file.
nt/mingw-cfg.site: New file.
nt/makefile.w32-in (LOCAL_FLAGS): Add -DOLD_PATHS=1.
nt/inc/unistd.h: Include pwd.h and sys/types.h.
nt/inc/sys/time.h (_TIMEVAL_DEFINED, timerisset, timercmp)
(timerclear): Define.
(gettimeofday): Adjust signature to be Posix compatible, by using
the 'restrict' keyword.
nt/inc/sys/stat.h (UTIME_NOW, UTIME_OMIT): Define.
(struct _stat, struct _stati64): Define.
nt/inc/sys/socket.h (timeval): Define only for MSVC.
(FD_SET, FD_CLR, FD_ISSET, fd_set): Redefine only if
EMACS_CONFIG_H is defined.
(timeval): Undefine only for MSVC.
nt/inc/ms-w32.h (HAVE___BUILTIN_UNWIND_INIT, restrict)
(HAVE_WINDOW_SYSTEM, HAVE_MENUS, EMACS_CONFIGURATION)
(EMACS_CONFIG_OPTIONS, HAVE_LONG_LONG_INT)
(HAVE_UNSIGNED_LONG_LONG_INT): Define only if not already defined.
(fileno): Move definition after including stdio.h.
(sigset_t): Guard typedef by _W64.
nt/gnulib.mk: New file.
nt/epaths.nt: New file.
nt/addpm.c [!OLD_PATHS]: Include src/epaths.h, instead of having a
copy of the file names there.
<env_vars> [!OLD_PATHS]: Use macros from epaths.h instead of
literal strings.
nt/Makefile.in: New file.
nt/INSTALL.MSYS: New file.
nt/INSTALL: Mention INSTALL.MSYS.
src/w32.c: Include epaths.h.
(init_environment): Use cmdproxy.exe without leading directories.
Support emacs.exe in src; point SHELL to cmdproxy in ../nt in that
case.
(gettimeofday): Adjust signature and return value to Posix
expectations.
src/unexw32.c (open_output_file): Delete the existing emacs.exe
before creating it, to break the hard link to the versioned
executable.
src/Makefile.in (EMACS_MANIFEST, CM_OBJ, TEMACS_POST_LINK)
(ADDSECTION, EMACS_HEAPSIZE, MINGW_TEMACS_POST_LINK)
(FIRSTFILE_OBJ): New variables.
(W32_RES): Rename to EMACSRES. All users changed.
(base_obj): Use $(CM_OBJ).
(ALLOBJS): Use $(FIRSTFILE_OBJ).
(emacs$(EXEEXT)): Depend on $(ADDSECTION).
(temacs$(EXEEXT)): Use $(TEMACS_POST_LINK), and move
$(W32_RES_LINK) before $(LIBES).
(emacs.res): Depend on $(EMACS_MANIFEST). Put emacs.rc in nt.
Diffstat (limited to 'lib-src')
-rw-r--r-- | lib-src/ChangeLog | 24 | ||||
-rw-r--r-- | lib-src/Makefile.in | 83 | ||||
-rw-r--r-- | lib-src/ntlib.c | 12 | ||||
-rw-r--r-- | lib-src/ntlib.h | 4 | ||||
-rw-r--r-- | lib-src/update-game-score.c | 4 |
5 files changed, 98 insertions, 29 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 63108cae9a9..6ff653b7be6 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,27 @@ +2013-05-16 Eli Zaretskii <eliz@gnu.org> + + * update-game-score.c [WINDOWSNT]: Include "ntlib.h". + + * ntlib.h (sleep): Update prototype. + (geteuid): Add prototype. + + * ntlib.c (sleep): Now returns an unsigned value. + (getgid): New function. + + * Makefile.in (CLIENTW, LIB_WSOCK32, LIBS_ECLIENT, NTLIB) + (CLIENTRES, WINDRES, NTINC, NTDEPS): New variables. + (INSTALLABLES): Add $(CLIENTW). + (LIBS_MOVE): Use $(LIB_WSOCK32). + ($(DESTDIR)${archlibdir}): Use $(EXEEXT) on update-game-score. + (test-distrib${EXEEXT}): Use $(EXEEXT) on test-distrib. + (etags${EXEEXT}, ebrowse${EXEEXT}, ctags${EXEEXT}) + (profile${EXEEXT}, make-docfile${EXEEXT}, movemail${EXEEXT}) + (emacsclient${EXEEXT}, hexl${EXEEXT}, update-game-score${EXEEXT}): + Add $(NTLIB) to prerequisites. Use $(EXEEXT). + (pop.o): Add pop.h to prerequisites. + (emacsclientw${EXEEXT}, ntlib.o): New targets. + (emacsclient.res): New target. + 2013-05-15 Stefan Monnier <monnier@iro.umontreal.ca> * makefile.w32-in ($(DOC)): Use DOC rather than DOC-X. diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index 7069af9767a..e0acea867b7 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in @@ -113,8 +113,11 @@ MKDIR_P = @MKDIR_P@ # ========================== Lists of Files =========================== +# emacsclientw.exe for MinGW, empty otherwise +CLIENTW = @CLIENTW@ + # Things that a user might actually run, which should be installed in bindir. -INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} \ +INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} $(CLIENTW) \ ebrowse${EXEEXT} INSTALLABLE_SCRIPTS = grep-changelog @@ -163,10 +166,21 @@ LIBS_MAIL=@LIBS_MAIL@ LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ ## empty or -lrt or -lposix4 if HAVE_FDATASYNC LIB_FDATASYNC = @LIB_FDATASYNC@ +## empty or -lwsock2 for MinGW +LIB_WSOCK32=@LIB_WSOCK32@ ## Extra libraries to use when linking movemail. LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \ - $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV) + $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV) $(LIB_WSOCK32) + +## Extra libraries when linking emacsclient +## (empty or -lcomctl32 for MinGW) +LIBS_ECLIENT = @LIBS_ECLIENT@ + +## Extra object files for linking for MinGW +NTLIB = @NTLIB@ +CLIENTRES = @CLIENTRES@ +WINDRES = @WINDRES@ ## Some systems define this to request special libraries. LIBS_SYSTEM = @LIBS_SYSTEM@ @@ -227,7 +241,7 @@ $(DESTDIR)${archlibdir}: all umask 022; ${MKDIR_P} $(DESTDIR)${gamedir}; \ touch $(DESTDIR)${gamedir}/snake-scores; \ touch $(DESTDIR)${gamedir}/tetris-scores - -if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score && chmod u+s $(DESTDIR)${archlibdir}/update-game-score; then \ + -if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score${EXEEXT} && chmod u+s $(DESTDIR)${archlibdir}/update-game-score${EXEEXT}; then \ chown ${gameuser} $(DESTDIR)${gamedir}; \ chmod u=rwx,g=rwx,o=rx $(DESTDIR)${gamedir}; \ fi @@ -292,7 +306,7 @@ TAGS: etags${EXEEXT} ## distribute Emacs. If they were clobbered, all the .elc files were ## clobbered too. test-distrib${EXEEXT}: ${srcdir}/test-distrib.c - $(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c + $(CC) ${ALL_CFLAGS} -o test-distrib${EXEEXT} ${srcdir}/test-distrib.c ./test-distrib ${srcdir}/testfile ../lib/libgnu.a: $(config_h) @@ -302,47 +316,68 @@ regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h) ${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER \ ${srcdir}/../src/regex.c -etags${EXEEXT}: ${srcdir}/etags.c regex.o $(config_h) +etags${EXEEXT}: ${srcdir}/etags.c regex.o $(NTLIB) $(config_h) $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" \ -DVERSION="\"${version}\"" ${srcdir}/etags.c \ - regex.o $(LOADLIBES) -o etags + regex.o $(LOADLIBES) $(NTLIB) -o etags${EXEEXT} -ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(config_h) +ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(NTLIB) \ + $(config_h) $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \ - ${srcdir}/ebrowse.c $(LOADLIBES) -o ebrowse + ${srcdir}/ebrowse.c $(LOADLIBES) $(NTLIB) -o ebrowse${EXEEXT} ## We depend on etags to assure that parallel makes do not write two ## etags.o files on top of each other. ctags${EXEEXT}: etags${EXEEXT} $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" \ -DVERSION="\"${version}\"" ${srcdir}/etags.c \ - regex.o $(LOADLIBES) -o ctags + regex.o $(LOADLIBES) $(NTLIB) -o ctags${EXEEXT} -profile${EXEEXT}: ${srcdir}/profile.c $(config_h) +profile${EXEEXT}: ${srcdir}/profile.c $(NTLIB) $(config_h) $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c \ - $(LOADLIBES) $(LIB_CLOCK_GETTIME) -o profile + $(LOADLIBES) $(NTLIB) $(LIB_CLOCK_GETTIME) -o profile${EXEEXT} -make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(config_h) - $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) \ - -o make-docfile +make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(NTLIB) $(config_h) + $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) $(NTLIB) \ + -o make-docfile${EXEEXT} -movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(config_h) +movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(NTLIB) $(config_h) $(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c pop.o \ - $(LOADLIBES) $(LIBS_MOVE) -o movemail + $(LOADLIBES) $(NTLIB) $(LIBS_MOVE) -o movemail${EXEEXT} -pop.o: ${srcdir}/pop.c ${srcdir}/../lib/min-max.h $(config_h) +pop.o: ${srcdir}/pop.c ${srcdir}/pop.h ${srcdir}/../lib/min-max.h $(config_h) $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c -emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(config_h) +emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(config_h) $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \ - -DVERSION="\"${version}\"" \ - $(LOADLIBES) $(LIB_FDATASYNC) -o emacsclient + -DVERSION="\"${version}\"" $(NTLIB) $(LOADLIBES) $(LIB_FDATASYNC) \ + $(LIB_WSOCK32) $(LIBS_ECLIENT) -o emacsclient${EXEEXT} + +emacsclientw${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(CLIENTRES) $(config_h) + $(CC) ${ALL_CFLAGS} $(CLIENTRES) -mwindows ${srcdir}/emacsclient.c \ + -DVERSION="\"${version}\"" $(LOADLIBES) $(LIB_FDATASYNC) \ + $(LIB_WSOCK32) $(LIBS_ECLIENT) -o emacsclientw${EXEEXT} -hexl${EXEEXT}: ${srcdir}/hexl.c $(config_h) - $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl +NTINC = ${srcdir}/../nt/inc +NTDEPS = $(NTINC)/ms-w32.h $(NTINC)/sys/stat.h $(NTINC)/inttypes.h \ + $(NTINC)/stdint.h $(NTINC)/pwd.h $(NTINC)/sys/time.h $(NTINC)/stdbool.h \ + $(NTINC)/sys/wait.h $(NTINC)/unistd.h $(NTINC)/sys/file.h $(NTINC)/netdb.h -update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(config_h) +# The dependency on $(NTDEPS) is a trick intended to cause recompile of +# programs on MinGW whenever some private header in nt/inc is modified. +ntlib.o: ${srcdir}/ntlib.c ${srcdir}/ntlib.h $(NTDEPS) + $(CC) -c ${CPP_CFLAGS} ${srcdir}/ntlib.c + +hexl${EXEEXT}: ${srcdir}/hexl.c $(NTLIB) $(config_h) + $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl${EXEEXT} + +update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB) $(config_h) $(CC) ${ALL_CFLAGS} -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \ - ${srcdir}/update-game-score.c $(LOADLIBES) -o update-game-score + ${srcdir}/update-game-score.c $(LOADLIBES) $(NTLIB) \ + -o update-game-score${EXEEXT} + +emacsclient.res: $(NTINC)/../emacsclient.rc + $(WINDRES) -O coff --include-dir=$(NTINC)/.. -o emacsclient.res \ + $(NTINC)/../emacsclient.rc ## Makefile ends here. diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c index 849abc2ede5..41b4e3a0cbc 100644 --- a/lib-src/ntlib.c +++ b/lib-src/ntlib.c @@ -49,10 +49,11 @@ struct timezone /* Emulate sleep...we could have done this with a define, but that would necessitate including windows.h in the files that used it. This is much easier. */ -void -sleep (unsigned long seconds) +unsigned +sleep (unsigned seconds) { Sleep (seconds * 1000); + return 0; } /* Get the current working directory. */ @@ -138,6 +139,12 @@ getuid (void) } unsigned +geteuid (void) +{ + return getuid (); +} + +unsigned getgid (void) { return 0; @@ -415,4 +422,3 @@ lstat (const char * path, struct stat * buf) { return stat (path, buf); } - diff --git a/lib-src/ntlib.h b/lib-src/ntlib.h index 1b2f57f35e5..3e48d2997e0 100644 --- a/lib-src/ntlib.h +++ b/lib-src/ntlib.h @@ -16,7 +16,6 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ - #include <pwd.h> #include <malloc.h> @@ -29,12 +28,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #ifdef sleep #undef sleep #endif -void sleep (unsigned long seconds); +unsigned sleep (unsigned seconds); char *getwd (char *dir); int getppid (void); char * getlogin (void); char * cuserid (char * s); unsigned getuid (void); +unsigned geteuid (void); unsigned getegid (void); unsigned getgid (void); int setuid (unsigned uid); diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c index 29c81a8936c..ec8b4317770 100644 --- a/lib-src/update-game-score.c +++ b/lib-src/update-game-score.c @@ -46,6 +46,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <sys/stat.h> #include <getopt.h> +#ifdef WINDOWSNT +#include "ntlib.h" +#endif + #define MAX_ATTEMPTS 5 #define MAX_SCORES 200 #define MAX_DATA_LEN 1024 |