blob: 57a46e4c36298609254175d37069848d37506c5d [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$!
7$! "NOWARN" - suppress known/expected warnings
8$! "DEBUG" - build everythign in debug
9$!
10$! This procedure creates an object library XMLOLB:LIBXML.OLB directory.
11$! After the library is built, you can link LIBXML routines into
12$! your code with the command
13$!
14$! $ LINK your_modules,XMLOLB:LIBXML.OLB/LIBRARY
Daniel Veillardacf7ff02001-10-29 20:21:47 +000015$!
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000016$! Change History
17$! --------------
18$! Command file author : John A Fotheringham (jaf@jafsoft.com)
19$! Last update : 2 Nov 2001
20$!
Daniel Veillardacf7ff02001-10-29 20:21:47 +000021$!- configuration -------------------------------------------------------------
22$!
23$!- compile command. If p1="nowarn" suppress the expected warning types
24$!
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000025$ if p1.eqs."DEBUG" .or. p2.eqs."DEBUG"
26$ then
27$ debug = "Y"
28$ cc_command = "CC/DEBUG/NOOPT"
29$ else
30$ debug = "N"
31$ cc_command = "CC"
32$ endif
Daniel Veillardacf7ff02001-10-29 20:21:47 +000033$ if p1.eqs."NOWARN" then -
34 cc_command = cc_command + "/WARN=DISABLE=(FLOATOVERFL,NOMAINUFLO)"
35$!
36$!- list of sources to be built into the LIBXML library. Compare this list
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000037$! to the definition of "libxml2_la_SOURCES" in the file MAKEFILE.IN.
38$! Currently this definition includes the list WITH_TRIO_SOURCES_TRUE
Daniel Veillardacf7ff02001-10-29 20:21:47 +000039$!
40$ sources = "SAX.c entities.c encoding.c error.c parserInternals.c parser.c"
41$ sources = sources + " tree.c hash.c list.c xmlIO.c xmlmemory.c uri.c valid.c"
42$ sources = sources + " xlink.c HTMLparser.c HTMLtree.c debugXML.c xpath.c "
43$ sources = sources + " xpointer.c xinclude.c nanohttp.c nanoftp.c "
44$ sources = sources + " DOCBparser.c catalog.c globals.c threads.c"
Daniel Veillardacf7ff02001-10-29 20:21:47 +000045$ sources = sources + " trio.c strio.c"
46$!
47$!- list of main modules to compile and link. Compare this list to the
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000048$! definition of bin_PROGRAMS in MAKEFILE.IN
Daniel Veillardacf7ff02001-10-29 20:21:47 +000049$!
50$ bin_progs = "xmllint xmlcatalog"
51$!
52$!- list of test modules to compile and link. Compare this list to the
53$! definition of noinst_PROGRAMS in MAKEFILE.
54$!
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000055$ test_progs = "testSAX testHTML testXPath testURI testDocbook testThreads"
Daniel Veillardacf7ff02001-10-29 20:21:47 +000056$!
57$!- set up build logicals -----------------------------------------------------\
58$!
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000059$ if f$trnlnm("XMLOLB").eqs.""
60$ then
61$ write sys$output ""
62$ write sys$output " You need to define a XMLOLB logical directory to"
63$ write sys$output " point to the directory containing your CMS object"
64$ write sys$output " libraries. This should already contain LIBXML.OLB"
65$ write sys$output " from the libxml package, and will be the directory"
66$ write sys$output " the new LIBXSLT.OLB library will be placed in"
67$ write sys$output ""
68$ exit
69$ endif
70$!
Daniel Veillardacf7ff02001-10-29 20:21:47 +000071$ if f$trnlnm("xml_srcdir").eqs.""
72$ then
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000073$ globfile = f$search("[-...]globals.c")
Daniel Veillardacf7ff02001-10-29 20:21:47 +000074$ if globfile.eqs.""
75$ then
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000076$ write sys$output "Can't locate globals.c. You need to manually define a XML_SRCDIR logical"
77$ exit
Daniel Veillardacf7ff02001-10-29 20:21:47 +000078$ else
79$ srcdir = f$element(0,"]",globfile)+ "]"
80$ define/process xml_srcdir "''srcdir'"
81$ write sys$output "Defining xml_srcdir as ""''srcdir'"""
82$ endif
83$ endif
84$!
85$ if f$trnlnm("libxml").eqs.""
86$ then
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000087$ globfile = f$search("[-...]globals.h")
88$ if globfile.eqs.""
Daniel Veillardacf7ff02001-10-29 20:21:47 +000089$ then
Daniel Veillardd33cfbf2001-11-13 15:24:36 +000090$ write sys$output "Can't locate globals.h. You need to manually define a LIBXML logical"
Daniel Veillardacf7ff02001-10-29 20:21:47 +000091$ exit
92$ else
93$ includedir = f$element(0,"]",globfile)+ "]"
94$ define/process libxml "''includedir'"
95$ write sys$output "Defining libxml as ""''includedir'"""
96$ endif
97$ endif
98$!
99$!- set up error handling (such as it is) -------------------------------------
100$!
101$ exit_status = 1
102$ saved_default = f$environment("default")
103$ on error then goto ERROR_OUT
104$ on control_y then goto ERROR_OUT
105$!
106$!- move to the source directory and create any necessary subdirs and the
107$! object library
108$!
109$ set def xml_srcdir
110$ if f$search("DEBUG.DIR").eqs."" then create/dir [.DEBUG]
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000111$ if f$search("XMLOLB:LIBXML.OLB").eqs.""
112$ then
113$ write sys$output "Creating new object library XMLOLB:LIBXML.OLB"
114$ library/create XMLOLB:LIBXML.OLB
115$ endif
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000116$!
117$ goto start_here
118$ start_here: ! move this line to debug/rerun parts of this command file
119$!
120$!- compile modules into the library ------------------------------------------
121$!
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000122$ lib_command = "LIBRARY/REPLACE XMLOLB:LIBXML.OLB"
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000123$ link_command = ""
124$!
125$ write sys$output ""
126$ write sys$output "Building modules into the LIBXML object library"
127$ write sys$output ""
128$!
129$ s_no = 0
130$ sources = f$edit(sources,"COMPRESS")
131$!
132$ source_loop:
133$!
134$ next_source = f$element (S_no," ",sources)
135$ if next_source.nes."" .and. next_source.nes." "
136$ then
137$!
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000138$ on error then goto ERROR_OUT
139$ on control_y then goto ERROR_OUT
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000140$ if next_source.eqs."xpath.c"
141$ then
142$ call build 'next_source' /IEEE_MODE=UNDERFLOW_TO_ZERO/FLOAT=IEEE
143$ else
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000144$ if next_source.eqs."trio.c"
145$ then
146$ call build 'next_source' /WARN=DISABLE=UNINIT1
147$ else
148$ call build 'next_source'
149$ endif
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000150$ endif
151$ s_no = s_no + 1
152$ goto source_loop
153$!
154$ endif
155$!
156$!- now build self-test programs ----------------------------------------------
157$!
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000158$! these pograms are built as ordinary modules into XMLOLB:LIBXML.OLB. Here they
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000159$! are built a second time with /DEFINE=(STANDALONE) in which case a main()
160$! is also compiled into the module
161$
162$ lib_command = ""
163$ link_command = "LINK"
164$!
165$ write sys$output ""
166$ write sys$output "Building STANDALONE self-test programs"
167$ write sys$output ""
168$!
169$ call build NANOFTP.C /DEFINE=(STANDALONE)
170$ call build NANOHTTP.C /DEFINE=(STANDALONE)
171$ call build TRIONAN.C /DEFINE=(STANDALONE)/IEEE_MODE=UNDERFLOW_TO_ZERO/FLOAT=IEEE
172$!
173$!- now build main and test programs ------------------------------------------
174$!
175$!
176$ lib_command = ""
177$ link_command = "LINK"
178$!
179$ write sys$output ""
180$ write sys$output "Building main programs and test programs"
181$ write sys$output ""
182$!
183$ p_no = 0
184$ all_progs = bin_progs + " " + test_progs
185$ all_progs = f$edit(all_progs,"COMPRESS")
186$!
187$ prog_loop:
188$!
189$ next_prog = f$element (p_no," ",all_progs)
190$ if next_prog.nes."" .and. next_prog.nes." "
191$ then
192$!
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000193$ on error then goto ERROR_OUT
194$ on control_y then goto ERROR_OUT
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000195$ call build 'next_prog'.c /IEEE_MODE=UNDERFLOW_TO_ZERO/FLOAT=IEEE
196$ p_no = p_no + 1
197$ goto prog_loop
198$!
199$ endif
200$!
201$!- Th-th-th-th-th-that's all folks! ------------------------------------------
202$!
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000203$ goto exit_here ! move this line to avoid parts of this command file
204$ exit_here:
205$!
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000206$ exit
207$ goto exit_out
208$!
209$!
210$EXIT_OUT:
211$!
212$ purge/nolog [.debug]
213$ set def 'saved_default
214$ exit 'exit_status
215$!
216$
217$ERROR_OUT:
218$ exit_status = $status
219$ write sys$output "''f$message(exit_status)'"
220$ goto EXIT_OUT
221$!
222$!- the BUILD subroutine. Compile then insert into library or link as required
223$!
224$BUILD: subroutine
225$ on warning then goto EXIT_BUILD
226$ source_file = p1
227$ name = f$element(0,".",source_file)
228$ object_file = f$fao("[.debug]!AS.OBJ",name)
229$!
230$!- compile
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000231$!
232$ write sys$output "Compiling ",p1," ",p2,"..."
233$ cc_command'p2' /object='object_file 'source_file'
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000234$!
235$!- insert into library if command defined
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000236$!
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000237$ if lib_command.nes."" then lib_command 'object_file'
238$!
239$!- link module if command defined
240$ if link_command.nes.""
241$ then
242$ text = f$element(0,".",p1) ! lose the ".c"
243$ write sys$output "Linking ",text,"..."
Daniel Veillardd33cfbf2001-11-13 15:24:36 +0000244$ opts = ""
245$ if debug then opts = "/DEBUG"
246$ link_command'opts' 'object_file',-
247 XMLOLB:libxml.olb/library
Daniel Veillardacf7ff02001-10-29 20:21:47 +0000248$ endif
249$!
250$EXIT_BUILD:
251$ exit $status
252$!
253$endsubroutine