diff --git a/win32/Makefile.msvc b/win32/Makefile.msvc new file mode 100644 index 00000000..11b76f46 --- /dev/null +++ b/win32/Makefile.msvc @@ -0,0 +1,231 @@ +# Makefile for libxml2, specific for Windows, MSVC and NMAKE. +# +# Take a look at the beginning and modify the variables to suit your +# environment. Having done that, you can do a +# +# nmake [all] to build the libxml and the accompanying utilities. +# nmake clean to remove all compiler output files and return to a +# clean state. +# nmake rebuild to rebuild everything from scratch. This basically does +# a 'nmake clean' and then a 'nmake all'. +# nmake install to install the library and its header files. +# +# March 2002, Igor Zlatkovic + +AUTOCONF = .\configure.txt + +# If you cannot run the configuration script, which would take the burden of +# editing this file from your back, then remove the following line... +!include $(AUTOCONF) +# ...and enable the following lines and adapt them to your environment. +#XML_SRCDIR = .. +#UTILS_SRCDIR = .. +#BINDIR = binaries +#LIBXML_MAJOR_VERSION = 0 # set this to the right value. +#LIBXML_MINOR_VERSION = 0 # set this to the right value. +#LIBXML_MICRO_VERSION = 0 # set this to the right value. +#WITH_TRIO = 0 +#WITH_THREADS = 0 +#WITH_FTP = 1 +#WITH_HTTP = 1 +#WITH_HTML = 1 +#WITH_C14N = 1 +#WITH_CATALOG = 1 +#WITH_DOCB = 1 +#WITH_XPATH = 1 +#WITH_XPTR = 1 +#WITH_XINCLUDE = 1 +#WITH_ICONV = 1 +#WITH_DEBUG = 1 +#WITH_MEM_DEBUG = 0 +#DEBUG = 0 +#STATIC = 0 +#PREFIX = . # set this to the right value. +#BINPREFIX = $(PREFIX)\bin +#INCPREFIX = $(PREFIX)\include +#LIBPREFIX = $(PREFIX)\lib +#SOPREFIX = $(PREFIX)\lib +#INCLUDE = $(INCLUDE);$(INCPREFIX) +#LIB = $(LIB);$(LIBPREFIX) + + +# There should never be a need to modify anything below this line. +# ---------------------------------------------------------------- + + +# Names of various input and output components. +XML_NAME = xml2 +XML_BASENAME = lib$(XML_NAME) +XML_SO = $(XML_BASENAME).dll +XML_IMP = $(XML_BASENAME).lib +XML_DEF = $(XML_BASENAME).def +XML_A = $(XML_BASENAME)_a.lib + +# Place where we let the compiler put its intermediate trash. +XML_INTDIR = $(XML_BASENAME).int +UTILS_INTDIR = utils.int + +# The preprocessor and its options. +CPP = cl.exe /EP +CPPFLAGS = /nologo /I$(XML_SRCDIR)\include + +# The compiler and its options. +CC = cl.exe +CFLAGS = /nologo /D "WIN32" /D "_WINDOWS" /D "_MBCS" /W3 /MD +CFLAGS = $(CFLAGS) /I$(XML_SRCDIR) /I$(XML_SRCDIR)\include +!if "$(WITH_THREADS)" == "1" +CFLAGS = $(CFLAGS) /D "_REENTRANT" +!endif + +# The linker and its options. +LD = link.exe +LDFLAGS = /nologo /VERSION:$(LIBXML_MAJOR_VERSION).$(LIBXML_MINOR_VERSION) +LDFLAGS = $(LDFLAGS) /LIBPATH:$(BINDIR) +LIBS = +!if "$(WITH_FTP)" == "1" || "$(WITH_HTTP)" == "1" +LIBS = $(LIBS) wsock32.lib +!endif +!if "$(WITH_ICONV)" == "1" +!if "$(STATIC)" == "1" +LIBS = $(LIBS) iconv_a.lib +!else +LIBS = $(LIBS) iconv.lib +!endif +!endif + +# The archiver and its options. +AR = lib.exe +ARFLAGS = /nologo + +# Optimisation and debug symbols. +!if "$(DEBUG)" == "1" +CFLAGS = $(CFLAGS) /D "_DEBUG" /Od /Z7 +LDFLAGS = $(LDFLAGS) /DEBUG +!else +CFLAGS = $(CFLAGS) /D "NDEBUG" /O2 +LDFLAGS = $(LDFLAGS) /OPT:NOWIN98 +!endif + +# Libxml object files. +XML_OBJS = $(XML_INTDIR)\c14n.obj\ + $(XML_INTDIR)\catalog.obj\ + $(XML_INTDIR)\debugXML.obj\ + $(XML_INTDIR)\DOCBparser.obj\ + $(XML_INTDIR)\encoding.obj\ + $(XML_INTDIR)\entities.obj\ + $(XML_INTDIR)\error.obj\ + $(XML_INTDIR)\globals.obj\ + $(XML_INTDIR)\hash.obj\ + $(XML_INTDIR)\HTMLparser.obj\ + $(XML_INTDIR)\HTMLtree.obj\ + $(XML_INTDIR)\list.obj\ + $(XML_INTDIR)\nanoftp.obj\ + $(XML_INTDIR)\nanohttp.obj\ + $(XML_INTDIR)\parser.obj\ + $(XML_INTDIR)\parserInternals.obj\ + $(XML_INTDIR)\SAX.obj\ + $(XML_INTDIR)\threads.obj\ + $(XML_INTDIR)\tree.obj\ + $(XML_INTDIR)\uri.obj\ + $(XML_INTDIR)\valid.obj\ + $(XML_INTDIR)\xinclude.obj\ + $(XML_INTDIR)\xlink.obj\ + $(XML_INTDIR)\xmlIO.obj\ + $(XML_INTDIR)\xmlmemory.obj\ + $(XML_INTDIR)\xpath.obj\ + $(XML_INTDIR)\xpointer.obj + +# Xmllint and friends executables. +UTILS = $(BINDIR)\xmllint.exe\ + $(BINDIR)\xmlcatalog.exe\ + $(BINDIR)\testC14N.exe\ + $(BINDIR)\testDocbook.exe\ + $(BINDIR)\testHTML.exe\ + $(BINDIR)\testSAX.exe\ + $(BINDIR)\testURI.exe\ + $(BINDIR)\testXPath.exe + +all : libxml utils + +libxml : $(BINDIR)\$(XML_SO) $(BINDIR)\$(XML_A) + +utils : $(UTILS) + +clean : + if exist $(XML_INTDIR) rmdir /S /Q $(XML_INTDIR) + if exist $(UTILS_INTDIR) rmdir /S /Q $(UTILS_INTDIR) + if exist $(BINDIR) rmdir /S /Q $(BINDIR) + +rebuild : clean all + +install : all + if not exist $(INCPREFIX)\libxml mkdir $(INCPREFIX)\libxml + if not exist $(BINPREFIX) mkdir $(BINPREFIX) + if not exist $(LIBPREFIX) mkdir $(LIBPREFIX) + copy $(XML_SRCDIR)\include\libxml\*.h $(INCPREFIX)\libxml + copy $(BINDIR)\$(XML_SO) $(SOPREFIX) + copy $(BINDIR)\$(XML_A) $(LIBPREFIX) + copy $(BINDIR)\$(XML_IMP) $(LIBPREFIX) + copy $(BINDIR)\*.exe $(BINPREFIX) + +# This is a target for me, to make a binary distribution. Not for the public use, +# keep your hands off :-) +BDVERSION = $(LIBXML_MAJOR_VERSION).$(LIBXML_MINOR_VERSION).$(LIBXML_MICRO_VERSION) +BDPREFIX = $(XML_BASENAME)-$(BDVERSION).win32 +bindist : all + $(MAKE) /nologo PREFIX=$(BDPREFIX) BINPREFIX=$(BDPREFIX)\util install + cscript //NoLogo configure.js genreadme $(XML_BASENAME) $(BDVERSION) $(BDPREFIX)\readme.txt + + +# Makes the output directory. +$(BINDIR) : + if not exist $(BINDIR) mkdir $(BINDIR) + + +# Makes the libxml intermediate directory. +$(XML_INTDIR) : + if not exist $(XML_INTDIR) mkdir $(XML_INTDIR) + +# An implicit rule for libxml compilation. +{$(XML_SRCDIR)}.c{$(XML_INTDIR)}.obj:: + $(CC) $(CFLAGS) /Fo$(XML_INTDIR)\ /c $< + +# Compiles libxml source. Uses the implicit rule for commands. +$(XML_OBJS) : $(XML_INTDIR) + +# 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) + +# Creates the libxml shared object. +$(BINDIR)\$(XML_SO) : $(BINDIR) $(XML_OBJS) $(XML_INTDIR)\$(XML_DEF) + $(LD) $(LDFLAGS) /DLL /DEF:$(XML_INTDIR)\$(XML_DEF) \ + /IMPLIB:$(BINDIR)\$(XML_IMP) /OUT:$(BINDIR)\$(XML_SO) $(XML_OBJS) $(LIBS) + +# Creates the libxml archive. +$(BINDIR)\$(XML_A) : $(BINDIR) $(XML_OBJS) + $(AR) $(ARFLAGS) /OUT:$(BINDIR)\$(XML_A) $(XML_OBJS) + + +# Makes the utils intermediate directory. +$(UTILS_INTDIR) : + if not exist $(UTILS_INTDIR) mkdir $(UTILS_INTDIR) + +# An implicit rule for xmllint and friends. +!if "$(STATIC)" == "1" +{$(UTILS_SRCDIR)}.c{$(BINDIR)}.exe: + $(CC) /D "LIBXML_STATIC" $(CFLAGS) /Fo$(UTILS_INTDIR)\ /c $< + $(LD) $(LDFLAGS) /OUT:$@ $(XML_A) $(LIBS) $(UTILS_INTDIR)\$( \ No newline at end of file diff --git a/win32/Readme.txt b/win32/Readme.txt new file mode 100644 index 00000000..a8006d08 --- /dev/null +++ b/win32/Readme.txt @@ -0,0 +1,129 @@ + + Windows port + ------------ + +This directory contains the files required to build this software on the +native Windows platform. + +As a rule of thumb, the root of this directory contains files needed +to build the library using the command-line tools, while various +subdirectories contain project files for various IDEs. + + + 1. Building from the command-line + ================================= + +This is the easiest, preferred and currently supported method. + +In order to build from the command-line you need to make sure that +your compiler works from the command line. This is not always the +case, often the required environment variables are missing. If you are +not sure, test if this works first. If it doesn't, you will first have +to configure your compiler suite to run from the command-line - please +refer to your compiler's documentation regarding that. + +The first thing you want to do is configure the source. You can have +the configuration script do this automatically for you. The +configuration script is written in JScript, a Microsoft's +implementation of the ECMS scripting language. Almost every Windows +machine can execute this through the Windows Scripting Host. If your +system lacks the ability to execute JScript for some reason, you must +perform the configuration manually. + +The second step is compiling the source and, optionally, installing it +to the location of your choosing. + + + 1.1 Configuring the source automatically + ---------------------------------------- + +The configuration script accepts numerous options. Some of these +affect features which will be available in the compiled software, +others affect the way the software is built and installed. To see a +full list of options supported by the configuration script, run + + cscript configure.js help + +from the win32 subdirectory. The configuration script will present you +the options it accepts and give a biref explanation of these. In every +case you will have two sets of options. The first set is specific to +the software you are building and the second one is specific to the +Windows port. + +Once you have decided which options suit you, run the script with that +options. Here is an example: + + cscript configure.js prefix=c:\opt include=c:\opt\include + lib=c:\opt\lib debug=yes + +The previous example will configure the process to install the library +in c:\opt, use c:\opt\include and c:\opt\lib as additional search +paths for the compiler and the linker and build executables with debug +symbols. + +Note: Please do not use path names which contain spaces. This will +fail. Allowing this would require me to put almost everything in the +Makefile in quotas and that looks quite ugly with my +syntax-highlighting engine. If you absolutely must use spaces in paths +send me an email and tell me why. If there are enough of you out there +who need this, or if a single one has a very good reason, I will +modify the Makefile to allow spaces in paths. + + + 1.2 (Not) Configuring the source manually + ----------------------------------------- + +The manual configuration is pretty straightforward, but I would +suggest rather to get a JScript engine and let the configure script do +it for you. This process involves editing the apropriate Makefile to +suit your needs, as well as manually generating certain *.h files from +their *.h.in sources. + +If you really have no idea what I am talking about and ask yourself +what in Gods name do I mean with '*.h files and their *.h.in sources', +then you really should do an automatic configuration. Which files must +be generated and what needs to be done with their sources in order to +generate them is something people who have built this software before +allready know. You will not find any explanations for that +here. Please configure the source manually only if you allready know +what you must do. Otherwise, you have the choice of either getting a +precompiled binary distribution, or performing the automatic +configuration. + + + 1.3 Compiling + ------------- + +After the configuration stage has been completed, you want to build +the software. To do that, type + + nmake + +in the win32 subdirectory.When the building completes, you will find +the executable files in win32\binaries directory. + +You can install the software into the directory you specified to the +configure script during the configure stage by typing + + nmake install + +That would be it, enjoy. + + + 2. Building with the IDE + ======================== + +Each supported IDE has its project files placed in a subdirectory of +win32. If you use a particular IDE, you should be able to +instinctively recognise its project files. When you have found your +favourites, load them into the IDE and do whatever you would do with +any other project files. If you are a novice and puzzled about how to +use particular project files with a particular IDE, check for a readme +file in that IDEs subdirectory. I won't discuss any particular IDE +here, because I would like to keep this document as general as +possible, and there is also a chance that support exists for IDEs +which I have never seen. + + +March 2002, Igor Zlatkovic + diff --git a/win32/configure.js b/win32/configure.js new file mode 100644 index 00000000..59bdeef5 --- /dev/null +++ b/win32/configure.js @@ -0,0 +1,399 @@ +/* Configure script for libxml, specific for Windows with Scripting Host. + * + * This script will configure the libxml build process and create necessary files. + * Run it with an 'help', or an invalid option and it will tell you what options + * it accepts. + * + * March 2002, Igor Zlatkovic + */ + +/* The source directory, relative to the one where this file resides. */ +var srcDirXml = ".."; +var srcDirUtils = ".."; +/* The directory where we put the binaries after compilation. */ +var binDir = "binaries"; +/* Base name of what we are building. */ +var baseName = "libxml2"; +/* Configure file which contains the version and the output file where + we can store our build configuration. */ +var configFile = srcDirXml + "\\configure.in"; +var versionFile = ".\\configure.txt"; +/* Input and output files regarding the libxml features. The second + output file is there for the compatibility reasons, otherwise it + is identical to the first. */ +var optsFileIn = srcDirXml + "\\include\\libxml\\xmlversion.h.in"; +var optsFile = srcDirXml + "\\include\\libxml\\xmlversion.h"; +var optsFile2 = srcDirXml + "\\include\\libxml\\xmlwin32version.h"; +/* Version strings for the binary distribution. Will be filled later + in the code. */ +var verMajor; +var verMinor; +var verMicro; +/* Libxml features. */ +var withTrio = false; +var withThreads = false; +var withFtp = true; +var withHttp = true; +var withHtml = true; +var withC14n = true; +var withCatalog = true; +var withDocb = true; +var withXpath = true; +var withXptr = true; +var withXinclude = true; +var withIconv = true; +var withDebug = true; +var withMemDebug = false; +/* Win32 build options. */ +var buildDebug = 0; +var buildStatic = 0; +var buildPrefix = "."; +var buildBinPrefix = "$(PREFIX)\\bin"; +var buildIncPrefix = "$(PREFIX)\\include"; +var buildLibPrefix = "$(PREFIX)\\lib"; +var buildSoPrefix = "$(PREFIX)\\lib"; +var buildInclude = "."; +var buildLib = "."; +/* Local stuff */ +var error = 0; + +/* Helper function, transforms the option variable into the 'Enabled' + or 'Disabled' string. */ +function boolToStr(opt) +{ + if (opt == false) + return "Disabled"; + else if (opt == true) + return "Enabled"; + error = 1; + return "Undefined"; +} + +/* Helper function, transforms the argument string into a boolean + value. */ +function strToBool(opt) +{ + if (opt == 0 || opt == "no") + return false; + else if (opt == 1 || opt == "yes") + return true; + error = 1; + return false; +} + +/* Displays the details about how to use this script. */ +function usage() +{ + var txt; + txt = "Usage:\n"; + txt += " cscript " + WScript.ScriptName + " \n"; + txt += " cscript " + WScript.ScriptName + " help\n\n"; + txt += "Options can be specified in the form