blob: 816e64d89c425bbf763fac9b2ac479a96b699f58 [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 Veillard24d87d92008-03-19 15:43:00 +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
Daniel Veillard24d87d92008-03-19 15:43:00 +000011$! your code with the command
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000012$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +000013$! $ LINK your_modules,XML_LIBDIR:LIBXML.OLB/LIBRARY
Daniel Veillard24d87d92008-03-19 15:43:00 +000014$!
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000015$! Change History
16$! --------------
17$! Command file author : John A Fotheringham (jaf@jafsoft.com)
Daniel Veillard24d87d92008-03-19 15:43:00 +000018$! Update history : 19 March 2008 Tycho Hilhorst
19$! - added module schematron.c (prevent xmllint errors)
20$! - added /DEF and /INCLUDE options to cc_opts to tell
21$! config.h is available, and where to find it
22$! : 13 October 2003 Craig Berry (craigberry@mac.com)
Daniel Veillard9339b742003-10-15 08:18:00 +000023$! more new module additions
24$! : 25 April 2003 Craig Berry (craigberry@mac.com)
Daniel Veillard1c960272003-04-25 23:12:22 +000025$! added xmlreader.c and relaxng.c to source list
26$! : 28 September 2002 Craig Berry (craigberry@mac.com)
Daniel Veillarde645e8c2002-10-22 17:35:37 +000027$! updated to work with current sources
28$! miscellaneous enhancements to build process
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000029$!
Daniel Veillardacf7ff02001-10-29 20:21:47 +000030$!- configuration -------------------------------------------------------------
31$!
32$!- compile command. If p1="nowarn" suppress the expected warning types
33$!
Daniel Veillard24d87d92008-03-19 15:43:00 +000034$ cc_opts = "/DEF=HAVE_CONFIG_H/NAMES=(SHORTENED)/FLOAT=IEEE/IEEE_MODE=DENORM_RESULTS/INCLUDE=xml_srcdir"
Daniel Veillarde645e8c2002-10-22 17:35:37 +000035$!
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000036$ if p1.eqs."DEBUG" .or. p2.eqs."DEBUG"
37$ then
38$ debug = "Y"
Daniel Veillarde645e8c2002-10-22 17:35:37 +000039$ cc_command = "CC''cc_opts'/DEBUG/NOOPTIMIZE/LIST/SHOW=ALL"
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000040$ else
41$ debug = "N"
Daniel Veillarde645e8c2002-10-22 17:35:37 +000042$ cc_command = "CC''cc_opts'"
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000043$ endif
Daniel Veillardacf7ff02001-10-29 20:21:47 +000044$!
45$!- list of sources to be built into the LIBXML library. Compare this list
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000046$! to the definition of "libxml2_la_SOURCES" in the file MAKEFILE.IN.
47$! Currently this definition includes the list WITH_TRIO_SOURCES_TRUE
Daniel Veillardacf7ff02001-10-29 20:21:47 +000048$!
Daniel Veillard4edd3ed2004-09-20 20:03:01 +000049$ sources = "SAX.c entities.c encoding.c error.c parserInternals.c"
50$ sources = sources + " parser.c tree.c hash.c list.c xmlIO.c xmlmemory.c uri.c"
51$ sources = sources + " valid.c xlink.c HTMLparser.c HTMLtree.c debugXML.c xpath.c"
52$ sources = sources + " xpointer.c xinclude.c nanohttp.c nanoftp.c DOCBparser.c"
53$ sources = sources + " catalog.c globals.c threads.c c14n.c xmlstring.c"
54$ sources = sources + " xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c"
Daniel Veillard9339b742003-10-15 08:18:00 +000055$ sources = sources + " triostr.c trio.c xmlreader.c relaxng.c dict.c SAX2.c"
Daniel Veillard4edd3ed2004-09-20 20:03:01 +000056$ sources = sources + " xmlwriter.c legacy.c chvalid.c pattern.c xmlsave.c"
Daniel Veillard24d87d92008-03-19 15:43:00 +000057$ sources = sources + " schematron.c"
Daniel Veillardacf7ff02001-10-29 20:21:47 +000058$!
59$!- list of main modules to compile and link. Compare this list to the
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000060$! definition of bin_PROGRAMS in MAKEFILE.IN
Daniel Veillardacf7ff02001-10-29 20:21:47 +000061$!
62$ bin_progs = "xmllint xmlcatalog"
63$!
64$!- list of test modules to compile and link. Compare this list to the
65$! definition of noinst_PROGRAMS in MAKEFILE.
66$!
Daniel Veillard9339b742003-10-15 08:18:00 +000067$ noinst_PROGRAMS = "testSchemas testRelax testSAX testHTML testXPath testURI " -
68 + "testThreads testC14N testAutomata testRegexp testReader"
Daniel Veillardacf7ff02001-10-29 20:21:47 +000069$!
70$!- set up build logicals -----------------------------------------------------\
71$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +000072$!
73$!- start from where the procedure is in case it's submitted in batch ----------\
74$!
75$ whoami = f$parse(f$environment("PROCEDURE"),,,,"NO_CONCEAL")
76$ procdir = f$parse(whoami,,,"DEVICE") + f$parse(whoami,,,"DIRECTORY")
77$ set default 'procdir'
78$!
79$ if f$trnlnm("XML_LIBDIR").eqs.""
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000080$ then
Daniel Veillarde645e8c2002-10-22 17:35:37 +000081$ if f$search("[-]lib.dir") .eqs. ""
82$ then
83$ create/directory/log [-.lib]
84$ endif
85$ xml_libdir = f$parse("[-.lib]",,,"DEVICE") + f$parse("[-.lib]",,,"DIRECTORY")
86$ define/process XML_LIBDIR 'xml_libdir'
87$ write sys$output "Defining XML_LIBDIR as """ + f$trnlnm("XML_LIBDIR") + """
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000088$ endif
89$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +000090$ if f$trnlnm("XML_SRCDIR").eqs.""
Daniel Veillardacf7ff02001-10-29 20:21:47 +000091$ then
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000092$ globfile = f$search("[-...]globals.c")
Daniel Veillardacf7ff02001-10-29 20:21:47 +000093$ if globfile.eqs.""
94$ then
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000095$ write sys$output "Can't locate globals.c. You need to manually define a XML_SRCDIR logical"
96$ exit
Daniel Veillardacf7ff02001-10-29 20:21:47 +000097$ else
Daniel Veillarde645e8c2002-10-22 17:35:37 +000098$ srcdir = f$parse(globfile,,,"DEVICE") + f$parse(globfile,,,"DIRECTORY")
99$ define/process XML_SRCDIR "''srcdir'"
100$ write sys$output "Defining XML_SRCDIR as ""''srcdir'"""
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000101$ endif
102$ endif
103$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000104$ copy/log config.vms xml_srcdir:config.h
105$!
Daniel Veillard24d87d92008-03-19 15:43:00 +0000106$ if f$trnlnm("libxml").eqs.""
107$ then
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000108$ globfile = f$search("[-...]globals.h")
109$ if globfile.eqs.""
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000110$ then
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000111$ write sys$output "Can't locate globals.h. You need to manually define a LIBXML logical"
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000112$ exit
113$ else
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000114$ includedir = f$parse(globfile,,,"DEVICE") + f$parse(globfile,,,"DIRECTORY")
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000115$ define/process libxml "''includedir'"
116$ write sys$output "Defining libxml as ""''includedir'"""
117$ endif
118$ endif
119$!
120$!- set up error handling (such as it is) -------------------------------------
121$!
122$ exit_status = 1
123$ saved_default = f$environment("default")
Daniel Veillard24d87d92008-03-19 15:43:00 +0000124$ on error then goto ERROR_OUT
125$ on control_y then goto ERROR_OUT
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000126$!
Daniel Veillard24d87d92008-03-19 15:43:00 +0000127$!- move to the source directory and create any necessary subdirs and the
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000128$! object library
129$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000130$ set default xml_srcdir
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000131$ if f$search("DEBUG.DIR").eqs."" then create/dir [.DEBUG]
Daniel Veillard24d87d92008-03-19 15:43:00 +0000132$ if f$search("XML_LIBDIR:LIBXML.OLB").eqs.""
133$ then
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000134$ write sys$output "Creating new object library XML_LIBDIR:LIBXML.OLB"
135$ library/create XML_LIBDIR:LIBXML.OLB
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000136$ endif
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000137$!
138$ goto start_here
139$ start_here: ! move this line to debug/rerun parts of this command file
140$!
141$!- compile modules into the library ------------------------------------------
142$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000143$ lib_command = "LIBRARY/REPLACE/LOG XML_LIBDIR:LIBXML.OLB"
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000144$ link_command = ""
145$!
146$ write sys$output ""
147$ write sys$output "Building modules into the LIBXML object library"
148$ write sys$output ""
149$!
150$ s_no = 0
151$ sources = f$edit(sources,"COMPRESS")
152$!
153$ source_loop:
154$!
155$ next_source = f$element (S_no," ",sources)
156$ if next_source.nes."" .and. next_source.nes." "
157$ then
158$!
Daniel Veillard24d87d92008-03-19 15:43:00 +0000159$ on error then goto ERROR_OUT
160$ on control_y then goto ERROR_OUT
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000161$ call build 'next_source'
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000162$ s_no = s_no + 1
163$ goto source_loop
164$!
165$ endif
166$!
167$!- now build self-test programs ----------------------------------------------
168$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000169$! these programs are built as ordinary modules into XML_LIBDIR:LIBXML.OLB. Here they
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000170$! are built a second time with /DEFINE=(STANDALONE) in which case a main()
171$! is also compiled into the module
Daniel Veillard24d87d92008-03-19 15:43:00 +0000172$
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000173$ lib_command = ""
174$ link_command = "LINK"
175$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000176$ library/compress XML_LIBDIR:LIBXML.OLB
177$ purge XML_LIBDIR:LIBXML.OLB
178$!
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000179$ write sys$output ""
180$ write sys$output "Building STANDALONE self-test programs"
181$ write sys$output ""
182$!
183$ call build NANOFTP.C /DEFINE=(STANDALONE)
184$ call build NANOHTTP.C /DEFINE=(STANDALONE)
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000185$ call build TRIONAN.C /DEFINE=(STANDALONE)
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000186$!
187$!- now build main and test programs ------------------------------------------
188$!
189$!
190$ lib_command = ""
191$ link_command = "LINK"
192$!
193$ write sys$output ""
194$ write sys$output "Building main programs and test programs"
195$ write sys$output ""
196$!
197$ p_no = 0
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000198$ all_progs = bin_progs + " " + noinst_PROGRAMS
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000199$ all_progs = f$edit(all_progs,"COMPRESS")
200$!
201$ prog_loop:
202$!
203$ next_prog = f$element (p_no," ",all_progs)
204$ if next_prog.nes."" .and. next_prog.nes." "
205$ then
206$!
Daniel Veillard24d87d92008-03-19 15:43:00 +0000207$ on error then goto ERROR_OUT
208$ on control_y then goto ERROR_OUT
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000209$ call build 'next_prog'.c
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000210$ p_no = p_no + 1
211$ goto prog_loop
212$!
213$ endif
214$!
215$!- Th-th-th-th-th-that's all folks! ------------------------------------------
216$!
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000217$ goto exit_here ! move this line to avoid parts of this command file
Daniel Veillard24d87d92008-03-19 15:43:00 +0000218$ exit_here:
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000219$!
Daniel Veillard24d87d92008-03-19 15:43:00 +0000220$ exit
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000221$ goto exit_out
222$!
223$!
224$EXIT_OUT:
225$!
226$ purge/nolog [.debug]
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000227$ set default 'saved_default
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000228$ exit 'exit_status
229$!
230$
231$ERROR_OUT:
232$ exit_status = $status
233$ write sys$output "''f$message(exit_status)'"
234$ goto EXIT_OUT
235$!
236$!- the BUILD subroutine. Compile then insert into library or link as required
237$!
238$BUILD: subroutine
239$ on warning then goto EXIT_BUILD
240$ source_file = p1
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000241$ name = f$parse(source_file,,,"NAME")
242$ object_file = f$parse("[.debug].OBJ",name,,,"SYNTAX_ONLY")
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000243$!
244$!- compile
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000245$!
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000246$ write sys$output "''cc_command'''p2'/object=''object_file' ''source_file'"
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000247$ cc_command'p2' /object='object_file 'source_file'
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000248$!
249$!- insert into library if command defined
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000250$!
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000251$ if lib_command.nes."" then lib_command 'object_file'
252$!
253$!- link module if command defined
Daniel Veillard24d87d92008-03-19 15:43:00 +0000254$ if link_command.nes.""
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000255$ then
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000256$ opts = ""
257$ if debug then opts = "/DEBUG"
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000258$ write sys$output "''link_command'''opts' ''object_file',XML_LIBDIR:libxml.olb/library"
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000259$ link_command'opts' 'object_file',-
Daniel Veillarde645e8c2002-10-22 17:35:37 +0000260 XML_LIBDIR:libxml.olb/library
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000261$ endif
262$!
263$EXIT_BUILD:
264$ exit $status
265$!
266$endsubroutine