aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorEli Zaretskii2013-05-16 15:48:54 +0300
committerEli Zaretskii2013-05-16 15:48:54 +0300
commitdf065a0b9a1ad4be56ffd30bba934b940e85c2c3 (patch)
tree55c7ca0dd3993d45d3bb54877fb31f025b0ca0ea /lisp
parentdcfda130117b8a79f4253197b48cf09ba35a3b72 (diff)
parentf1e496a5c86d88c2d6f92c5083b1a9ee11f90109 (diff)
downloademacs-df065a0b9a1ad4be56ffd30bba934b940e85c2c3.tar.gz
emacs-df065a0b9a1ad4be56ffd30bba934b940e85c2c3.zip
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 'lisp')
-rw-r--r--lisp/ChangeLog15
-rw-r--r--lisp/Makefile.in22
-rw-r--r--lisp/loadup.el20
-rw-r--r--lisp/subr.el16
4 files changed, 59 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e6f56664a52..a33796ce24f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,18 @@
12013-05-16 Eli Zaretskii <eliz@gnu.org>
2
3 * subr.el (reveal-filename): New function.
4
5 * loadup.el: Compute Emacs executable versions on MS-Windows,
6 where executables have the .exe extension. Add a hard link
7 emacs-XX.YY.ZZ.exe on MS-Windows.
8
9 * Makefile.in (XARGS_LIMIT): New variable.
10 (custom-deps, finder-data, autoloads)
11 ($(MH_E_DIR)/mh-loaddefs.el, $(TRAMP_DIR)/tramp-loaddefs.el)
12 ($(CAL_DIR)/cal-loaddefs.el, $(CAL_DIR)/diary-loaddefs.el)
13 ($(CAL_DIR)/hol-loaddefs.el): Use reveal-filename.
14 (compile-main): Limit xargs according to $(XARGS_LIMIT).
15
12013-05-16 Leo Liu <sdl.web@gmail.com> 162013-05-16 Leo Liu <sdl.web@gmail.com>
2 17
3 * progmodes/octave.el (octave-indent-defun): Mark obsolete. 18 * progmodes/octave.el (octave-indent-defun): Mark obsolete.
diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index c8707df15df..138ad5abfa6 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -24,6 +24,10 @@ abs_top_builddir = @abs_top_builddir@
24lisp = $(srcdir) 24lisp = $(srcdir)
25VPATH = $(srcdir) 25VPATH = $(srcdir)
26 26
27# Empty for all systems except MinGW, where xargs needs an explicit
28# limitation.
29XARGS_LIMIT = @XARGS_LIMIT@
30
27# You can specify a different executable on the make command line, 31# You can specify a different executable on the make command line,
28# e.g. "make EMACS=../src/emacs ...". 32# e.g. "make EMACS=../src/emacs ...".
29 33
@@ -160,21 +164,21 @@ $(lisp)/cus-load.el:
160custom-deps: doit 164custom-deps: doit
161 cd $(lisp); $(setwins_almost); \ 165 cd $(lisp); $(setwins_almost); \
162 echo Directories: $$wins; \ 166 echo Directories: $$wins; \
163 $(emacs) -l cus-dep --eval '(setq generated-custom-dependencies-file "$(lisp)/cus-load.el")' -f custom-make-dependencies $$wins 167 $(emacs) -l cus-dep --eval '(setq generated-custom-dependencies-file (reveal-filename "$(lisp)/cus-load.el"))' -f custom-make-dependencies $$wins
164 168
165$(lisp)/finder-inf.el: 169$(lisp)/finder-inf.el:
166 $(MAKE) $(MFLAGS) finder-data 170 $(MAKE) $(MFLAGS) finder-data
167finder-data: doit 171finder-data: doit
168 cd $(lisp); $(setwins_almost); \ 172 cd $(lisp); $(setwins_almost); \
169 echo Directories: $$wins; \ 173 echo Directories: $$wins; \
170 $(emacs) -l finder --eval '(setq generated-finder-keywords-file "$(lisp)/finder-inf.el")' -f finder-compile-keywords-make-dist $$wins 174 $(emacs) -l finder --eval '(setq generated-finder-keywords-file (reveal-filename "$(lisp)/finder-inf.el"))' -f finder-compile-keywords-make-dist $$wins
171 175
172# The chmod +w is to handle env var CVSREAD=1. 176# The chmod +w is to handle env var CVSREAD=1.
173autoloads: $(LOADDEFS) doit 177autoloads: $(LOADDEFS) doit
174 cd $(lisp) && chmod +w $(AUTOGEN_VCS) 178 cd $(lisp) && chmod +w $(AUTOGEN_VCS)
175 cd $(lisp); $(setwins_almost); \ 179 cd $(lisp); $(setwins_almost); \
176 echo Directories: $$wins; \ 180 echo Directories: $$wins; \
177 $(emacs) -l autoload --eval '(setq generated-autoload-file "$(lisp)/loaddefs.el")' -f batch-update-autoloads $$wins 181 $(emacs) -l autoload --eval '(setq generated-autoload-file (reveal-filename "$(lisp)/loaddefs.el"))' -f batch-update-autoloads $$wins
178 182
179# This is required by the bootstrap-emacs target in ../src/Makefile, so 183# This is required by the bootstrap-emacs target in ../src/Makefile, so
180# we know that if we have an emacs executable, we also have a subdirs.el. 184# we know that if we have an emacs executable, we also have a subdirs.el.
@@ -274,7 +278,7 @@ compile-main: compile-clean
274 test -f $$el || continue; \ 278 test -f $$el || continue; \
275 test ! -f $${el}c && GREP_OPTIONS= grep '^;.*no-byte-compile: t' $$el > /dev/null && continue; \ 279 test ! -f $${el}c && GREP_OPTIONS= grep '^;.*no-byte-compile: t' $$el > /dev/null && continue; \
276 echo "$${el}c"; \ 280 echo "$${el}c"; \
277 done | xargs echo) | \ 281 done | xargs $(XARGS_LIMIT) echo) | \
278 while read chunk; do \ 282 while read chunk; do \
279 $(MAKE) $(MFLAGS) compile-targets EMACS="$(EMACS)" TARGETS="$$chunk"; \ 283 $(MAKE) $(MFLAGS) compile-targets EMACS="$(EMACS)" TARGETS="$$chunk"; \
280 done 284 done
@@ -369,7 +373,7 @@ mh-autoloads: $(MH_E_DIR)/mh-loaddefs.el
369$(MH_E_DIR)/mh-loaddefs.el: $(MH_E_SRC) 373$(MH_E_DIR)/mh-loaddefs.el: $(MH_E_SRC)
370 $(emacs) -l autoload \ 374 $(emacs) -l autoload \
371 --eval "(setq generate-autoload-cookie \";;;###mh-autoload\")" \ 375 --eval "(setq generate-autoload-cookie \";;;###mh-autoload\")" \
372 --eval "(setq generated-autoload-file \"$@\")" \ 376 --eval "(setq generated-autoload-file (reveal-filename \"$@\"))" \
373 --eval "(setq make-backup-files nil)" \ 377 --eval "(setq make-backup-files nil)" \
374 -f batch-update-autoloads $(MH_E_DIR) 378 -f batch-update-autoloads $(MH_E_DIR)
375 379
@@ -387,7 +391,7 @@ TRAMP_SRC = $(TRAMP_DIR)/tramp.el $(TRAMP_DIR)/tramp-adb.el \
387$(TRAMP_DIR)/tramp-loaddefs.el: $(TRAMP_SRC) 391$(TRAMP_DIR)/tramp-loaddefs.el: $(TRAMP_SRC)
388 $(emacs) -l autoload \ 392 $(emacs) -l autoload \
389 --eval "(setq generate-autoload-cookie \";;;###tramp-autoload\")" \ 393 --eval "(setq generate-autoload-cookie \";;;###tramp-autoload\")" \
390 --eval "(setq generated-autoload-file \"$@\")" \ 394 --eval "(setq generated-autoload-file (reveal-filename \"$@\"))" \
391 --eval "(setq make-backup-files nil)" \ 395 --eval "(setq make-backup-files nil)" \
392 -f batch-update-autoloads $(TRAMP_DIR) 396 -f batch-update-autoloads $(TRAMP_DIR)
393 397
@@ -409,21 +413,21 @@ CAL_SRC = $(CAL_DIR)/cal-bahai.el $(CAL_DIR)/cal-china.el \
409$(CAL_DIR)/cal-loaddefs.el: $(CAL_SRC) 413$(CAL_DIR)/cal-loaddefs.el: $(CAL_SRC)
410 $(emacs) -l autoload \ 414 $(emacs) -l autoload \
411 --eval "(setq generate-autoload-cookie \";;;###cal-autoload\")" \ 415 --eval "(setq generate-autoload-cookie \";;;###cal-autoload\")" \
412 --eval "(setq generated-autoload-file \"$@\")" \ 416 --eval "(setq generated-autoload-file (reveal-filename \"$@\"))" \
413 --eval "(setq make-backup-files nil)" \ 417 --eval "(setq make-backup-files nil)" \
414 -f batch-update-autoloads $(CAL_DIR) 418 -f batch-update-autoloads $(CAL_DIR)
415 419
416$(CAL_DIR)/diary-loaddefs.el: $(CAL_SRC) 420$(CAL_DIR)/diary-loaddefs.el: $(CAL_SRC)
417 $(emacs) -l autoload \ 421 $(emacs) -l autoload \
418 --eval "(setq generate-autoload-cookie \";;;###diary-autoload\")" \ 422 --eval "(setq generate-autoload-cookie \";;;###diary-autoload\")" \
419 --eval "(setq generated-autoload-file \"$@\")" \ 423 --eval "(setq generated-autoload-file (reveal-filename \"$@\"))" \
420 --eval "(setq make-backup-files nil)" \ 424 --eval "(setq make-backup-files nil)" \
421 -f batch-update-autoloads $(CAL_DIR) 425 -f batch-update-autoloads $(CAL_DIR)
422 426
423$(CAL_DIR)/hol-loaddefs.el: $(CAL_SRC) 427$(CAL_DIR)/hol-loaddefs.el: $(CAL_SRC)
424 $(emacs) -l autoload \ 428 $(emacs) -l autoload \
425 --eval "(setq generate-autoload-cookie \";;;###holiday-autoload\")" \ 429 --eval "(setq generate-autoload-cookie \";;;###holiday-autoload\")" \
426 --eval "(setq generated-autoload-file \"$@\")" \ 430 --eval "(setq generated-autoload-file (reveal-filename \"$@\"))" \
427 --eval "(setq make-backup-files nil)" \ 431 --eval "(setq make-backup-files nil)" \
428 -f batch-update-autoloads $(CAL_DIR) 432 -f batch-update-autoloads $(CAL_DIR)
429 433
diff --git a/lisp/loadup.el b/lisp/loadup.el
index a2e0d8ecec5..5764cdec7eb 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -290,9 +290,12 @@
290 (equal (nth 4 command-line-args) "dump")) 290 (equal (nth 4 command-line-args) "dump"))
291 (not (eq system-type 'ms-dos))) 291 (not (eq system-type 'ms-dos)))
292 (let* ((base (concat "emacs-" emacs-version ".")) 292 (let* ((base (concat "emacs-" emacs-version "."))
293 (exelen (if (eq system-type 'windows-nt) -4))
293 (files (file-name-all-completions base default-directory)) 294 (files (file-name-all-completions base default-directory))
294 (versions (mapcar (function (lambda (name) 295 (versions (mapcar (function
295 (string-to-number (substring name (length base))))) 296 (lambda (name)
297 (string-to-number
298 (substring name (length base) exelen))))
296 files))) 299 files)))
297 (setq emacs-bzr-version (condition-case nil (emacs-bzr-get-version) 300 (setq emacs-bzr-version (condition-case nil (emacs-bzr-get-version)
298 (error nil))) 301 (error nil)))
@@ -376,18 +379,25 @@
376 (dump-emacs "emacs" "temacs") 379 (dump-emacs "emacs" "temacs")
377 (message "%d pure bytes used" pure-bytes-used) 380 (message "%d pure bytes used" pure-bytes-used)
378 ;; Recompute NAME now, so that it isn't set when we dump. 381 ;; Recompute NAME now, so that it isn't set when we dump.
379 (if (not (or (memq system-type '(ms-dos windows-nt)) 382 (if (not (or (eq system-type 'ms-dos)
380 ;; Don't bother adding another name if we're just 383 ;; Don't bother adding another name if we're just
381 ;; building bootstrap-emacs. 384 ;; building bootstrap-emacs.
382 (equal (nth 3 command-line-args) "bootstrap") 385 (equal (nth 3 command-line-args) "bootstrap")
383 (equal (nth 4 command-line-args) "bootstrap"))) 386 (equal (nth 4 command-line-args) "bootstrap")))
384 (let ((name (concat "emacs-" emacs-version))) 387 (let ((name (concat "emacs-" emacs-version))
388 (exe (if (eq system-type 'windows-nt) ".exe" "")))
385 (while (string-match "[^-+_.a-zA-Z0-9]+" name) 389 (while (string-match "[^-+_.a-zA-Z0-9]+" name)
386 (setq name (concat (downcase (substring name 0 (match-beginning 0))) 390 (setq name (concat (downcase (substring name 0 (match-beginning 0)))
387 "-" 391 "-"
388 (substring name (match-end 0))))) 392 (substring name (match-end 0)))))
393 (setq name (concat name exe))
389 (message "Adding name %s" name) 394 (message "Adding name %s" name)
390 (add-name-to-file "emacs" name t))) 395 ;; When this runs on Windows, invocation-directory is not
396 ;; necessarily the current directory.
397 (add-name-to-file (expand-file-name (concat "emacs" exe)
398 invocation-directory)
399 (expand-file-name name invocation-directory)
400 t)))
391 (kill-emacs))) 401 (kill-emacs)))
392 402
393;; For machines with CANNOT_DUMP defined in config.h, 403;; For machines with CANNOT_DUMP defined in config.h,
diff --git a/lisp/subr.el b/lisp/subr.el
index 177e9a84a58..9bf11a13ef6 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -4678,4 +4678,20 @@ as alpha versions."
4678 (prin1-to-string (make-hash-table))))) 4678 (prin1-to-string (make-hash-table)))))
4679 (provide 'hashtable-print-readable)) 4679 (provide 'hashtable-print-readable))
4680 4680
4681;; This is used in lisp/Makefile.in and in leim/Makefile.in to
4682;; generate file names for autoloads, custom-deps, and finder-data.
4683(defun reveal-filename (file)
4684 "Produce the real file name for FILE.
4685
4686On systems other than MS-Windows, just returns FILE.
4687On MS-Windows, converts /d/foo/bar form of file names
4688passed by MSYS Make into d:/foo/bar that Emacs can grok.
4689
4690This function is called from lisp/Makefile."
4691 (when (and (eq system-type 'windows-nt)
4692 (string-match "\\`/[a-zA-Z]/" file))
4693 (setq file (concat (substring file 1 2) ":" (substring file 2))))
4694 file)
4695
4696
4681;;; subr.el ends here 4697;;; subr.el ends here