summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2009-04-22 04:55:25 +0200
committerBruno Haible <bruno@clisp.org>2009-04-22 04:55:25 +0200
commit5f755fddada02a264f6381974a564538950fb54a (patch)
tree9d5897918b228d3753ede01f0af977c40a58e9fc
parent7550f78f9b88f77309b1a233df6ef1f0e94f3035 (diff)
downloadlibunistring-5f755fddada02a264f6381974a564538950fb54a.tar.gz
Add version metainformation in Windows resource format.
-rw-r--r--ChangeLog15
-rw-r--r--Makefile.am5
-rwxr-xr-xbuild-aux/windres-options45
-rw-r--r--configure.ac12
-rw-r--r--lib/Makefile.am14
-rw-r--r--lib/libunistring.rc38
6 files changed, 129 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index f3c6404..94105c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
2008-04-21 Bruno Haible <bruno@clisp.org>
+ Add version metainformation in Windows resource format.
+ * configure.ac: Invoke LT_LANG for Windows Resources.
+ (WOE32): New conditional.
+ * lib/libunistring.rc: New file.
+ * lib/Makefile.am (EXTRA_DIST): Add it.
+ (WOE32_LIBADD): New variable.
+ (libunistring.res.lo): New rule.
+ (libunistring_la_LIBADD, libunistring_la_DEPENDENCIES): Add
+ WOE32_LIBADD.
+ (config.h): Don't compile *.res.c files.
+ * build-aux/windres-options: New file, from GNU gettext.
+ * Makefile.am (EXTRA_DIST): Add it.
+
+2008-04-21 Bruno Haible <bruno@clisp.org>
+
Add version metainformation.
* configure.ac (AC_CONFIG_SRCDIR): Use lib/unistring/version.in.h.
(HEXVERSION): New variable, computed from VERSION.
diff --git a/Makefile.am b/Makefile.am
index 4730a58..868f478 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -34,3 +34,8 @@ EXTRA_DIST += gnulib-m4/gnulib-cache.m4
# Cygwin support.
EXTRA_DIST += woe32dll/export.h
+
+
+# Woe32 support.
+
+EXTRA_DIST += build-aux/windres-options
diff --git a/build-aux/windres-options b/build-aux/windres-options
new file mode 100755
index 0000000..779fdde
--- /dev/null
+++ b/build-aux/windres-options
@@ -0,0 +1,45 @@
+#!/bin/sh
+# Usage: windres-options [--escape] PACKAGE_VERSION
+# Outputs a set of command-line options for 'windres', containing definitions
+# for the preprocessor variables
+# PACKAGE_VERSION_STRING
+# PACKAGE_VERSION_MAJOR
+# PACKAGE_VERSION_MINOR
+# PACKAGE_VERSION_SUBMINOR
+
+escape=
+if test "$1" = "--escape"; then
+ escape=yes
+ shift
+fi
+version="$1" # something like 2.0 or 2.17 or 2.17.3 or 2.17.3-pre3
+
+sed_extract_major='/^[0-9]/{s/^\([0-9]*\).*/\1/p;q;}
+i\
+0
+q
+'
+sed_extract_minor='/^[0-9][0-9]*[.][0-9]/{s/^[0-9]*[.]\([0-9]*\).*/\1/p;q;}
+i\
+0
+q
+'
+sed_extract_subminor='/^[0-9][0-9]*[.][0-9][0-9]*[.][0-9]/{s/^[0-9]*[.][0-9]*[.]\([0-9]*\).*/\1/p;q;}
+i\
+0
+q
+'
+
+{
+ echo "-DPACKAGE_VERSION_STRING=\"${version}\""
+ echo "-DPACKAGE_VERSION_MAJOR="`echo "${version}" | sed -n -e "$sed_extract_major"`
+ echo "-DPACKAGE_VERSION_MINOR="`echo "${version}" | sed -n -e "$sed_extract_minor"`
+ echo "-DPACKAGE_VERSION_SUBMINOR="`echo "${version}" | sed -n -e "$sed_extract_subminor"`
+} |
+{
+ if test -n "$escape"; then
+ sed -e 's,\(["\\]\),\\\1,g'
+ else
+ cat
+ fi
+}
diff --git a/configure.ac b/configure.ac
index 6961418..eaca4ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,6 +53,18 @@ gl_WOE32_DLL
LT_INIT([win32-dll])
+dnl Prepares the libtool configuration for handling of Windows resources, and
+dnl sets the RC variable to a program that compiles Windows resource files.
+LT_LANG([Windows Resource])
+
+dnl On mingw and Cygwin, we can activate special Makefile rules which add
+dnl version information to the shared libraries and executables.
+case "$host_os" in
+ mingw* | cygwin*) is_woe32=yes ;;
+ *) is_woe32=no ;;
+esac
+AM_CONDITIONAL([WOE32], [test $is_woe32 = yes])
+
dnl Checks for types, header files, functions and declarations.
gl_INIT
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 19b7562..40704fd 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -203,6 +203,7 @@ config.h: $(BUILT_SOURCES) libunistring.sym
{ \
for f in $(libunistring_la_SOURCES) $(libunistring_la_LIBADD); do \
case $$f in \
+ *.res.lo ) ;; \
*.c | *.$(OBJEXT) | *.lo ) \
sf=`echo "$$f" | sed -e 's,\\.[^.]*$$,,'`.c; \
test -f $$sf || sf=$(srcdir)/$$sf; \
@@ -227,6 +228,19 @@ config.h: $(BUILT_SOURCES) libunistring.sym
fi
MOSTLYCLEANFILES += config.h config.h-t
+# Version information according to Woe32 conventions.
+EXTRA_DIST += libunistring.rc
+if WOE32
+WOE32_LIBADD = libunistring.res.lo
+libunistring.res.lo : $(srcdir)/libunistring.rc
+ $(LIBTOOL) --tag=RC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(RC) `$(SHELL) $(top_srcdir)/build-aux/windres-options --escape $(VERSION)` -i $(srcdir)/libunistring.rc -o libunistring.res.lo --output-format=coff
+MOSTLYCLEANFILES += libunistring.res.lo
+else
+WOE32_LIBADD =
+endif
+libunistring_la_LIBADD += $(WOE32_LIBADD)
+libunistring_la_DEPENDENCIES += $(WOE32_LIBADD)
+
# Libtool's library version information for libunistring.
# See the libtool documentation, section "Library interface versions".
LTV_CURRENT=0
diff --git a/lib/libunistring.rc b/lib/libunistring.rc
new file mode 100644
index 0000000..f1b51af
--- /dev/null
+++ b/lib/libunistring.rc
@@ -0,0 +1,38 @@
+/* Resources for unistring.dll */
+
+#include <winver.h>
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION PACKAGE_VERSION_MAJOR,PACKAGE_VERSION_MINOR,PACKAGE_VERSION_SUBMINOR,0
+ PRODUCTVERSION PACKAGE_VERSION_MAJOR,PACKAGE_VERSION_MINOR,PACKAGE_VERSION_SUBMINOR,0
+ FILEFLAGSMASK 0x3fL /* VS_FFI_FILEFLAGSMASK */
+#ifdef _DEBUG
+ FILEFLAGS 0x1L /* VS_FF_DEBUG */
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x10004L /* VOS_DOS_WINDOWS32 */
+ FILETYPE 0x2L /* VFT_DLL */
+ FILESUBTYPE 0x0L /* VFT2_UNKNOWN */
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "04090000" /* Lang = US English, Charset = ASCII */
+ BEGIN
+ VALUE "Comments", "This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3 or later. You should have received a copy of the GNU Lesser General Public License along with this library; if not, see <http://www.gnu.org/licenses/>\0"
+ VALUE "CompanyName", "Free Software Foundation\0"
+ VALUE "FileDescription", "LGPLed libunistring for Windows NT/2000/XP/Vista and Windows 95/98/ME\0"
+ VALUE "FileVersion", PACKAGE_VERSION_STRING "\0"
+ VALUE "InternalName", "unistring.dll\0"
+ VALUE "LegalCopyright", "Copyright (C) 2001-2009\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "unistring.dll\0"
+ VALUE "ProductName", "libunistring: Unicode string library\0"
+ VALUE "ProductVersion", PACKAGE_VERSION_STRING "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0409, 0 /* US English, ASCII */
+ END
+END