From 84e2f13cd50a7ef6af736559107f0a8e6bcec6c5 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 22 Nov 2014 14:04:32 -0800 Subject: [PATCH] Further reduce number of versioned files storing Emacs version number. * configure.ac (comma_version, comma_space_version) [mingw32]: New output variables. (nt/emacs.rc, nt/emacsclient.rc) [mingw32]: New output files. * make-dist: Update nt/ for *.rc -> *.rc.in changes. * nt/emacs.rc.in, nt/emacsclient.rc.in: Rename from nt/emacs.rc, emacsclient.rc. Let configure generate the real files, and set the version numbers. * lib-src/Makefile.in (emacsclient.res): Update deps for nt/emacsclient.rc now being in the build directory, not the source directory. * nt/Makefile.in (distclean): Delete *.rc. (emacs.res): Update deps for nt/emacsclient.rc now being in the build directory, not the source directory. * admin/admin.el (set-version): No more need to update nt/*.rc. * admin/authors.el (authors-renamed-files-alist): Add .rc.in files. --- ChangeLog | 8 ++++++++ admin/ChangeLog | 5 +++++ admin/admin.el | 45 ++------------------------------------------- admin/authors.el | 2 ++ configure.ac | 9 +++++++++ lib-src/ChangeLog | 3 +++ lib-src/Makefile.in | 2 +- make-dist | 6 +++--- nt/ChangeLog | 6 ++++++ nt/Makefile.in | 6 +++--- nt/emacs.rc.in | 45 +++++++++++++++++++++++++++++++++++++++++++++ nt/emacsclient.rc.in | 39 +++++++++++++++++++++++++++++++++++++++ src/Makefile.in | 2 +- 13 files changed, 127 insertions(+), 51 deletions(-) create mode 100644 nt/emacs.rc.in create mode 100644 nt/emacsclient.rc.in diff --git a/ChangeLog b/ChangeLog index 749c020b698..f40624c42e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2014-11-22 Glenn Morris + + Further reduce number of versioned files storing Emacs version number. + * configure.ac (comma_version, comma_space_version) [mingw32]: + New output variables. + (nt/emacs.rc, nt/emacsclient.rc) [mingw32]: New output files. + * make-dist: Update nt/ for *.rc -> *.rc.in changes. + 2014-11-19 Dani Moncayo * build-aux/msys-to-w32: Simplify implementation and docstring; diff --git a/admin/ChangeLog b/admin/ChangeLog index 96a98e56109..cc69367555f 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog @@ -1,3 +1,8 @@ +2014-11-22 Glenn Morris + + * admin.el (set-version): No more need to update nt/*.rc. + * authors.el (authors-renamed-files-alist): Add .rc.in files. + 2014-11-16 Glenn Morris * update_autogen: Auto-detect VCS in use. diff --git a/admin/admin.el b/admin/admin.el index b22160ef478..d6c702a3bdf 100644 --- a/admin/admin.el +++ b/admin/admin.el @@ -99,6 +99,8 @@ Root must be the root of an Emacs source tree." (rx (and bol "#" (0+ blank) "define" (1+ blank) "VERSION" (1+ blank) "\"" (submatch (1+ (in "0-9.")))))) + ;; TODO: msdos could easily extract the version number from + ;; configure.ac with sed, rather than duplicating the information. (set-version-in-file root "msdos/sed2v2.inp" version (rx (and bol "/^#undef " (1+ not-newline) "define VERSION" (1+ space) "\"" @@ -107,49 +109,6 @@ Root must be the root of an Emacs source tree." (set-version-in-file root "nt/makefile.w32-in" version (rx (and "VERSION" (0+ space) "=" (0+ space) (submatch (1+ (in "0-9.")))))) - ;; nt/emacs.rc also contains the version number, but in an awkward - ;; format. It must contain four components, separated by commas, and - ;; in two places those commas are followed by space, in two other - ;; places they are not. - (let* ((version-components (append (split-string version "\\.") - '("0" "0"))) - (comma-version - (concat (car version-components) "," - (cadr version-components) "," - (cadr (cdr version-components)) "," - (cadr (cdr (cdr version-components))))) - (comma-space-version - (concat (car version-components) ", " - (cadr version-components) ", " - (cadr (cdr version-components)) ", " - (cadr (cdr (cdr version-components)))))) - (set-version-in-file root "nt/emacs.rc" comma-version - (rx (and "FILEVERSION" (1+ space) - (submatch (1+ (in "0-9,")))))) - (set-version-in-file root "nt/emacs.rc" comma-version - (rx (and "PRODUCTVERSION" (1+ space) - (submatch (1+ (in "0-9,")))))) - (set-version-in-file root "nt/emacs.rc" comma-space-version - (rx (and "\"FileVersion\"" (0+ space) ?, (0+ space) - ?\" (submatch (1+ (in "0-9, "))) "\\0\""))) - (set-version-in-file root "nt/emacs.rc" comma-space-version - (rx (and "\"ProductVersion\"" (0+ space) ?, - (0+ space) ?\" (submatch (1+ (in "0-9, "))) - "\\0\""))) - ;; Likewise for emacsclient.rc - (set-version-in-file root "nt/emacsclient.rc" comma-version - (rx (and "FILEVERSION" (1+ space) - (submatch (1+ (in "0-9,")))))) - (set-version-in-file root "nt/emacsclient.rc" comma-version - (rx (and "PRODUCTVERSION" (1+ space) - (submatch (1+ (in "0-9,")))))) - (set-version-in-file root "nt/emacsclient.rc" comma-space-version - (rx (and "\"FileVersion\"" (0+ space) ?, (0+ space) - ?\" (submatch (1+ (in "0-9, "))) "\\0\""))) - (set-version-in-file root "nt/emacsclient.rc" comma-space-version - (rx (and "\"ProductVersion\"" (0+ space) ?, - (0+ space) ?\" (submatch (1+ (in "0-9, "))) - "\\0\""))) ;; Major version only. (when (string-match "\\([0-9]\\{2,\\}\\)" version) (setq version (match-string 1 version)) diff --git a/admin/authors.el b/admin/authors.el index aefd947e802..b05f37ba8dd 100644 --- a/admin/authors.el +++ b/admin/authors.el @@ -730,6 +730,8 @@ in the repository.") ("paths.h-dist" . "epaths.in") ("paths.h.in" . "epaths.in") ("paths.in" . "epaths.in") + ("emacs.rc" . "emacs.rc.in") + ("emacsclient.rc" . "emacsclient.rc.in") ("patch1" . "sed1.inp") ("INSTALL.MSYS" . "INSTALL") ("server.c" . "emacsserver.c") diff --git a/configure.ac b/configure.ac index 5d71c2f6a6e..85d11234035 100644 --- a/configure.ac +++ b/configure.ac @@ -4679,6 +4679,15 @@ AH_TEMPLATE(config_opsysfile, [Some platforms that do not use configure case $opsys in mingw32) AC_DEFINE(config_opsysfile, , []) + + dnl Construct something of the form "24,4,0,0" with 4 components. + comma_version=`echo "$version.0.0" | sed -e 's/\./,/g' -e 's/^\([[^,]]*,[[^,]]*,[[^,]]*,[[^,]]*\).*/\1/'` + + comma_space_version=`echo "$comma_version" | sed 's/,/, /g'` + + AC_SUBST(comma_version) + AC_SUBST(comma_space_version) + AC_CONFIG_FILES([nt/emacs.rc nt/emacsclient.rc]) ;; esac diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index a8281a579f1..4fc3b4dbe57 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,5 +1,8 @@ 2014-11-22 Glenn Morris + * Makefile.in (emacsclient.res): Update deps for nt/emacsclient.rc + now being in the build directory, not the source directory. + * Makefile.in (emacsclient.res): Add dependency on icons/emacs.ico. 2014-10-20 Glenn Morris diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index eb16c3305ae..432314f02dd 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in @@ -388,7 +388,7 @@ update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB) $(config_h) -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \ $< $(LOADLIBES) $(NTLIB) -o $@ -emacsclient.res: $(NTINC)/../emacsclient.rc ${srcdir}/icons/emacs.ico +emacsclient.res: ../nt/emacsclient.rc ${srcdir}/icons/emacs.ico $(WINDRES) -O coff --include-dir=$(NTINC)/.. -o $@ $< ## Makefile ends here. diff --git a/make-dist b/make-dist index 45df561ce13..6e85f1dc216 100755 --- a/make-dist +++ b/make-dist @@ -392,10 +392,10 @@ echo "Making links to \`m4'" echo "Making links to \`nt'" (cd nt - ln emacs-x86.manifest emacs-x64.manifest emacs.rc ../${tempdir}/nt - ln config.nt emacsclient.rc emacs-src.tags ../${tempdir}/nt + ln emacs-x86.manifest emacs-x64.manifest ../${tempdir}/nt + ln config.nt emacs-src.tags ../${tempdir}/nt ln nmake.defs gmake.defs subdirs.el [a-z]*.bat [a-z]*.[ch] ../${tempdir}/nt - ln Makefile.in gnulib.mk ../${tempdir}/nt + ln *.in gnulib.mk ../${tempdir}/nt ln mingw-cfg.site epaths.nt INSTALL.OLD ../${tempdir}/nt ln ChangeLog INSTALL README README.W32 makefile.w32-in ../${tempdir}/nt) diff --git a/nt/ChangeLog b/nt/ChangeLog index 49ef65afe6e..168f1dd9ed3 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,5 +1,11 @@ 2014-11-22 Glenn Morris + * emacs.rc.in, emacsclient.rc.in: Rename from emacs.rc, emacsclient.rc. + Let configure generate the real files, and set the version numbers. + * Makefile.in (distclean): Delete *.rc. + (emacs.res): Update deps for nt/emacsclient.rc now being in the + build directory, not the source directory. + * Makefile.in (emacs.res): Add dependency on icons/hand.cur. 2014-11-18 Glenn Morris diff --git a/nt/Makefile.in b/nt/Makefile.in index c456d55e4f8..c6b2f0bea0e 100644 --- a/nt/Makefile.in +++ b/nt/Makefile.in @@ -195,8 +195,7 @@ clean: mostlyclean -rm -f ${EXE_FILES} distclean: clean - -rm -f TAGS - -rm -f Makefile + -rm -f TAGS Makefile *.rc bootstrap-clean maintainer-clean: distclean true @@ -225,6 +224,7 @@ cmdproxy${EXEEXT}: ${srcdir}/cmdproxy.c runemacs${EXEEXT}: ${srcdir}/runemacs.c $(EMACSRES) $(CC) ${ALL_CFLAGS} $^ -mwindows -o $@ -emacs.res: ${srcdir}/emacs.rc ${srcdir}/icons/emacs.ico \ +## This rule (and file) is duplicated in src/: why? +emacs.res: emacs.rc ${srcdir}/icons/emacs.ico \ ${srcdir}/icons/hand.cur ${srcdir}/$(EMACS_MANIFEST) ${WINDRES} -I ${srcdir} -O coff -o $@ $< diff --git a/nt/emacs.rc.in b/nt/emacs.rc.in new file mode 100644 index 00000000000..d2d17b8eb1b --- /dev/null +++ b/nt/emacs.rc.in @@ -0,0 +1,45 @@ +Emacs ICON icons/emacs.ico +32649 CURSOR icons/hand.cur +#if defined (WIN64) || defined (__x86_64__) +1 24 "emacs-x64.manifest" +#else +1 24 "emacs-x86.manifest" +#endif + +#ifndef VS_VERSION_INFO +#define VS_VERSION_INFO 1 +#endif + +VS_VERSION_INFO VERSIONINFO + FILEVERSION @comma_version@ + PRODUCTVERSION @comma_version@ + FILEFLAGSMASK 0x3FL +#ifdef EMACSDEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "Free Software Foundation\0" + VALUE "FileDescription", "GNU Emacs: The extensible self-documenting text editor\0" + VALUE "FileVersion", "@comma_space_version@\0" + VALUE "InternalName", "Emacs\0" + VALUE "LegalCopyright", "Copyright (C) 2001-2014\0" + VALUE "OriginalFilename", "emacs.exe" + VALUE "ProductName", "Emacs\0" + VALUE "ProductVersion", "@comma_space_version@\0" + VALUE "OLESelfRegister", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/nt/emacsclient.rc.in b/nt/emacsclient.rc.in new file mode 100644 index 00000000000..5c3b65d752f --- /dev/null +++ b/nt/emacsclient.rc.in @@ -0,0 +1,39 @@ +Emacs ICON icons\emacs.ico + +#ifndef VS_VERSION_INFO +#define VS_VERSION_INFO 1 +#endif + +VS_VERSION_INFO VERSIONINFO + FILEVERSION @comma_version@ + PRODUCTVERSION @comma_version@ + FILEFLAGSMASK 0x3FL +#ifdef EMACSDEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "Free Software Foundation\0" + VALUE "FileDescription", "GNU EmacsClient: Client for the extensible self-documenting text editor\0" + VALUE "FileVersion", "@comma_space_version@\0" + VALUE "InternalName", "EmacsClient\0" + VALUE "LegalCopyright", "Copyright (C) 2001-2014\0" + VALUE "OriginalFilename", "emacsclientw.exe" + VALUE "ProductName", "EmacsClient\0" + VALUE "ProductVersion", "@comma_space_version@\0" + VALUE "OLESelfRegister", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/src/Makefile.in b/src/Makefile.in index 7defb4d1a75..4bc5fdfaaf5 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -549,7 +549,7 @@ $(top_srcdir)/aclocal.m4 $(top_srcdir)/configure config.in ../config.status \ doc.o: buildobj.h ## This rule (and file) is duplicated in nt/: why? -emacs.res: $(ntsource)/emacs.rc \ +emacs.res: ../nt/emacs.rc \ $(ntsource)/icons/emacs.ico \ $(ntsource)/icons/hand.cur \ $(ntsource)/$(EMACS_MANIFEST) -- 2.11.4.GIT