diff options
author | Pali Rohár <pali@kernel.org> | 2022-05-08 14:31:11 +0200 |
---|---|---|
committer | Pali Rohár <pali@kernel.org> | 2022-10-30 16:00:36 +0100 |
commit | 59cb656889fe77f062b7391160188b70bf60c7b2 (patch) | |
tree | 8be3698ba9810e2b9d4ec9722e611664c6b9b9bb | |
parent | 26a64f917656453051d200cc7bf87710a0bfcef7 (diff) | |
download | pciutils-59cb656889fe77f062b7391160188b70bf60c7b2.tar.gz |
libpci: Put name and version information into DLL library
Generate rc file from in template and fill DLL name and DLL version from
Makefile.
It looks like that the only possible way via GNU tools to specify version
information for DLL library is via text rc file compiled as COFF object
file via GNU windres and linked into the final DLL library via GNU ld.
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | lib/Makefile | 9 | ||||
-rw-r--r-- | lib/dllrsrc.rc.in | 35 |
3 files changed, 46 insertions, 1 deletions
@@ -54,6 +54,7 @@ endif AR=$(CROSS_COMPILE)ar RANLIB=$(CROSS_COMPILE)ranlib DLLTOOL=$(CROSS_COMPILE)dlltool +WINDRES=$(CROSS_COMPILE)windres # Base name of the library (overridden on NetBSD, which has its own libpci) LIBNAME=libpci @@ -124,7 +125,7 @@ TAGS: clean: rm -f `find . -name "*~" -o -name "*.[oa]" -o -name "\#*\#" -o -name TAGS -o -name core -o -name "*.orig"` - rm -f update-pciids lspci$(EXEEXT) setpci$(EXEEXT) example$(EXEEXT) lib/config.* *.[578] pci.ids.gz lib/*.pc lib/*.so lib/*.so.* lib/*.dll lib/*.def tags + rm -f update-pciids lspci$(EXEEXT) setpci$(EXEEXT) example$(EXEEXT) lib/config.* *.[578] pci.ids.gz lib/*.pc lib/*.so lib/*.so.* lib/*.dll lib/*.def lib/dllrsrc.rc tags rm -rf maint/dist distclean: clean diff --git a/lib/Makefile b/lib/Makefile index ae23144..77cef30 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -74,6 +74,15 @@ $(PCIIMPDEF): libpci.ver ver2def.pl perl ver2def.pl libpci.ver $(PCILIB) build.def $(PCIIMPDEF) $(PCIIMPLIB): $(PCIIMPDEF) $(DLLTOOL) --input-def $< --output-lib $@ +comma := , +dllrsrc.rc: dllrsrc.rc.in + sed <$< >$@ -e 's,@PCILIB_VERSION@,$(PCILIB_VERSION),' \ + -e 's,@PCILIB_VERSION_WINRC@,$(subst .,\$(comma),$(PCILIB_VERSION).0),' \ + -e 's,@PCILIB@,$(PCILIB),' \ + -e 's,@DEBUG_BUILD@,$(if $(findstring -g,$(CFLAGS)),1,0),' +dllrsrc.o: dllrsrc.rc + $(WINDRES) --input=$< --output=$@ --input-format=rc --output-format=coff +OBJS += dllrsrc endif CFLAGS += -fPIC -fvisibility=hidden $(PCILIB): $(addsuffix .o,$(OBJS)) diff --git a/lib/dllrsrc.rc.in b/lib/dllrsrc.rc.in new file mode 100644 index 0000000..519772b --- /dev/null +++ b/lib/dllrsrc.rc.in @@ -0,0 +1,35 @@ +#include <windows.h> +VS_VERSION_INFO VERSIONINFO +FILEVERSION @PCILIB_VERSION_WINRC@ +PRODUCTVERSION @PCILIB_VERSION_WINRC@ +FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#if @DEBUG_BUILD@ +FILEFLAGS VS_FF_DEBUG +#else +FILEFLAGS 0 +#endif +FILEOS VOS_NT_WINDOWS32 +FILETYPE VFT_DLL +FILESUBTYPE 0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + /* + * GNU windres seems that converts 7-bit ASCII strings to UTF-16, + * so specify UNICODE/UTF-16 encoding (0x04B0) for these strings. + */ + BLOCK "040904B0" /* Default U.S. English language, UNICODE/UTF-16 codepage */ + BEGIN + VALUE "FileDescription", "libpci" + VALUE "FileVersion", "@PCILIB_VERSION@" + VALUE "InternalName", "@PCILIB@" + VALUE "OriginalFilename", "@PCILIB@" + VALUE "ProductName", "pciutils" + VALUE "ProductVersion", "@PCILIB_VERSION@" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x004B0 /* Default U.S. English language, UNICODE/UTF-16 codepage */ + END +END |