W32 resources: reworked, added support for the static lib resources

This commit is contained in:
Evgeny Grin (Karlson2k)
2024-06-05 15:02:32 +02:00
parent 03abafc46b
commit 2534aab3f9
3 changed files with 35 additions and 24 deletions
+1
View File
@@ -172,6 +172,7 @@ AC_SYS_LARGEFILE
AC_FUNC_FSEEKO AC_FUNC_FSEEKO
LT_INIT([win32-dll]) LT_INIT([win32-dll])
LT_LANG([Windows Resource]) LT_LANG([Windows Resource])
lt_prog_compiler_pic_RC="$lt_prog_compiler_pic_RC -DDLL_EXPORT" # Used only on W32
AC_ARG_ENABLE([compact-code], AC_ARG_ENABLE([compact-code],
[AS_HELP_STRING([[--enable-compact-code]], [AS_HELP_STRING([[--enable-compact-code]],
+20 -22
View File
@@ -123,36 +123,34 @@ libmicrohttpd_la_LIBADD = \
$(MHD_LIBDEPS) $(MHD_TLS_LIBDEPS) $(MHD_LIBDEPS) $(MHD_TLS_LIBDEPS)
if HAVE_W32 AM_V_RC = $(am__v_RC_@AM_V@)
MHD_DLL_RES_SRC = microhttpd_dll_res.rc am__v_RC_ = $(am__v_RC_@AM_DEFAULT_V@)
MHD_DLL_RES_LO = libmicrohttpd_la-$(MHD_DLL_RES_SRC:.rc=.lo)
EXTRA_libmicrohttpd_la_DEPENDENCIES = $(MHD_DLL_RES_LO)
libmicrohttpd_la_LIBADD += $(MHD_DLL_RES_LO)
AM_V_RC = $(am__v_RC_$(V))
am__v_RC_ = $(am__v_RC_$(AM_DEFAULT_VERBOSITY))
am__v_RC_0 = @echo " RC " $@; am__v_RC_0 = @echo " RC " $@;
am__v_RC_1 = am__v_RC_1 =
# General rule is not required, but keep it just in case # General rule is not required, but keep it just in case
.rc.lo:
$(AM_V_RC) $(LIBTOOL) $(AM_V_lt) --tag=RC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(RC) $(RCFLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $< -o $@
# To add dll resource only to .dll file and exclude it form static
# lib, a little trick was used. Allow libtool to create file.lo,
# file.o and .libs/file.lo, .libs/file.o files, then overwrite file.o
# by empty object generated from empty c-file. Later libtool will
# use .libs/file.o for shared lib and empty file.o for static lib.
# This implementation is based on trick found in liblzma.
# Note: windres does not understand '-isystem' flag, so all # Note: windres does not understand '-isystem' flag, so all
# possible '-isystem' flags are replaced by simple '-I' flags. # possible '-isystem' flags are replaced by simple '-I' flags.
$(MHD_DLL_RES_LO): $(MHD_DLL_RES_SRC) .rc.lo:
$(AM_V_RC) RC_CPP_FLAGS=" $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) " && \ $(AM_V_RC) RC_ALL_CPPFLAGS=`echo ' $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) ' | $(SED) -e 's/ -isystem / -I /g'`; \
$(LIBTOOL) $(AM_V_lt) --tag=RC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(RC) $(RCFLAGS) $(DEFS) $${RC_CPP_FLAGS// -isystem / -I} $< -o $@ && \ $(LIBTOOL) $(AM_V_lt) --tag=RC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(RC) $(RCFLAGS) $(DEFS) $${RC_ALL_CPPFLAGS} $< -o $@
echo > $@-empty.c && $(CC) $(DEFS) $(AM_CFLAGS) $(CFLAGS) -c $@-empty.c -o $(@:.lo=.o) && rm -f $@-empty.c
# Note: windres does not understand '-isystem' flag, so all
# possible '-isystem' flags are replaced by simple '-I' flags.
libmicrohttpd_la-microhttpd_dll_res.lo: $(builddir)/microhttpd_dll_res.rc
$(AM_V_RC) RC_ALL_CPPFLAGS=`echo ' $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) ' | $(SED) -e 's/ -isystem / -I /g'`; \
$(LIBTOOL) $(AM_V_lt) --tag=RC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(RC) $(RCFLAGS) $(DEFS) $${RC_ALL_CPPFLAGS} $(builddir)/microhttpd_dll_res.rc -o $@
if HAVE_W32
MHD_DLL_RES_LO = libmicrohttpd_la-microhttpd_dll_res.lo
else
MHD_DLL_RES_LO =
endif endif
EXTRA_libmicrohttpd_la_DEPENDENCIES = $(MHD_DLL_RES_LO)
libmicrohttpd_la_LIBADD += $(MHD_DLL_RES_LO)
if USE_COVERAGE if USE_COVERAGE
AM_CFLAGS += --coverage AM_CFLAGS += --coverage
endif endif
+14 -2
View File
@@ -1,4 +1,4 @@
/* W32 resources for .dll */ /* W32 resources */
#include <winresrc.h> #include <winresrc.h>
@@ -13,7 +13,11 @@ VS_VERSION_INFO VERSIONINFO
FILEFLAGS 0 FILEFLAGS 0
#endif #endif
FILEOS VOS_NT_WINDOWS32 FILEOS VOS_NT_WINDOWS32
#ifdef DLL_EXPORT
FILETYPE VFT_DLL FILETYPE VFT_DLL
#else
FILETYPE VFT_STATIC_LIB
#endif
FILESUBTYPE VFT2_UNKNOWN FILESUBTYPE VFT2_UNKNOWN
BEGIN BEGIN
BLOCK "StringFileInfo" BLOCK "StringFileInfo"
@@ -23,11 +27,19 @@ BEGIN
VALUE "ProductName", "GNU libmicrohttpd\0" VALUE "ProductName", "GNU libmicrohttpd\0"
VALUE "ProductVersion", "@PACKAGE_VERSION@\0" VALUE "ProductVersion", "@PACKAGE_VERSION@\0"
VALUE "FileVersion", "@PACKAGE_VERSION@\0" VALUE "FileVersion", "@PACKAGE_VERSION@\0"
#ifdef DLL_EXPORT
VALUE "FileDescription", "GNU libmicrohttpd DLL for Windows (MinGW build, @W32CRT@ run-time lib)\0" VALUE "FileDescription", "GNU libmicrohttpd DLL for Windows (MinGW build, @W32CRT@ run-time lib)\0"
#else
VALUE "FileDescription", "GNU libmicrohttpd static library for Windows (MinGW build, @W32CRT@ run-time lib)\0"
#endif
VALUE "InternalName", "libmicrohttpd\0" VALUE "InternalName", "libmicrohttpd\0"
#ifdef DLL_EXPORT
VALUE "OriginalFilename", "libmicrohttpd-@MHD_W32_DLL_SUFF@.dll\0" VALUE "OriginalFilename", "libmicrohttpd-@MHD_W32_DLL_SUFF@.dll\0"
#else
VALUE "OriginalFilename", "libmicrohttpd.lib\0"
#endif
VALUE "CompanyName", "Free Software Foundation\0" VALUE "CompanyName", "Free Software Foundation\0"
VALUE "LegalCopyright", "Copyright (C) 2007-2021 Christian Grothoff, Evgeny Grin, and project contributors\0" VALUE "LegalCopyright", "Copyright (C) 2007-2024 Christian Grothoff, Evgeny Grin, and project contributors\0"
VALUE "Comments", "http://www.gnu.org/software/libmicrohttpd/\0" VALUE "Comments", "http://www.gnu.org/software/libmicrohttpd/\0"
END END
END END