Daniel Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 1 | $! BUILD_LIBXML.COM |
| 2 | $! |
Daniel Veillard | d33cfbf | 2001-11-13 15:24:36 +0000 | [diff] [blame] | 3 | $! Build the LIBXML library |
Daniel Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 4 | $! |
Daniel Veillard | d33cfbf | 2001-11-13 15:24:36 +0000 | [diff] [blame] | 5 | $! 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 Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 15 | $! |
Daniel Veillard | d33cfbf | 2001-11-13 15:24:36 +0000 | [diff] [blame] | 16 | $! Change History |
| 17 | $! -------------- |
| 18 | $! Command file author : John A Fotheringham (jaf@jafsoft.com) |
| 19 | $! Last update : 2 Nov 2001 |
| 20 | $! |
Daniel Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 21 | $!- configuration ------------------------------------------------------------- |
| 22 | $! |
| 23 | $!- compile command. If p1="nowarn" suppress the expected warning types |
| 24 | $! |
Daniel Veillard | d33cfbf | 2001-11-13 15:24:36 +0000 | [diff] [blame] | 25 | $ 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 Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 33 | $ 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 Veillard | d33cfbf | 2001-11-13 15:24:36 +0000 | [diff] [blame] | 37 | $! to the definition of "libxml2_la_SOURCES" in the file MAKEFILE.IN. |
| 38 | $! Currently this definition includes the list WITH_TRIO_SOURCES_TRUE |
Daniel Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 39 | $! |
| 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 Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 45 | $ sources = sources + " trio.c strio.c" |
| 46 | $! |
| 47 | $!- list of main modules to compile and link. Compare this list to the |
Daniel Veillard | d33cfbf | 2001-11-13 15:24:36 +0000 | [diff] [blame] | 48 | $! definition of bin_PROGRAMS in MAKEFILE.IN |
Daniel Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 49 | $! |
| 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 Veillard | d33cfbf | 2001-11-13 15:24:36 +0000 | [diff] [blame] | 55 | $ test_progs = "testSAX testHTML testXPath testURI testDocbook testThreads" |
Daniel Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 56 | $! |
| 57 | $!- set up build logicals -----------------------------------------------------\ |
| 58 | $! |
Daniel Veillard | d33cfbf | 2001-11-13 15:24:36 +0000 | [diff] [blame] | 59 | $ 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 Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 71 | $ if f$trnlnm("xml_srcdir").eqs."" |
| 72 | $ then |
Daniel Veillard | d33cfbf | 2001-11-13 15:24:36 +0000 | [diff] [blame] | 73 | $ globfile = f$search("[-...]globals.c") |
Daniel Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 74 | $ if globfile.eqs."" |
| 75 | $ then |
Daniel Veillard | d33cfbf | 2001-11-13 15:24:36 +0000 | [diff] [blame] | 76 | $ write sys$output "Can't locate globals.c. You need to manually define a XML_SRCDIR logical" |
| 77 | $ exit |
Daniel Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 78 | $ 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 Veillard | d33cfbf | 2001-11-13 15:24:36 +0000 | [diff] [blame] | 87 | $ globfile = f$search("[-...]globals.h") |
| 88 | $ if globfile.eqs."" |
Daniel Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 89 | $ then |
Daniel Veillard | d33cfbf | 2001-11-13 15:24:36 +0000 | [diff] [blame] | 90 | $ write sys$output "Can't locate globals.h. You need to manually define a LIBXML logical" |
Daniel Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 91 | $ 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 Veillard | d33cfbf | 2001-11-13 15:24:36 +0000 | [diff] [blame] | 111 | $ 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 Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 116 | $! |
| 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 Veillard | d33cfbf | 2001-11-13 15:24:36 +0000 | [diff] [blame] | 122 | $ lib_command = "LIBRARY/REPLACE XMLOLB:LIBXML.OLB" |
Daniel Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 123 | $ 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 Veillard | d33cfbf | 2001-11-13 15:24:36 +0000 | [diff] [blame] | 138 | $ on error then goto ERROR_OUT |
| 139 | $ on control_y then goto ERROR_OUT |
Daniel Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 140 | $ if next_source.eqs."xpath.c" |
| 141 | $ then |
| 142 | $ call build 'next_source' /IEEE_MODE=UNDERFLOW_TO_ZERO/FLOAT=IEEE |
| 143 | $ else |
Daniel Veillard | d33cfbf | 2001-11-13 15:24:36 +0000 | [diff] [blame] | 144 | $ 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 Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 150 | $ endif |
| 151 | $ s_no = s_no + 1 |
| 152 | $ goto source_loop |
| 153 | $! |
| 154 | $ endif |
| 155 | $! |
| 156 | $!- now build self-test programs ---------------------------------------------- |
| 157 | $! |
Daniel Veillard | d33cfbf | 2001-11-13 15:24:36 +0000 | [diff] [blame] | 158 | $! these pograms are built as ordinary modules into XMLOLB:LIBXML.OLB. Here they |
Daniel Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 159 | $! 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 Veillard | d33cfbf | 2001-11-13 15:24:36 +0000 | [diff] [blame] | 193 | $ on error then goto ERROR_OUT |
| 194 | $ on control_y then goto ERROR_OUT |
Daniel Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 195 | $ 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 Veillard | d33cfbf | 2001-11-13 15:24:36 +0000 | [diff] [blame] | 203 | $ goto exit_here ! move this line to avoid parts of this command file |
| 204 | $ exit_here: |
| 205 | $! |
Daniel Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 206 | $ 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 Veillard | d33cfbf | 2001-11-13 15:24:36 +0000 | [diff] [blame] | 231 | $! |
| 232 | $ write sys$output "Compiling ",p1," ",p2,"..." |
| 233 | $ cc_command'p2' /object='object_file 'source_file' |
Daniel Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 234 | $! |
| 235 | $!- insert into library if command defined |
Daniel Veillard | d33cfbf | 2001-11-13 15:24:36 +0000 | [diff] [blame] | 236 | $! |
Daniel Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 237 | $ 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 Veillard | d33cfbf | 2001-11-13 15:24:36 +0000 | [diff] [blame] | 244 | $ opts = "" |
| 245 | $ if debug then opts = "/DEBUG" |
| 246 | $ link_command'opts' 'object_file',- |
| 247 | XMLOLB:libxml.olb/library |
Daniel Veillard | acf7ff0 | 2001-10-29 20:21:47 +0000 | [diff] [blame] | 248 | $ endif |
| 249 | $! |
| 250 | $EXIT_BUILD: |
| 251 | $ exit $status |
| 252 | $! |
| 253 | $endsubroutine |