blob: 323c36fe40e7d7dccb9110fbd792c02829e807ec [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 Veillard9339b742003-10-15 08:18:00 +000018$! Update history : 13 October 2003 Craig Berry (craigberry@mac.com)
19$! more new module additions
20$! : 25 April 2003 Craig Berry (craigberry@mac.com)
Daniel Veillard1c960272003-04-25 23:12:22 +000021$! added xmlreader.c and relaxng.c to source list
22$! : 28 September 2002 Craig Berry (craigberry@mac.com)
Daniel Veillarde645e8c2002-10-22 17:35:37 +000023$! updated to work with current sources
24$! miscellaneous enhancements to build process
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000025$!
Daniel Veillardacf7ff02001-10-29 20:21:47 +000026$!- configuration -------------------------------------------------------------
27$!
28$!- compile command. If p1="nowarn" suppress the expected warning types
29$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +000030$ cc_opts = "/NAMES=(SHORTENED)/FLOAT=IEEE/IEEE_MODE=DENORM_RESULTS"
31$!
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000032$ if p1.eqs."DEBUG" .or. p2.eqs."DEBUG"
33$ then
34$ debug = "Y"
Daniel Veillarde645e8c2002-10-22 17:35:37 +000035$ cc_command = "CC''cc_opts'/DEBUG/NOOPTIMIZE/LIST/SHOW=ALL"
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000036$ else
37$ debug = "N"
Daniel Veillarde645e8c2002-10-22 17:35:37 +000038$ cc_command = "CC''cc_opts'"
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000039$ endif
Daniel Veillardacf7ff02001-10-29 20:21:47 +000040$!
41$!- list of sources to be built into the LIBXML library. Compare this list
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000042$! to the definition of "libxml2_la_SOURCES" in the file MAKEFILE.IN.
43$! Currently this definition includes the list WITH_TRIO_SOURCES_TRUE
Daniel Veillardacf7ff02001-10-29 20:21:47 +000044$!
45$ sources = "SAX.c entities.c encoding.c error.c parserInternals.c parser.c"
46$ sources = sources + " tree.c hash.c list.c xmlIO.c xmlmemory.c uri.c valid.c"
47$ sources = sources + " xlink.c HTMLparser.c HTMLtree.c debugXML.c xpath.c "
48$ sources = sources + " xpointer.c xinclude.c nanohttp.c nanoftp.c "
Daniel Veillarde645e8c2002-10-22 17:35:37 +000049$ sources = sources + " DOCBparser.c catalog.c globals.c threads.c c14n.c "
50$ sources = sources + " xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c "
Daniel Veillard9339b742003-10-15 08:18:00 +000051$ sources = sources + " triostr.c trio.c xmlreader.c relaxng.c dict.c SAX2.c"
52$ sources = sources + " legacy.c xmldwalk.c chvalid.c"
Daniel Veillardacf7ff02001-10-29 20:21:47 +000053$!
54$!- list of main modules to compile and link. Compare this list to the
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000055$! definition of bin_PROGRAMS in MAKEFILE.IN
Daniel Veillardacf7ff02001-10-29 20:21:47 +000056$!
57$ bin_progs = "xmllint xmlcatalog"
58$!
59$!- list of test modules to compile and link. Compare this list to the
60$! definition of noinst_PROGRAMS in MAKEFILE.
61$!
Daniel Veillard9339b742003-10-15 08:18:00 +000062$ noinst_PROGRAMS = "testSchemas testRelax testSAX testHTML testXPath testURI " -
63 + "testThreads testC14N testAutomata testRegexp testReader"
Daniel Veillardacf7ff02001-10-29 20:21:47 +000064$!
65$!- set up build logicals -----------------------------------------------------\
66$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +000067$!
68$!- start from where the procedure is in case it's submitted in batch ----------\
69$!
70$ whoami = f$parse(f$environment("PROCEDURE"),,,,"NO_CONCEAL")
71$ procdir = f$parse(whoami,,,"DEVICE") + f$parse(whoami,,,"DIRECTORY")
72$ set default 'procdir'
73$!
74$ if f$trnlnm("XML_LIBDIR").eqs.""
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000075$ then
Daniel Veillarde645e8c2002-10-22 17:35:37 +000076$ if f$search("[-]lib.dir") .eqs. ""
77$ then
78$ create/directory/log [-.lib]
79$ endif
80$ xml_libdir = f$parse("[-.lib]",,,"DEVICE") + f$parse("[-.lib]",,,"DIRECTORY")
81$ define/process XML_LIBDIR 'xml_libdir'
82$ write sys$output "Defining XML_LIBDIR as """ + f$trnlnm("XML_LIBDIR") + """
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000083$ endif
84$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +000085$ if f$trnlnm("XML_SRCDIR").eqs.""
Daniel Veillardacf7ff02001-10-29 20:21:47 +000086$ then
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000087$ globfile = f$search("[-...]globals.c")
Daniel Veillardacf7ff02001-10-29 20:21:47 +000088$ if globfile.eqs.""
89$ then
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000090$ write sys$output "Can't locate globals.c. You need to manually define a XML_SRCDIR logical"
91$ exit
Daniel Veillardacf7ff02001-10-29 20:21:47 +000092$ else
Daniel Veillarde645e8c2002-10-22 17:35:37 +000093$ srcdir = f$parse(globfile,,,"DEVICE") + f$parse(globfile,,,"DIRECTORY")
94$ define/process XML_SRCDIR "''srcdir'"
95$ write sys$output "Defining XML_SRCDIR as ""''srcdir'"""
Daniel Veillardacf7ff02001-10-29 20:21:47 +000096$ endif
97$ endif
98$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +000099$ copy/log config.vms xml_srcdir:config.h
100$!
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000101$ if f$trnlnm("libxml").eqs.""
102$ then
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000103$ globfile = f$search("[-...]globals.h")
104$ if globfile.eqs.""
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000105$ then
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000106$ write sys$output "Can't locate globals.h. You need to manually define a LIBXML logical"
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000107$ exit
108$ else
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000109$ includedir = f$parse(globfile,,,"DEVICE") + f$parse(globfile,,,"DIRECTORY")
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000110$ define/process libxml "''includedir'"
111$ write sys$output "Defining libxml as ""''includedir'"""
112$ endif
113$ endif
114$!
115$!- set up error handling (such as it is) -------------------------------------
116$!
117$ exit_status = 1
118$ saved_default = f$environment("default")
119$ on error then goto ERROR_OUT
120$ on control_y then goto ERROR_OUT
121$!
122$!- move to the source directory and create any necessary subdirs and the
123$! object library
124$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000125$ set default xml_srcdir
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000126$ if f$search("DEBUG.DIR").eqs."" then create/dir [.DEBUG]
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000127$ if f$search("XML_LIBDIR:LIBXML.OLB").eqs.""
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000128$ then
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000129$ write sys$output "Creating new object library XML_LIBDIR:LIBXML.OLB"
130$ library/create XML_LIBDIR:LIBXML.OLB
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000131$ endif
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000132$!
133$ goto start_here
134$ start_here: ! move this line to debug/rerun parts of this command file
135$!
136$!- compile modules into the library ------------------------------------------
137$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000138$ lib_command = "LIBRARY/REPLACE/LOG XML_LIBDIR:LIBXML.OLB"
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000139$ link_command = ""
140$!
141$ write sys$output ""
142$ write sys$output "Building modules into the LIBXML object library"
143$ write sys$output ""
144$!
145$ s_no = 0
146$ sources = f$edit(sources,"COMPRESS")
147$!
148$ source_loop:
149$!
150$ next_source = f$element (S_no," ",sources)
151$ if next_source.nes."" .and. next_source.nes." "
152$ then
153$!
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000154$ on error then goto ERROR_OUT
155$ on control_y then goto ERROR_OUT
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000156$ call build 'next_source'
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000157$ s_no = s_no + 1
158$ goto source_loop
159$!
160$ endif
161$!
162$!- now build self-test programs ----------------------------------------------
163$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000164$! these programs are built as ordinary modules into XML_LIBDIR:LIBXML.OLB. Here they
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000165$! are built a second time with /DEFINE=(STANDALONE) in which case a main()
166$! is also compiled into the module
167$
168$ lib_command = ""
169$ link_command = "LINK"
170$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000171$ library/compress XML_LIBDIR:LIBXML.OLB
172$ purge XML_LIBDIR:LIBXML.OLB
173$!
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000174$ write sys$output ""
175$ write sys$output "Building STANDALONE self-test programs"
176$ write sys$output ""
177$!
178$ call build NANOFTP.C /DEFINE=(STANDALONE)
179$ call build NANOHTTP.C /DEFINE=(STANDALONE)
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000180$ call build TRIONAN.C /DEFINE=(STANDALONE)
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000181$!
182$!- now build main and test programs ------------------------------------------
183$!
184$!
185$ lib_command = ""
186$ link_command = "LINK"
187$!
188$ write sys$output ""
189$ write sys$output "Building main programs and test programs"
190$ write sys$output ""
191$!
192$ p_no = 0
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000193$ all_progs = bin_progs + " " + noinst_PROGRAMS
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000194$ all_progs = f$edit(all_progs,"COMPRESS")
195$!
196$ prog_loop:
197$!
198$ next_prog = f$element (p_no," ",all_progs)
199$ if next_prog.nes."" .and. next_prog.nes." "
200$ then
201$!
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000202$ on error then goto ERROR_OUT
203$ on control_y then goto ERROR_OUT
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000204$ call build 'next_prog'.c
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000205$ p_no = p_no + 1
206$ goto prog_loop
207$!
208$ endif
209$!
210$!- Th-th-th-th-th-that's all folks! ------------------------------------------
211$!
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000212$ goto exit_here ! move this line to avoid parts of this command file
213$ exit_here:
214$!
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000215$ exit
216$ goto exit_out
217$!
218$!
219$EXIT_OUT:
220$!
221$ purge/nolog [.debug]
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000222$ set default 'saved_default
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000223$ exit 'exit_status
224$!
225$
226$ERROR_OUT:
227$ exit_status = $status
228$ write sys$output "''f$message(exit_status)'"
229$ goto EXIT_OUT
230$!
231$!- the BUILD subroutine. Compile then insert into library or link as required
232$!
233$BUILD: subroutine
234$ on warning then goto EXIT_BUILD
235$ source_file = p1
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000236$ name = f$parse(source_file,,,"NAME")
237$ object_file = f$parse("[.debug].OBJ",name,,,"SYNTAX_ONLY")
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000238$!
239$!- compile
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000240$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000241$ write sys$output "''cc_command'''p2'/object=''object_file' ''source_file'"
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000242$ cc_command'p2' /object='object_file 'source_file'
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000243$!
244$!- insert into library if command defined
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000245$!
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000246$ if lib_command.nes."" then lib_command 'object_file'
247$!
248$!- link module if command defined
249$ if link_command.nes.""
250$ then
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000251$ opts = ""
252$ if debug then opts = "/DEBUG"
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000253$ write sys$output "''link_command'''opts' ''object_file',XML_LIBDIR:libxml.olb/library"
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000254$ link_command'opts' 'object_file',-
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000255 XML_LIBDIR:libxml.olb/library
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000256$ endif
257$!
258$EXIT_BUILD:
259$ exit $status
260$!
261$endsubroutine