WIN32: add versioninfo, and export symbols
authorMarc Mutz <marc@kdab.net>
Fri, 17 Apr 2009 12:07:25 +0000 (14:07 +0200)
committerRalf Habacker <ralf.habacker@freenet.de>
Tue, 1 Dec 2009 07:36:26 +0000 (08:36 +0100)
* dbus/versioninfo.rc.in: (new file) copied and modified from libgpg-error
 * configure.in: enable libtool's W32 support, extract version information
    for use in versioninfo.rc.in, define DBUS_WIN, define DBUS_UNIX only on
    unix (adapted from libgpg-error)
 * dbus/Makefile.am: switch sources depending on platform,
    compile versioninfo.rc, add dbus-1.def (not used since buildsystem creates
    its own .def file apparently)
(cherry picked from commit cfa717ddb7b9258a862d87cd5b3bdbe582ce106c)

configure.in
dbus/Makefile.am
dbus/versioninfo.rc.in [new file with mode: 0644]

index 24ad554..4360e2d 100644 (file)
@@ -9,6 +9,8 @@ m4_define([dbus_version],
 AC_INIT(dbus, [dbus_version])
 
 AC_CANONICAL_HOST
+AC_LIBTOOL_WIN32_DLL
+AC_LIBTOOL_RC
 
 AM_INIT_AUTOMAKE([1.9 tar-ustar])
 AM_CONFIG_HEADER(config.h)
@@ -63,6 +65,39 @@ AC_HEADER_STDC
 AC_C_INLINE
 AM_PROG_LIBTOOL
 
+# Set some internal variables depending on the platform for later use.
+dbus_win=no
+dbus_unix=no
+case "${host}" in
+    *-mingw32*)
+        dbus_win=yes
+        ;;
+    *)
+        dbus_unix=yes
+       ;;
+esac
+
+# Special defines for certain platforms
+if test "$dbus_win" = yes; then
+    AC_DEFINE(DBUS_WIN,1,[Defined if we run on a W32 API based system])
+    BUILD_TIMESTAMP=`date --iso-8601=minutes`
+    AC_SUBST(BUILD_TIMESTAMP)
+    changequote(,)dnl
+    BUILD_FILEVERSION=`echo "$DBUS_VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
+    changequote([,])dnl
+    case "$DBUS_VERSION" in
+      *-rc*)  BUILD_FILEVERSION="${BUILD_FILEVERSION}1" ;;
+      *)      BUILD_FILEVERSION="${BUILD_FILEVERSION}2" ;;
+    esac
+else
+    AC_DEFINE(DBUS_UNIX,1,[Defined if we run on a Unix-based system])
+fi
+AC_SUBST(BUILD_TIMESTAMP)
+AC_SUBST(BUILD_FILEVERSION)
+AM_CONDITIONAL(DBUS_WIN, test "$dbus_win" = yes)
+AM_CONDITIONAL(DBUS_UNIX, test "$dbus_unix" = yes)
+
+
 AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests],[enable unit test code]),enable_tests=$enableval,enable_tests=$USE_MAINTAINER_MODE)
 AC_ARG_ENABLE(ansi, AS_HELP_STRING([--enable-ansi],[enable -ansi -pedantic gcc flags]),enable_ansi=$enableval,enable_ansi=no)
 AC_ARG_ENABLE(verbose-mode, AS_HELP_STRING([--enable-verbose-mode],[support verbose debug mode]),enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
@@ -91,8 +126,6 @@ AC_ARG_WITH(console-owner-file, AS_HELP_STRING([--with-console-owner-file=[filen
 AC_ARG_WITH(dbus_user, AS_HELP_STRING([--with-dbus-user=<user>],[User for running the DBUS daemon (messagebus)]))
 AC_ARG_WITH(dbus_daemondir, AS_HELP_STRING([--with-dbus-daemondir=[dirname]],[Directory for installing the DBUS daemon]))
 
-AC_DEFINE(DBUS_UNIX,1,[dbus on unix])
-
 dnl DBUS_BUILD_TESTS controls unit tests built in to .c files 
 dnl and also some stuff in the test/ subdir
 AM_CONDITIONAL(DBUS_BUILD_TESTS, test x$enable_tests = xyes)
@@ -1430,6 +1463,7 @@ AH_VERBATIM(_DARWIN_ENVIRON,
 
 AC_OUTPUT([
 Doxyfile
+dbus/versioninfo.rc
 dbus/dbus-arch-deps.h
 bus/system.conf
 bus/session.conf
index e966a43..9daa8a9 100644 (file)
@@ -11,6 +11,84 @@ dbusarchincludedir=$(libdir)/dbus-1.0/include/dbus
 
 lib_LTLIBRARIES=libdbus-1.la
 
+#
+# Deal with W32 .def and version-info.rc stuff
+#
+if DBUS_WIN
+LTRCCOMPILE = $(LIBTOOL) --mode=compile $(RC) \
+     `echo $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) | \
+     sed -e 's/-I/--include-dir /g;s/-D/--define /g'`
+
+SUFFIXES = rc
+
+.rc.o:
+       $(LTRCCOMPILE) -i $< -o $@
+
+dbus_res = versioninfo.o
+dbus_res_ldflag = -Wl,$(dbus_res)
+no_undefined = -no-undefined
+export_symbols = -export-symbols $(srcdir)/dbus-1.def
+
+install-def-file:
+       $(INSTALL) dbus-1.def $(DESTDIR)$(libdir)/dbus-1.def
+
+uninstall-def-file:
+       -rm $(DESTDIR)$(libdir)/dbus-1.def
+
+libdbus_1_la_DEPENDENCIES = $(dbus_res) dbus-1.def
+intllibs =
+
+else
+dbus_res =
+dbus_res_ldflag =
+no_undefined =
+export_symbols =
+install-def-file:
+uninstall-def-file:
+
+intllibs = @LTLIBINTL@
+
+endif
+
+
+#
+# Platform-dependent sources:
+#
+if DBUS_WIN
+DBUS_LIB_arch_sources =                        \
+       dbus-server-win.c                       \
+       dbus-server-win.h
+
+DBUS_SHARED_arch_sources =                     \
+       dbus-sysdeps-win.c                      \
+       dbus-sysdeps-win.h                      \
+       dbus-sysdeps-thread-win.c               \
+       dbus-transport-win.c                    \
+       dbus-transport-win.h
+
+DBUS_UTIL_arch_sources =                       \
+       dbus-sysdeps-util-win.c                 \
+       dbus-spawn-win.c
+else
+DBUS_LIB_arch_sources =                        \
+       dbus-server-unix.c                      \
+       dbus-server-unix.h
+
+DBUS_SHARED_arch_sources =                     \
+       dbus-sysdeps-unix.c                     \
+       dbus-sysdeps-unix.h                     \
+       dbus-sysdeps-pthread.c                  \
+       dbus-transport-unix.c                   \
+       dbus-transport-unix.h                   \
+       dbus-userdb.c                           \
+       dbus-userdb.h
+
+DBUS_UTIL_arch_sources =                       \
+       dbus-sysdeps-util-unix.c                \
+       dbus-userdb-util.c                      \
+       dbus-spawn.c
+endif
+
 dbusinclude_HEADERS=                           \
        dbus.h                                  \
        dbus-address.h                          \
@@ -26,6 +104,7 @@ dbusinclude_HEADERS=                         \
        dbus-server.h                           \
        dbus-shared.h                           \
        dbus-signature.h                        \
+       dbus-spawn.h                            \
        dbus-threads.h                          \
        dbus-types.h
 
@@ -73,8 +152,7 @@ DBUS_LIB_SOURCES=                            \
        dbus-server-protected.h                 \
        dbus-server-socket.c                    \
        dbus-server-socket.h                    \
-       dbus-server-unix.c                      \
-       dbus-server-unix.h                      \
+       $(DBUS_LIB_arch_sources)                \
        dbus-sha.c                              \
        dbus-sha.h                              \
        dbus-signature.c                        \
@@ -87,8 +165,6 @@ DBUS_LIB_SOURCES=                            \
        dbus-transport-protected.h              \
        dbus-transport-socket.c                 \
        dbus-transport-socket.h                 \
-       dbus-transport-unix.c                   \
-       dbus-transport-unix.h                   \
        dbus-uuidgen.c                          \
        dbus-uuidgen.h                          \
        dbus-watch.c                            \
@@ -118,13 +194,9 @@ DBUS_SHARED_SOURCES=                               \
        dbus-string.c                           \
        dbus-string.h                           \
        dbus-string-private.h                   \
+       $(DBUS_SHARED_arch_sources)             \
        dbus-sysdeps.c                          \
-       dbus-sysdeps.h                          \
-       dbus-sysdeps-pthread.c                  \
-       dbus-sysdeps-unix.c                     \
-       dbus-sysdeps-unix.h                     \
-       dbus-userdb.c                           \
-       dbus-userdb.h
+       dbus-sysdeps.h
 
 ### source code that is generic utility functionality used
 ### by the bus daemon or test apps, but is NOT included
@@ -144,14 +216,12 @@ DBUS_UTIL_SOURCES=                                \
        dbus-message-util.c                     \
        dbus-shell.c                            \
        dbus-shell.h                            \
-       dbus-spawn.c                            \
+       $(DBUS_UTIL_arch_sources)               \
        dbus-spawn.h                            \
        dbus-string-util.c                      \
        dbus-sysdeps-util.c                     \
-       dbus-sysdeps-util-unix.c                \
        dbus-test.c                             \
-       dbus-test.h                             \
-       dbus-userdb-util.c
+       dbus-test.h
 
 libdbus_1_la_SOURCES=                          \
        $(DBUS_LIB_SOURCES)                     \
diff --git a/dbus/versioninfo.rc.in b/dbus/versioninfo.rc.in
new file mode 100644 (file)
index 0000000..b745b39
--- /dev/null
@@ -0,0 +1,52 @@
+/* versioninfo.rc.in - for dbus
+ * Copyright (C) 2005 g10 Code GmbH
+ * 
+ * This file is free software; as a special exception the author gives
+ * unlimited permission to copy and/or distribute it, with or without
+ * modifications, as long as this notice is preserved.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+/* This file is processed by configure to create versioninfo.rc */
+
+#line __LINE__ "versioninfo.rc.in"
+
+#include <afxres.h>
+
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION @BUILD_FILEVERSION@
+ PRODUCTVERSION @BUILD_FILEVERSION@
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x21L
+#else
+ FILEFLAGS 0x20L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0"
+        BEGIN
+            VALUE "Comments", "Provided under the terms of the GNU Lesser General Public License.\0"
+            VALUE "CompanyName", "FreeDesktop.org\0"
+            VALUE "FileDescription", "dbus - FreeDesktop message bus system\0"
+            VALUE "FileVersion", "@DBUS_VERSION@\0"
+            VALUE "InternalName", "dbus\0"
+            VALUE "LegalCopyright", "Copyright © 2009 FreeDesktop.org\0"
+            VALUE "LegalTrademarks", "\0"
+            VALUE "OriginalFilename", "dbus-1.dll\0"
+            VALUE "PrivateBuild", "\0"
+            VALUE "ProductName", "dbus\0"
+            VALUE "ProductVersion", "@DBUS_VERSION@\0"
+            VALUE "SpecialBuild", "@BUILD_TIMESTAMP@\0"
+        END
+    END
+END
+