On Mon, Aug 13, 2007 at 12:16:46AM +0200, Jean-Marc Lasgouttes wrote:
> Enrico Forestieri <[EMAIL PROTECTED]> writes:
>
> >> +[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]].*//'`
> >>
> >> At least lines 2 and 3 do not look right.
> >
> > Please, explain what doesn't look right.
>
> I would replace lines 2 and 3 by
> >> + lyx_release=`echo $PACKAGE_VERSION | sed -e "s/^$lyx_major//" -e
> >> 's/^.//'`
> since the assignment to lyx_minor is not used.
Doh! You're right. Of course the same applies to lines 6 and 7. I used
a temp var initially, then replaced it with an existing one in order
to avoid clutter in the namespace, but didn't realize that there was
a further simplification. Now I am using lyx_patch as the scratch var.
Updated patch attached.
> Then I wondered whether other things could be problematic.
;-)
> You can apply to trunk and branch.
Ok.
--
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 PRODNAME "LyX/Win\0"
+#else
+#define PLATFORM "Cygwin\0"
+#define PRODNAME "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", "LyX for " PLATFORM
+ 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", PRODNAME
+ VALUE "ProductVersion", "@[EMAIL PROTECTED]"
+ }
+ }
+ BLOCK "VarFileInfo"
+ {
+ VALUE "Translation", 0x409, 1200
+ }
+}
+
Index: src/Makefile.am
===================================================================
--- src/Makefile.am (revision 19496)
+++ 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 19496)
+++ 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: status.15x
===================================================================
--- status.15x (revision 19496)
+++ status.15x (working copy)
@@ -71,3 +71,6 @@ What's new
- Clarify error message for --without-included-boost
- Upgrade to gettext 0.14.6.
+
+- Add icons and version information to the lyx executable on Windows.
+
Index: config/lyxinclude.m4
===================================================================
--- config/lyxinclude.m4 (revision 19496)
+++ config/lyxinclude.m4 (working copy)
@@ -717,3 +717,20 @@ 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, the latter being possibly equal to 0.
+AC_DEFUN([LYX_SET_VERSION_INFO],
+[lyx_major=`echo $PACKAGE_VERSION | sed -e 's/[[.]].*//'`
+ lyx_patch=`echo $PACKAGE_VERSION | sed -e "s/^$lyx_major//" -e 's/^.//'`
+ lyx_minor=`echo $lyx_patch | sed -e 's/[[.]].*//'`
+ lyx_patch=`echo $lyx_patch | sed -e "s/^$lyx_minor//" -e 's/^.//'`
+ 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)
+])