1$! BUILD_XSLT.COM 2$! 3$! Build the XSLT library 4$! 5$! Arguments: 6$! 7$! p1 - "DEBUG" is you want to build with debug 8$! 9$! This package requires libxml to have already been installed. You need 10$! to ensure that the logical name LIBXML is defined and points to the 11$! directory containing libxml's .h files 12$! 13$! This procedure creates the object libraries 14$! 15$! XML_LIBDIR:LIBXSLT.OLB 16$! XML_LIBDIR:LIBEXSLT.OLB 17$! 18$! and the program 19$! 20$! XSLTPROC 21$! 22$! After the library is built, you can link these routines into 23$! your code with the command 24$! 25$! LINK your_modules,XML_LIBDIR:LIBEXSLT/LIB,LIBXSLT/LIBRARY,LIBXML/LIB 26$! 27$! Change History 28$! -------------- 29$! Command file author : John A Fotheringham (jaf@jafsoft.com) 30$! Last update : 2 Nov 2001 31$! 32$!- configuration ------------------------------------------------------------- 33$! 34$!- compile command. 35$! 36$ cc_opts = "/INCLUDE=([],XML_SRCDIR:,[-.libxslt])/NAMES=(SHORTENED)/FLOAT=IEEE/IEEE_MODE=DENORM_RESULTS" 37$! 38$ if p1.eqs."DEBUG" 39$ then 40$ debug = "Y" 41$ cc_command = "CC''cc_opts'/DEBUG/NOOPTIMIZE/LIST/SHOW=ALL" 42$ else 43$ debug = "N" 44$ cc_command = "CC''cc_opts'" 45$ endif 46$! 47$!- configure multiple build passes for each library. ------------------------- 48$! 49$! For each pass: 50$! 51$! "libname" is the name of the library or module being created 52$! 53$! "progname" is the name of the program being created 54$! 55$! "src" is the list of sources to be built into the library or program 56$! - This should be compared to the definition of 57$! "<NAME>_la_SOURCES" in the MAKEFILE.IN file in 58$! corresponding directory. 59$! 60$ num_passes = 3 ! two libraries and a program 61$! 62$!- pass 1 - library LIBXSLT 63$! 64$ libname_1 = "LIBXSLT" 65$ h_file_1 = "xslt.h" 66$ progname_1 = "" 67$! 68$ ! see "libxslt_la_SOURCES" in [.libxslt]makefile.in 69$ src_1 = "xslt.c xsltutils.c pattern.c templates.c variables.c keys.c" 70$ src_1 = src_1 + " numbers.c extensions.c extra.c functions.c" 71$ src_1 = src_1 + " namespaces.c imports.c attributes.c documents.c" 72$ src_1 = src_1 + " preproc.c transform.c security.c" 73$! 74$!- pass 2 - library LIBEXSLT 75$! 76$ libname_2 = "LIBEXSLT" 77$ h_file_2 = "exslt.h" 78$ progname_2 = "" 79$! 80$ ! see "libexslt_la_SOURCES" in [.libexslt]makefile.in 81$ src_2 = "exslt.c common.c math.c sets.c functions.c strings.c date.c saxon.c dynamic.c" 82$! 83$!- pass 3 - program XSLTPROC 84$! 85$ libname_3 = "" 86$ h_file_3 = "" 87$ progname_3 = "XSLTPROC" 88$! 89$ ! see "xsltproc_SOURCES" in [.xsltproc]makefile.in 90$ src_3 = "xsltproc.c" 91$! 92$!- set up and check logicals ----------------------------------------------- 93$! 94$! XML_LIBDIR - object library directory 95$! XML_SRCDIR - top-level build directory of libxml package -- needed for config.h and trio.h 96$! LIBXML - source directory containing .h files for libxml package 97$! 98$ if f$trnlnm("XML_LIBDIR").eqs."" 99$ then 100$ on error then continue 101$ globfile = f$search("[--...]libxml.olb") 102$ if globfile.eqs."" 103$ then 104$ write sys$output "" 105$ write sys$output " You need to define the XML_LIBDIR logical name to" 106$ write sys$output " point to the directory containing your object" 107$ write sys$output " libraries. This should already contain LIBXML.OLB" 108$ write sys$output " from the libxml package, and will be the directory" 109$ write sys$output " the new LIBXSLT.OLB library will be placed in" 110$ write sys$output "" 111$ exit 112$ else 113$ srcdir = f$parse(globfile,,,"DEVICE") + f$parse(globfile,,,"DIRECTORY") 114$ define/process XML_LIBDIR "''srcdir'" 115$ write sys$output "Defining XML_LIBDIR as ""''srcdir'""" 116$ endif 117$ endif 118$! 119$ if f$trnlnm("libxml").eqs."" 120$ then 121$ ! look for globals.h in a directory installed paralle to this one 122$ on error then continue 123$ globfile = f$search("[--...]globals.h") 124$ if globfile.eqs."" 125$ then 126$ write sys$output "" 127$ write sys$output " You need to define a LIBXML logical directory to" 128$ write sys$output " point to the directory containing the .h files" 129$ write sys$output " for the libxml package" 130$ write sys$output "" 131$ exit 132$ else 133$ srcdir = f$element(0,"]",globfile)+ "]" 134$ define/process LIBXML "''srcdir'" 135$ write sys$output "Defining LIBXML as ""''srcdir'""" 136$ endif 137$ endif 138$! 139$ if f$trnlnm("XML_SRCDIR").eqs."" 140$ then 141$ globfile = f$search("[--...]globals.c") 142$ if globfile.eqs."" 143$ then 144$ write sys$output "Can't locate globals.c. You need to manually define a XML_SRCDIR logical" 145$ exit 146$ else 147$ srcdir = f$parse(globfile,,,"DEVICE") + f$parse(globfile,,,"DIRECTORY") 148$ define/process XML_SRCDIR "''srcdir'" 149$ write sys$output "Defining XML_SRCDIR as ""''srcdir'""" 150$ endif 151$ endif 152$! 153$!- set up some working logicals ------------------- 154$! 155$ pass_no = 1 156$ set_pass_logical: 157$! 158$ if pass_no.le.num_passes 159$ then 160$! 161$ Libname = libname_'pass_no' 162$ progname = progname_'pass_no' 163$ if libname.nes."" 164$ then 165$ logname = "''libname'_SRCDIR" 166$ else 167$ logname = "''progname'_SRCDIR" 168$ endif 169$ findfile = f$element(0," ",src_'pass_no') 170$! 171$!--- set up a source directory logical 172$! 173$ if f$trnlnm("''logname'").eqs."" 174$ then 175$ ! look for the target file in a parallel subdirectory 176$ globfile = f$search("[-...]''findfile'") 177$ if globfile.eqs."" 178$ then 179$ write sys$output "Can't locate ''findfile'. You need to manually define a ''logname' logical" 180$ exit 181$ else 182$ srcdir = f$element(0,"]",globfile)+ "]" 183$ define/process 'logname' "''srcdir'" 184$ write sys$output "Defining ''logname' as ""''srcdir'""" 185$ endif 186$ endif 187$! 188$!--- if it's a library, set up a logical pointing to the .h files 189$! 190$ if libname.nes."" 191$ then 192$ if f$trnlnm("''libname'").eqs."" 193$ then 194$ ! look for the target .h file in a parallel subdirectory 195$ h_file = h_file_'pass_no' 196$ globfile = f$search("[-...]''h_file'") 197$ if globfile.eqs."" 198$ then 199$ write sys$output "Can't locate ''h_file'. You need to manually define a ''libname' logical" 200$ exit 201$ else 202$ includedir = f$element(0,"]",globfile)+ "]" 203$ define/process 'libname' "''includedir'" 204$ write sys$output "Defining ''libname' as ""''includedir'""" 205$ endif 206$ endif 207$ endif 208$! 209$ pass_no = pass_no +1 210$ goto set_pass_logical 211$! 212$ endif ! for each pass 213$! 214$!- set up error handling (such as it is) ------------------------------------- 215$! 216$ exit_status = 1 217$ saved_default = f$environment("default") 218$ on error then goto ERROR_OUT 219$ on control_y then goto ERROR_OUT 220$! 221$ goto start_here 222$ start_here: ! move this line to debug/rerun parts of this command file 223$! 224$!- compile modules into the library ------------------------------------------ 225$! 226$! 227$ pass_no = 1 ! make three passes, one for each library, one for XSLTPROC 228$ pass_loop: 229$! 230$ if pass_no.le.num_passes 231$ then 232$ Libname = libname_'pass_no' 233$ progname = progname_'pass_no' 234$ if libname.nes."" 235$ then 236$ logname = "''libname'_SRCDIR" 237$ pass_description = "the XML_LIBDIR:''libname'.OLB object library" 238$ else 239$ logname = "''progname'_SRCDIR" 240$ pass_description = "the programs in ''progname'" 241$ endif 242$ src = src_'pass_no' 243$! 244$!- create the library if need 245$! 246$ if libname.nes."" 247$ then 248$ if f$search("XML_LIBDIR:''libname'.OLB").eqs."" 249$ then 250$ write sys$output "Creating new object library XML_LIBDIR:''libname'.OLB..." 251$ library/create XML_LIBDIR:'libname'.OLB 252$ endif 253$ endif 254$! 255$!- move to the source directory 256$! 257$ set def 'logname' 258$! 259$!- define the library and link commands (link command not used as is) 260$! 261$ if libname.nes."" 262$ then 263$ lib_command = "LIBRARY/REPLACE XML_LIBDIR:''libname'.OLB" 264$ link_command = "" 265$ else 266$ lib_command = "" 267$ link_command = "LINK" 268$ endif 269$! 270$ write sys$output "" 271$ write sys$output "Building ''pass_description' 272$ write sys$output "" 273$! 274$ s_no = 0 275$ src = f$edit(src,"COMPRESS") 276$! 277$ source_loop: 278$! 279$ next_source = f$element (S_no," ",src) 280$ if next_source.nes."" .and. next_source.nes." " 281$ then 282$ call build 'next_source' 283$ s_no = s_no + 1 284$ goto source_loop 285$ endif 286$! 287$ pass_no = pass_no + 1 288$ goto pass_loop 289$! 290$ endif ! for each pass 291$! 292$!- Th-th-th-th-th-that's all folks! ------------------------------------------ 293$! 294$EXIT_OUT: 295$! 296$ set def 'saved_default 297$ exit 'exit_status 298$! 299$ 300$ERROR_OUT: 301$ exit_status = $status 302$ write sys$output "''f$message(exit_status)'" 303$ goto EXIT_OUT 304$! 305$!- the BUILD subroutine. Compile then insert into library or link as required 306$! 307$BUILD: subroutine 308$ on warning then goto EXIT_BUILD 309$ source_file = p1 310$ name = f$element(0,".",source_file) 311$ object_file = f$fao("XML_LIBDIR:!AS.OBJ",name) 312$! 313$!- compile 314$ write sys$output "Compiling ",p1,p2,"..." 315$ cc_command /object='object_file 'source_file' 'p2' 316$! 317$!- insert into library if command defined 318$! 319$ if lib_command.nes."" 320$ then 321$ lib_command 'object_file' 322$ delete/nolog 'object_file';* 323$ endif 324$! 325$!- link module if command defined 326$! 327$ if link_command.nes."" 328$ then 329$ text = f$element(0,".",p1) ! lose the ".c" 330$ write sys$output "Linking ",text,"..." 331$ dbgopts = "" 332$ if debug then dbgopts = "/DEBUG" 333$ link_command'dbgopts' 'object_file',- 334 XML_LIBDIR:libexslt/lib,- 335 XML_LIBDIR:libxslt/lib,- 336 XML_LIBDIR:libxml/library 337$ endif 338$! 339$EXIT_BUILD: 340$ exit $status 341$! 342$endsubroutine 343