On Sat, Aug 11, 2007 at 08:00:25PM +0200, Enrico Forestieri wrote: > On Sat, Aug 11, 2007 at 07:00:23PM +0200, Jean-Marc Lasgouttes wrote: > > > Enrico Forestieri <[EMAIL PROTECTED]> writes: > > > > > The attached patch adds icons and version information (which shows up > > > when opening the 'properties' tab) to the lyx executable on Windows > > > when building with autotools. > > > > > > It is intended for branch, as after the earthquake it doesn't apply > > > anymore to trunk. I'll wait for the aftershocks before adapting it. > > > > > > JMarc, may I apply it? > > Did you try it out on linux? Did you check that dist works? > > I tried it on linux, but actually didn't check "make dist". Will do > that after I can reboot in debian. Anyway, I don't see what could go > wrong (last famous words :)
Hmpf. Seemingly, I still don't understand very well this autoconf thing. Using my logic, LYXWINRES should not be defined on linux, and indeed it doesn't appear in lyx_SOURCES, *but* it appears in lyx_SOURCES_DIST. So, it is not used when compiling but gets scheduled for distribution in any case? Bah... Please find attached a revised patch. This time I checked that dist actually works. -- Enrico
Index: src/lyxwinres.rc.in =================================================================== --- src/lyxwinres.rc.in (revision 0) +++ src/lyxwinres.rc.in (revision 0) @@ -0,0 +1,51 @@ +/* Icons */ +IDI_ICON1 ICON DISCARDABLE "@top_srcdir@/development/Win32/packaging/icons/lyx_32x32.ico" +IDI_ICON2 ICON DISCARDABLE "@top_srcdir@/development/Win32/packaging/icons/lyx_doc_32x32.ico" + +#include <winver.h> + +#ifdef _WIN32 +#define PLATFORM "Windows\0" +#define FILEDESC "LyX/Win\0" +#else +#define PLATFORM "Cygwin\0" +#define FILEDESC "LyX/Cygwin\0" +#endif + +#if @LYX_RELEASE_PATCH@ > 0 +#define PATCH_TAG "[EMAIL PROTECTED]@\0" +#else +#define PATCH_TAG "\0" +#endif + +LANGUAGE 0x9, 0x1 /* LANG_ENGLISH, SUBLANG_DEFAULT */ + +VS_VERSION_INFO VERSIONINFO +FILEVERSION @LYX_MAJOR_VERSION@,@LYX_MINOR_VERSION@,@LYX_RELEASE_LEVEL@,@LYX_RELEASE_PATCH@ +PRODUCTVERSION @LYX_MAJOR_VERSION@,@LYX_MINOR_VERSION@,@LYX_RELEASE_LEVEL@,@LYX_RELEASE_PATCH@ +FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +FILEFLAGS 0x0L +FILEOS VOS__WINDOWS32 +FILETYPE VFT_APP +FILESUBTYPE 0x0L +{ + BLOCK "StringFileInfo" + { + BLOCK "040904b0" + { + VALUE "FileDescription", FILEDESC + VALUE "OriginalFilename", "lyx.exe\0" + VALUE "CompanyName", "LyX Team\0" + VALUE "FileVersion", "@[EMAIL PROTECTED]@[EMAIL PROTECTED]@LYX_RELEASE_LEVEL@" PATCH_TAG + VALUE "InternalName", "LyX\0" + VALUE "LegalCopyright", "Copyright \251 1995 by Matthias Ettrich, 1995-2006 LyX Team\0" + VALUE "ProductName", "LyX for " PLATFORM + VALUE "ProductVersion", "@[EMAIL PROTECTED]" + } + } + BLOCK "VarFileInfo" + { + VALUE "Translation", 0x409, 1200 + } +} + Index: src/Makefile.am =================================================================== --- src/Makefile.am (revision 19431) +++ src/Makefile.am (working copy) @@ -1,6 +1,7 @@ include $(top_srcdir)/config/common.am -DISTCLEANFILES += config.h libintl.h version.cpp stamp-version version.cpp-tmp +DISTCLEANFILES += config.h libintl.h version.cpp stamp-version version.cpp-tmp \ + stamp-lyxwinres lyxwinres.rc-tmp MAINTAINERCLEANFILES += $(srcdir)/config.h.in @@ -10,7 +11,7 @@ endif SUBDIRS = mathed insets graphics support frontends . $(CLIENT) tex2lyx -EXTRA_DIST = config.h.in stamp-h.in version.cpp.in \ +EXTRA_DIST = config.h.in lyxwinres.rc.in stamp-h.in version.cpp.in \ Section.h \ Section.cpp \ Variables.cpp \ @@ -41,9 +42,15 @@ lyx$(EXEEXT): $(FRONTENDS_PROGS) rm -f $@ $(LN_S) $< $@ +if LYX_WIN_RESOURCE +LYXWINRES = lyxwinres.rc +.rc.o: + windres --preprocessor "$(CPP) -xc-header -DRC_INVOKED" $< -o $@ +endif + #lyx_LDFLAGS=-Wl,-O1 -BUILT_SOURCES = $(PCH_FILE) version.cpp +BUILT_SOURCES = $(PCH_FILE) version.cpp $(LYXWINRES) AM_CPPFLAGS += $(PCH_FLAGS) $(BOOST_INCLUDES) @@ -60,7 +67,7 @@ endif lyx_SOURCES = \ - $(ASPELL) $(PSPELL) $(ISPELL) SpellBase.cpp \ + $(ASPELL) $(PSPELL) $(ISPELL) $(LYXWINRES) SpellBase.cpp \ Author.cpp \ Author.h \ Bidi.cpp \ @@ -273,3 +280,15 @@ stamp-version: version.cpp-tmp cp $< version.cpp ;\ fi echo timestamp > $@ + +lyxwinres.rc: stamp-lyxwinres + @: + +stamp-lyxwinres: lyxwinres.rc-tmp + if cmp -s $< lyxwinres.rc ; then \ + : ;\ + else \ + rm -f lyxwinres.rc ;\ + cp $< lyxwinres.rc ;\ + fi + echo timestamp > $@ Index: configure.ac =================================================================== --- configure.ac (revision 19431) +++ configure.ac (working copy) @@ -281,6 +281,13 @@ LIBS="$save_LIBS" AM_CONDITIONAL(BUILD_CLIENT_SUBDIR, $lyx_client_subdir) AC_LANG_POP(C) +lyx_win_res=false; +case ${host} in + *mingw*|*cygwin*) lyx_win_res=true;; +esac +AM_CONDITIONAL(LYX_WIN_RESOURCE, $lyx_win_res) +LYX_SET_VERSION_INFO + AC_FUNC_SELECT_ARGTYPES ### Some information on what just happened @@ -430,6 +437,7 @@ AC_CONFIG_FILES([Makefile sourcedoc/Makefile \ src/client/Makefile \ src/Makefile \ + src/lyxwinres.rc-tmp:src/lyxwinres.rc.in \ src/version.cpp-tmp:src/version.cpp.in \ src/tex2lyx/Makefile \ src/mathed/Makefile \ Index: config/lyxinclude.m4 =================================================================== --- config/lyxinclude.m4 (revision 19431) +++ config/lyxinclude.m4 (working copy) @@ -717,3 +717,22 @@ do break], [AC_MSG_RESULT(no)]) done]) + +dnl Extract the single digits from PACKAGE_VERSION and make them available. +dnl Defines LYX_MAJOR_VERSION, LYX_MINOR_VERSION, LYX_RELEASE_LEVEL, and +dnl LYX_RELEASE_PATCH, this latter one possibly equal to 0. +AC_DEFUN([LYX_SET_VERSION_INFO], +[lyx_major=`echo $PACKAGE_VERSION | sed -e 's/[[.]].*//'` + lyx_minor=`echo $PACKAGE_VERSION | sed -e "s/^$lyx_major//" -e 's/^.//'` + lyx_release=$lyx_minor + lyx_minor=`echo $lyx_release | sed -e 's/[[.]].*//'` + lyx_release=`echo $lyx_release | sed -e "s/^$lyx_minor//" -e 's/^.//'` + lyx_patch=$lyx_release + lyx_release=`echo $lyx_patch | sed -e 's/[[^0-9]].*//'` + lyx_patch=`echo $lyx_patch | sed -e "s/^$lyx_release//" -e 's/^[[.]]//' -e 's/[[^0-9]].*//'` + test "x$lyx_patch" = "x" && lyx_patch=0 + AC_SUBST(LYX_MAJOR_VERSION,$lyx_major) + AC_SUBST(LYX_MINOR_VERSION,$lyx_minor) + AC_SUBST(LYX_RELEASE_LEVEL,$lyx_release) + AC_SUBST(LYX_RELEASE_PATCH,$lyx_patch) +])