Feature #66: Windows DLL version information
authorStefan Becker <chemobejk@gmail.com>
Fri, 5 Jul 2013 20:06:40 +0000 (5 23:06 +0300)
committerStefan Becker <chemobejk@gmail.com>
Sat, 13 Jul 2013 12:54:10 +0000 (13 15:54 +0300)
Copied resource file handling from libpurple MinGW makefile

(cherry picked from commit 10e98ca6f8741fda555406f7ac9c7b586d2d6b2c)

src/core/Makefile.am
src/core/Makefile.mingw
src/core/libsiperc.rc.in [new file with mode: 0644]

index f897761..91a7335 100644 (file)
@@ -1,5 +1,6 @@
 EXTRA_DIST = \
-       Makefile.mingw
+       Makefile.mingw \
+       libsiperc.rc.in
 
 noinst_LTLIBRARIES = \
        libsipe_core.la \
index edff920..58e9dd0 100644 (file)
@@ -149,9 +149,12 @@ endif
 
 C_SRC =                        $(CLEAN_C_SRC) $(PURPLE_C_SRC)
 
+RC_SRC =               libsiperc.rc
+
 CLEAN_OBJECTS =                $(CLEAN_C_SRC:%.c=%.o)
 PURPLE_OBJECTS =       $(PURPLE_C_SRC:%.c=%.o)
-OBJECTS =              $(CLEAN_OBJECTS) $(PURPLE_OBJECTS)
+RC_OBJECTS =           $(RC_SRC:%.rc=%.o)
+OBJECTS =              $(CLEAN_OBJECTS) $(PURPLE_OBJECTS) $(RC_OBJECTS)
 
 # Only these modules need the purple headers
 $(PURPLE_OBJECTS):     INCLUDE_PATHS += $(PURPLE_INCLUDE_PATHS)
@@ -192,6 +195,14 @@ include $(PIDGIN_COMMON_RULES)
 
 all: $(TARGET).dll
 
+_comma = ,
+
+libsiperc.rc: libsiperc.rc.in
+       sed \
+               -e 's/@SIPE_VERSION@/$(VERSION)/' \
+               -e 's/#SIPE_VERSION#/$(subst .,$(_comma),$(VERSION))/' \
+               <$< >$@
+
 $(OBJECTS): $(PURPLE_CONFIG_H)
 
 $(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS)
@@ -201,6 +212,7 @@ $(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS)
 ## CLEAN RULES
 ##
 clean: tests-clean
+       rm -f $(RC_SRC)
        rm -f $(OBJECTS)
        rm -f $(TARGET).dll
 
diff --git a/src/core/libsiperc.rc.in b/src/core/libsiperc.rc.in
new file mode 100644 (file)
index 0000000..01496a0
--- /dev/null
@@ -0,0 +1,30 @@
+#include <winver.h>
+
+VS_VERSION_INFO VERSIONINFO
+  FILEVERSION #SIPE_VERSION#,0
+  PRODUCTVERSION #SIPE_VERSION#,0
+  FILEFLAGSMASK 0
+  FILEFLAGS 0
+  FILEOS VOS__WINDOWS32
+  FILETYPE VFT_DLL
+  FILESUBTYPE VFT2_UNKNOWN
+  BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+      BLOCK "040904B0"
+      BEGIN
+        VALUE "CompanyName", "SIPE Project <http://sipe.sourceforge.net/>"
+        VALUE "FileDescription", "LibSipe third-party plugin for LibPurple"
+        VALUE "FileVersion", "@SIPE_VERSION@"
+        VALUE "InternalName", "libsipe"
+        VALUE "LegalCopyright", "Copyright (C) 2010-2013 SIPE Project (See the COPYRIGHT file in the source distribution)."
+        VALUE "OriginalFilename", "libsipe.dll"
+        VALUE "ProductName", "LibSipe"
+        VALUE "ProductVersion", "@SIPE_VERSION@"
+      END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+      VALUE "Translation", 0x409, 1200
+    END
+  END