Re: [xml] windows static for dll builds
- From: Rob Richards <rrichards ctindustries net>
- To: Igor Zlatkovic <igor zlatkovic com>
- Cc: xml gnome org
- Subject: Re: [xml] windows static for dll builds
- Date: Wed, 23 Aug 2006 07:59:00 -0400
Igor Zlatkovic wrote:
I could't care less for this static-for-dll thing and have no problems
with adding another library to the binary distribution, as long it is
built and packaged in the same breath with the others (see make bindist
target). If others are at a peace with it, I would say make a patch and
post it here.
Here's the patch for the build (only for msvc) as well as the change to
use XMLCALL for xmlDllMain.
The new lib is named libxml2_a_dll.lib
Rob
Index: threads.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/threads.c,v
retrieving revision 1.37
diff -c -r1.37 threads.c
*** threads.c 29 Jun 2006 11:50:18 -0000 1.37
--- threads.c 22 Aug 2006 21:28:51 -0000
***************
*** 829,835 ****
*/
#if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) ||
defined(LIBXML_STATIC_FOR_DLL))
#if defined(LIBXML_STATIC_FOR_DLL)
! BOOL WINAPI xmlDllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
#else
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
#endif
--- 829,835 ----
*/
#if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) ||
defined(LIBXML_STATIC_FOR_DLL))
#if defined(LIBXML_STATIC_FOR_DLL)
! BOOL XMLCALL xmlDllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
#else
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
#endif
Index: win32/Makefile.msvc
===================================================================
RCS file: /cvs/gnome/gnome-xml/win32/Makefile.msvc,v
retrieving revision 1.31
diff -c -r1.31 Makefile.msvc
*** win32/Makefile.msvc 1 Feb 2006 11:28:14 -0000 1.31
--- win32/Makefile.msvc 23 Aug 2006 10:31:27 -0000
***************
*** 25,35 ****
--- 25,37 ----
XML_IMP = $(XML_BASENAME).lib
XML_DEF = $(XML_BASENAME).def
XML_A = $(XML_BASENAME)_a.lib
+ XML_A_DLL = $(XML_BASENAME)_a_dll.lib
# Place where we let the compiler put its output.
BINDIR = bin.msvc
XML_INTDIR = int.msvc
XML_INTDIR_A = int.a.msvc
+ XML_INTDIR_A_DLL = int.a.dll.msvc
UTILS_INTDIR = int.utils.msvc
# The preprocessor and its options.
***************
*** 181,186 ****
--- 183,233 ----
$(XML_INTDIR_A)\xpointer.obj\
$(XML_INTDIR_A)\xmlstring.obj
+ # Static libxml object files.
+ XML_OBJS_A_DLL = $(XML_INTDIR_A_DLL)\c14n.obj\
+ $(XML_INTDIR_A_DLL)\catalog.obj\
+ $(XML_INTDIR_A_DLL)\chvalid.obj\
+ $(XML_INTDIR_A_DLL)\debugXML.obj\
+ $(XML_INTDIR_A_DLL)\dict.obj\
+ $(XML_INTDIR_A_DLL)\DOCBparser.obj\
+ $(XML_INTDIR_A_DLL)\encoding.obj\
+ $(XML_INTDIR_A_DLL)\entities.obj\
+ $(XML_INTDIR_A_DLL)\error.obj\
+ $(XML_INTDIR_A_DLL)\globals.obj\
+ $(XML_INTDIR_A_DLL)\hash.obj\
+ $(XML_INTDIR_A_DLL)\HTMLparser.obj\
+ $(XML_INTDIR_A_DLL)\HTMLtree.obj\
+ $(XML_INTDIR_A_DLL)\legacy.obj\
+ $(XML_INTDIR_A_DLL)\list.obj\
+ $(XML_INTDIR_A_DLL)\nanoftp.obj\
+ $(XML_INTDIR_A_DLL)\nanohttp.obj\
+ $(XML_INTDIR_A_DLL)\parser.obj\
+ $(XML_INTDIR_A_DLL)\parserInternals.obj\
+ $(XML_INTDIR_A_DLL)\pattern.obj\
+ $(XML_INTDIR_A_DLL)\relaxng.obj\
+ $(XML_INTDIR_A_DLL)\SAX2.obj\
+ $(XML_INTDIR_A_DLL)\SAX.obj\
+ $(XML_INTDIR_A_DLL)\schematron.obj\
+ $(XML_INTDIR_A_DLL)\threads.obj\
+ $(XML_INTDIR_A_DLL)\tree.obj\
+ $(XML_INTDIR_A_DLL)\uri.obj\
+ $(XML_INTDIR_A_DLL)\valid.obj\
+ $(XML_INTDIR_A_DLL)\xinclude.obj\
+ $(XML_INTDIR_A_DLL)\xlink.obj\
+ $(XML_INTDIR_A_DLL)\xmlIO.obj\
+ $(XML_INTDIR_A_DLL)\xmlmemory.obj\
+ $(XML_INTDIR_A_DLL)\xmlreader.obj\
+ $(XML_INTDIR_A_DLL)\xmlregexp.obj\
+ $(XML_INTDIR_A_DLL)\xmlmodule.obj\
+ $(XML_INTDIR_A_DLL)\xmlsave.obj\
+ $(XML_INTDIR_A_DLL)\xmlschemas.obj\
+ $(XML_INTDIR_A_DLL)\xmlschemastypes.obj\
+ $(XML_INTDIR_A_DLL)\xmlunicode.obj\
+ $(XML_INTDIR_A_DLL)\xmlwriter.obj\
+ $(XML_INTDIR_A_DLL)\xpath.obj\
+ $(XML_INTDIR_A_DLL)\xpointer.obj\
+ $(XML_INTDIR_A_DLL)\xmlstring.obj
+
# Xmllint and friends executables.
UTILS = $(BINDIR)\xmllint.exe\
$(BINDIR)\xmlcatalog.exe\
***************
*** 206,222 ****
UTILS = $(UTILS) $(BINDIR)\testThreads.exe
!endif
! all : libxml libxmla utils
libxml : $(BINDIR)\$(XML_SO)
libxmla : $(BINDIR)\$(XML_A)
utils : $(UTILS)
clean :
if exist $(XML_INTDIR) rmdir /S /Q $(XML_INTDIR)
if exist $(XML_INTDIR_A) rmdir /S /Q $(XML_INTDIR_A)
if exist $(UTILS_INTDIR) rmdir /S /Q $(UTILS_INTDIR)
if exist $(BINDIR) rmdir /S /Q $(BINDIR)
--- 253,272 ----
UTILS = $(UTILS) $(BINDIR)\testThreads.exe
!endif
! all : libxml libxmla libxmladll utils
libxml : $(BINDIR)\$(XML_SO)
libxmla : $(BINDIR)\$(XML_A)
+ libxmladll : $(BINDIR)\$(XML_A_DLL)
+
utils : $(UTILS)
clean :
if exist $(XML_INTDIR) rmdir /S /Q $(XML_INTDIR)
if exist $(XML_INTDIR_A) rmdir /S /Q $(XML_INTDIR_A)
+ if exist $(XML_INTDIR_A_DLL) rmdir /S /Q $(XML_INTDIR_A_DLL)
if exist $(UTILS_INTDIR) rmdir /S /Q $(UTILS_INTDIR)
if exist $(BINDIR) rmdir /S /Q $(BINDIR)
***************
*** 234,239 ****
--- 284,290 ----
copy $(XML_SRCDIR)\include\libxml\*.h $(INCPREFIX)\libxml
copy $(BINDIR)\$(XML_SO) $(SOPREFIX)
copy $(BINDIR)\$(XML_A) $(LIBPREFIX)
+ copy $(BINDIR)\$(XML_A_DLL) $(LIBPREFIX)
copy $(BINDIR)\$(XML_IMP) $(LIBPREFIX)
install : install-libs
***************
*** 266,271 ****
--- 317,326 ----
$(XML_INTDIR_A) :
if not exist $(XML_INTDIR_A) mkdir $(XML_INTDIR_A)
+ # Makes the static for dll libxml intermediate directory.
+ $(XML_INTDIR_A_DLL) :
+ if not exist $(XML_INTDIR_A_DLL) mkdir $(XML_INTDIR_A_DLL)
+
# An implicit rule for libxml compilation.
{$(XML_SRCDIR)}.c{$(XML_INTDIR)}.obj::
$(CC) $(CFLAGS) /Fo$(XML_INTDIR)\ /c $<
***************
*** 274,285 ****
--- 329,347 ----
{$(XML_SRCDIR)}.c{$(XML_INTDIR_A)}.obj::
$(CC) $(CFLAGS) /D "LIBXML_STATIC" /Fo$(XML_INTDIR_A)\ /c $<
+ # An implicit rule for static for dll libxml compilation.
+ {$(XML_SRCDIR)}.c{$(XML_INTDIR_A_DLL)}.obj::
+ $(CC) $(CFLAGS) /D "LIBXML_STATIC" /D "LIBXML_STATIC_FOR_DLL" /Fo$(XML_INTDIR_A_DLL)\ /c $<
+
# Compiles libxml source. Uses the implicit rule for commands.
$(XML_OBJS) : $(XML_INTDIR)
# Compiles static libxml source. Uses the implicit rule for commands.
$(XML_OBJS_A) : $(XML_INTDIR_A)
+ # Compiles static for dll libxml source. Uses the implicit rule for commands.
+ $(XML_OBJS_A_DLL) : $(XML_INTDIR_A_DLL)
+
# Creates the export definition file (DEF) for libxml.
$(XML_INTDIR)\$(XML_DEF) : $(XML_INTDIR) $(XML_DEF).src
$(CPP) $(CPPFLAGS) $(XML_DEF).src > $(XML_INTDIR)\$(XML_DEF)
***************
*** 297,302 ****
--- 359,367 ----
$(BINDIR)\$(XML_A) : $(BINDIR) $(XML_OBJS_A)
$(AR) $(ARFLAGS) /OUT:$(BINDIR)\$(XML_A) $(XML_OBJS_A)
+ # Creates the libxml static for dll archive.
+ $(BINDIR)\$(XML_A_DLL) : $(BINDIR) $(XML_OBJS_A_DLL)
+ $(AR) $(ARFLAGS) /OUT:$(BINDIR)\$(XML_A_DLL) $(XML_OBJS_A_DLL)
# Makes the utils intermediate directory.
$(UTILS_INTDIR) :
***************
*** 314,320 ****
!endif
# Builds xmllint and friends. Uses the implicit rule for commands.
! $(UTILS) : $(UTILS_INTDIR) $(BINDIR) libxml libxmla
# Source dependences should be autogenerated somehow here, but how to
# do it? I have no clue.
--- 379,385 ----
!endif
# Builds xmllint and friends. Uses the implicit rule for commands.
! $(UTILS) : $(UTILS_INTDIR) $(BINDIR) libxml libxmla libxmladll
# Source dependences should be autogenerated somehow here, but how to
# do it? I have no clue.
***************
*** 377,385 ****
del result.%%~nxI result2.%%~nxI\
) \
)
-
-
-
-
-
-
--- 442,444 ----
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]