blob: f09f726bd8c1400f81f46d367439a51341ef116b [file] [log] [blame]
Daniel Veillardacf7ff02001-10-29 20:21:47 +00001$! BUILD_LIBXML.COM
2$!
Daniel Veillardd33cfbf2001-11-13 15:24:36 +00003$! Build the LIBXML library
Daniel Veillardacf7ff02001-10-29 20:21:47 +00004$!
Daniel Veillardd33cfbf2001-11-13 15:24:36 +00005$! Arguments:
6$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +00007$! "DEBUG" - build everything in debug
Daniel Veillardd33cfbf2001-11-13 15:24:36 +00008$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +00009$! This procedure creates an object library XML_LIBDIR:LIBXML.OLB directory.
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000010$! After the library is built, you can link LIBXML routines into
11$! your code with the command
12$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +000013$! $ LINK your_modules,XML_LIBDIR:LIBXML.OLB/LIBRARY
Daniel Veillardacf7ff02001-10-29 20:21:47 +000014$!
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000015$! Change History
16$! --------------
17$! Command file author : John A Fotheringham (jaf@jafsoft.com)
Daniel Veillard1c960272003-04-25 23:12:22 +000018$! Update history : 25 April 2003 Craig Berry (craigberry@mac.com)
19$! added xmlreader.c and relaxng.c to source list
20$! : 28 September 2002 Craig Berry (craigberry@mac.com)
Daniel Veillarde645e8c2002-10-22 17:35:37 +000021$! updated to work with current sources
22$! miscellaneous enhancements to build process
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000023$!
Daniel Veillardacf7ff02001-10-29 20:21:47 +000024$!- configuration -------------------------------------------------------------
25$!
26$!- compile command. If p1="nowarn" suppress the expected warning types
27$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +000028$ cc_opts = "/NAMES=(SHORTENED)/FLOAT=IEEE/IEEE_MODE=DENORM_RESULTS"
29$!
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000030$ if p1.eqs."DEBUG" .or. p2.eqs."DEBUG"
31$ then
32$ debug = "Y"
Daniel Veillarde645e8c2002-10-22 17:35:37 +000033$ cc_command = "CC''cc_opts'/DEBUG/NOOPTIMIZE/LIST/SHOW=ALL"
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000034$ else
35$ debug = "N"
Daniel Veillarde645e8c2002-10-22 17:35:37 +000036$ cc_command = "CC''cc_opts'"
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000037$ endif
Daniel Veillardacf7ff02001-10-29 20:21:47 +000038$!
39$!- list of sources to be built into the LIBXML library. Compare this list
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000040$! to the definition of "libxml2_la_SOURCES" in the file MAKEFILE.IN.
41$! Currently this definition includes the list WITH_TRIO_SOURCES_TRUE
Daniel Veillardacf7ff02001-10-29 20:21:47 +000042$!
43$ sources = "SAX.c entities.c encoding.c error.c parserInternals.c parser.c"
44$ sources = sources + " tree.c hash.c list.c xmlIO.c xmlmemory.c uri.c valid.c"
45$ sources = sources + " xlink.c HTMLparser.c HTMLtree.c debugXML.c xpath.c "
46$ sources = sources + " xpointer.c xinclude.c nanohttp.c nanoftp.c "
Daniel Veillarde645e8c2002-10-22 17:35:37 +000047$ sources = sources + " DOCBparser.c catalog.c globals.c threads.c c14n.c "
48$ sources = sources + " xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c "
Daniel Veillard1c960272003-04-25 23:12:22 +000049$ sources = sources + " triostr.c trio.c xmlreader.c relaxng.c"
Daniel Veillardacf7ff02001-10-29 20:21:47 +000050$!
51$!- list of main modules to compile and link. Compare this list to the
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000052$! definition of bin_PROGRAMS in MAKEFILE.IN
Daniel Veillardacf7ff02001-10-29 20:21:47 +000053$!
54$ bin_progs = "xmllint xmlcatalog"
55$!
56$!- list of test modules to compile and link. Compare this list to the
57$! definition of noinst_PROGRAMS in MAKEFILE.
58$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +000059$ noinst_PROGRAMS = "testSchemas testSAX testHTML testXPath testURI testDocbook " -
60 + "testThreads testC14N testAutomata testRegexp"
Daniel Veillardacf7ff02001-10-29 20:21:47 +000061$!
62$!- set up build logicals -----------------------------------------------------\
63$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +000064$!
65$!- start from where the procedure is in case it's submitted in batch ----------\
66$!
67$ whoami = f$parse(f$environment("PROCEDURE"),,,,"NO_CONCEAL")
68$ procdir = f$parse(whoami,,,"DEVICE") + f$parse(whoami,,,"DIRECTORY")
69$ set default 'procdir'
70$!
71$ if f$trnlnm("XML_LIBDIR").eqs.""
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000072$ then
Daniel Veillarde645e8c2002-10-22 17:35:37 +000073$ if f$search("[-]lib.dir") .eqs. ""
74$ then
75$ create/directory/log [-.lib]
76$ endif
77$ xml_libdir = f$parse("[-.lib]",,,"DEVICE") + f$parse("[-.lib]",,,"DIRECTORY")
78$ define/process XML_LIBDIR 'xml_libdir'
79$ write sys$output "Defining XML_LIBDIR as """ + f$trnlnm("XML_LIBDIR") + """
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000080$ endif
81$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +000082$ if f$trnlnm("XML_SRCDIR").eqs.""
Daniel Veillardacf7ff02001-10-29 20:21:47 +000083$ then
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000084$ globfile = f$search("[-...]globals.c")
Daniel Veillardacf7ff02001-10-29 20:21:47 +000085$ if globfile.eqs.""
86$ then
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000087$ write sys$output "Can't locate globals.c. You need to manually define a XML_SRCDIR logical"
88$ exit
Daniel Veillardacf7ff02001-10-29 20:21:47 +000089$ else
Daniel Veillarde645e8c2002-10-22 17:35:37 +000090$ srcdir = f$parse(globfile,,,"DEVICE") + f$parse(globfile,,,"DIRECTORY")
91$ define/process XML_SRCDIR "''srcdir'"
92$ write sys$output "Defining XML_SRCDIR as ""''srcdir'"""
Daniel Veillardacf7ff02001-10-29 20:21:47 +000093$ endif
94$ endif
95$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +000096$ copy/log config.vms xml_srcdir:config.h
97$!
Daniel Veillardacf7ff02001-10-29 20:21:47 +000098$ if f$trnlnm("libxml").eqs.""
99$ then
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000100$ globfile = f$search("[-...]globals.h")
101$ if globfile.eqs.""
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000102$ then
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000103$ write sys$output "Can't locate globals.h. You need to manually define a LIBXML logical"
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000104$ exit
105$ else
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000106$ includedir = f$parse(globfile,,,"DEVICE") + f$parse(globfile,,,"DIRECTORY")
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000107$ define/process libxml "''includedir'"
108$ write sys$output "Defining libxml as ""''includedir'"""
109$ endif
110$ endif
111$!
112$!- set up error handling (such as it is) -------------------------------------
113$!
114$ exit_status = 1
115$ saved_default = f$environment("default")
116$ on error then goto ERROR_OUT
117$ on control_y then goto ERROR_OUT
118$!
119$!- move to the source directory and create any necessary subdirs and the
120$! object library
121$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000122$ set default xml_srcdir
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000123$ if f$search("DEBUG.DIR").eqs."" then create/dir [.DEBUG]
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000124$ if f$search("XML_LIBDIR:LIBXML.OLB").eqs.""
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000125$ then
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000126$ write sys$output "Creating new object library XML_LIBDIR:LIBXML.OLB"
127$ library/create XML_LIBDIR:LIBXML.OLB
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000128$ endif
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000129$!
130$ goto start_here
131$ start_here: ! move this line to debug/rerun parts of this command file
132$!
133$!- compile modules into the library ------------------------------------------
134$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000135$ lib_command = "LIBRARY/REPLACE/LOG XML_LIBDIR:LIBXML.OLB"
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000136$ link_command = ""
137$!
138$ write sys$output ""
139$ write sys$output "Building modules into the LIBXML object library"
140$ write sys$output ""
141$!
142$ s_no = 0
143$ sources = f$edit(sources,"COMPRESS")
144$!
145$ source_loop:
146$!
147$ next_source = f$element (S_no," ",sources)
148$ if next_source.nes."" .and. next_source.nes." "
149$ then
150$!
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000151$ on error then goto ERROR_OUT
152$ on control_y then goto ERROR_OUT
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000153$ call build 'next_source'
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000154$ s_no = s_no + 1
155$ goto source_loop
156$!
157$ endif
158$!
159$!- now build self-test programs ----------------------------------------------
160$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000161$! these programs are built as ordinary modules into XML_LIBDIR:LIBXML.OLB. Here they
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000162$! are built a second time with /DEFINE=(STANDALONE) in which case a main()
163$! is also compiled into the module
164$
165$ lib_command = ""
166$ link_command = "LINK"
167$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000168$ library/compress XML_LIBDIR:LIBXML.OLB
169$ purge XML_LIBDIR:LIBXML.OLB
170$!
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000171$ write sys$output ""
172$ write sys$output "Building STANDALONE self-test programs"
173$ write sys$output ""
174$!
175$ call build NANOFTP.C /DEFINE=(STANDALONE)
176$ call build NANOHTTP.C /DEFINE=(STANDALONE)
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000177$ call build TRIONAN.C /DEFINE=(STANDALONE)
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000178$!
179$!- now build main and test programs ------------------------------------------
180$!
181$!
182$ lib_command = ""
183$ link_command = "LINK"
184$!
185$ write sys$output ""
186$ write sys$output "Building main programs and test programs"
187$ write sys$output ""
188$!
189$ p_no = 0
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000190$ all_progs = bin_progs + " " + noinst_PROGRAMS
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000191$ all_progs = f$edit(all_progs,"COMPRESS")
192$!
193$ prog_loop:
194$!
195$ next_prog = f$element (p_no," ",all_progs)
196$ if next_prog.nes."" .and. next_prog.nes." "
197$ then
198$!
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000199$ on error then goto ERROR_OUT
200$ on control_y then goto ERROR_OUT
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000201$ call build 'next_prog'.c
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000202$ p_no = p_no + 1
203$ goto prog_loop
204$!
205$ endif
206$!
207$!- Th-th-th-th-th-that's all folks! ------------------------------------------
208$!
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000209$ goto exit_here ! move this line to avoid parts of this command file
210$ exit_here:
211$!
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000212$ exit
213$ goto exit_out
214$!
215$!
216$EXIT_OUT:
217$!
218$ purge/nolog [.debug]
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000219$ set default 'saved_default
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000220$ exit 'exit_status
221$!
222$
223$ERROR_OUT:
224$ exit_status = $status
225$ write sys$output "''f$message(exit_status)'"
226$ goto EXIT_OUT
227$!
228$!- the BUILD subroutine. Compile then insert into library or link as required
229$!
230$BUILD: subroutine
231$ on warning then goto EXIT_BUILD
232$ source_file = p1
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000233$ name = f$parse(source_file,,,"NAME")
234$ object_file = f$parse("[.debug].OBJ",name,,,"SYNTAX_ONLY")
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000235$!
236$!- compile
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000237$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000238$ write sys$output "''cc_command'''p2'/object=''object_file' ''source_file'"
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000239$ cc_command'p2' /object='object_file 'source_file'
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000240$!
241$!- insert into library if command defined
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000242$!
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000243$ if lib_command.nes."" then lib_command 'object_file'
244$!
245$!- link module if command defined
246$ if link_command.nes.""
247$ then
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000248$ opts = ""
249$ if debug then opts = "/DEBUG"
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000250$ write sys$output "''link_command'''opts' ''object_file',XML_LIBDIR:libxml.olb/library"
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000251$ link_command'opts' 'object_file',-
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000252 XML_LIBDIR:libxml.olb/library
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000253$ endif
254$!
255$EXIT_BUILD:
256$ exit $status
257$!
258$endsubroutine