Blame vms/build_libxml.com

Packit Service a31ea6
$! BUILD_LIBXML.COM
Packit Service a31ea6
$!
Packit Service a31ea6
$! Build the LIBXML library
Packit Service a31ea6
$!
Packit Service a31ea6
$! Arguments:
Packit Service a31ea6
$!
Packit Service a31ea6
$!   	"DEBUG"  - build everything in debug
Packit Service a31ea6
$!
Packit Service a31ea6
$! This procedure creates an object library XML_LIBDIR:LIBXML.OLB directory.
Packit Service a31ea6
$! After the library is built, you can link LIBXML routines into
Packit Service a31ea6
$! your code with the command
Packit Service a31ea6
$!
Packit Service a31ea6
$!	$ LINK your_modules,XML_LIBDIR:LIBXML.OLB/LIBRARY
Packit Service a31ea6
$!
Packit Service a31ea6
$! Change History
Packit Service a31ea6
$! --------------
Packit Service a31ea6
$! Command file author : John A Fotheringham (jaf@jafsoft.com)
Packit Service a31ea6
$! Update history      : 19 March 2008	Tycho Hilhorst
Packit Service a31ea6
$!                       - added module schematron.c (prevent xmllint errors)
Packit Service a31ea6
$!                       - added /DEF and /INCLUDE options to cc_opts to tell
Packit Service a31ea6
$!                         config.h is available, and where to find it
Packit Service a31ea6
$!                     : 13 October 2003	Craig Berry (craigberry@mac.com)
Packit Service a31ea6
$!			 more new module additions
Packit Service a31ea6
$!                     : 25 April 2003		Craig Berry (craigberry@mac.com)
Packit Service a31ea6
$!			 added xmlreader.c and relaxng.c to source list
Packit Service a31ea6
$! 		       : 28 September 2002	Craig Berry (craigberry@mac.com)
Packit Service a31ea6
$!			 updated to work with current sources
Packit Service a31ea6
$!			 miscellaneous enhancements to build process
Packit Service a31ea6
$!
Packit Service a31ea6
$!- configuration -------------------------------------------------------------
Packit Service a31ea6
$!
Packit Service a31ea6
$!- compile command.  If p1="nowarn" suppress the expected warning types
Packit Service a31ea6
$!
Packit Service a31ea6
$   cc_opts = "/nowarn/DEF=HAVE_CONFIG_H/NAMES=(as_is,SHORTENED)/FLOAT=IEEE/IEEE_MODE=DENORM_RESULTS/INCLUDE=xml_srcdir"
Packit Service a31ea6
$!
Packit Service a31ea6
$   if p1.eqs."DEBUG" .or. p2.eqs."DEBUG"
Packit Service a31ea6
$   then
Packit Service a31ea6
$     debug = "Y"
Packit Service a31ea6
$     cc_command = "CC''cc_opts'/DEBUG/NOOPTIMIZE/LIST/SHOW=ALL"
Packit Service a31ea6
$   else
Packit Service a31ea6
$     debug = "N"
Packit Service a31ea6
$     cc_command = "CC''cc_opts'"
Packit Service a31ea6
$   endif
Packit Service a31ea6
$!
Packit Service a31ea6
$!- list of sources to be built into the LIBXML library.  Compare this list
Packit Service a31ea6
$!  to the definition of "libxml2_la_SOURCES" in the file MAKEFILE.IN.
Packit Service a31ea6
$!  Currently this definition includes the list WITH_TRIO_SOURCES_TRUE
Packit Service a31ea6
$!
Packit Service a31ea6
$   sources = "parser.c SAX.c entities.c encoding.c error.c parserInternals.c"
Packit Service a31ea6
$   sources = sources + " tree.c hash.c list.c xmlIO.c xmlmemory.c uri.c"
Packit Service a31ea6
$   sources = sources + " valid.c xlink.c HTMLparser.c HTMLtree.c debugXML.c xpath.c"
Packit Service a31ea6
$   sources = sources + " xpointer.c xinclude.c nanohttp.c nanoftp.c DOCBparser.c"
Packit Service a31ea6
$   sources = sources + " catalog.c globals.c threads.c c14n.c xmlstring.c"
Packit Service a31ea6
$   sources = sources + " xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c"
Packit Service a31ea6
$   sources = sources + " triostr.c trio.c xmlreader.c relaxng.c dict.c SAX2.c"
Packit Service a31ea6
$   sources = sources + " xmlwriter.c legacy.c chvalid.c pattern.c xmlsave.c"
Packit Service a31ea6
$   sources = sources + " schematron.c xmlmodule.c buf.c"
Packit Service a31ea6
$!
Packit Service a31ea6
$!- list of main modules to compile and link.  Compare this list to the
Packit Service a31ea6
$!  definition of bin_PROGRAMS in MAKEFILE.IN
Packit Service a31ea6
$!
Packit Service a31ea6
$   bin_progs = "xmllint xmlcatalog"
Packit Service a31ea6
$!
Packit Service a31ea6
$!- list of test modules to compile and link.  Compare this list to the
Packit Service a31ea6
$!  definition of check_PROGRAMS in MAKEFILE.
Packit Service a31ea6
$!
Packit Service a31ea6
$   check_PROGRAMS = "testSchemas testRelax testSAX testHTML testXPath testURI " -
Packit Service a31ea6
                + "testThreads testC14N testAutomata testRegexp testReader"
Packit Service a31ea6
$!
Packit Service a31ea6
$!- set up build logicals -----------------------------------------------------\
Packit Service a31ea6
$!
Packit Service a31ea6
$!
Packit Service a31ea6
$!- start from where the procedure is in case it's submitted in batch ----------\
Packit Service a31ea6
$!
Packit Service a31ea6
$   whoami = f$parse(f$environment("PROCEDURE"),,,,"NO_CONCEAL")
Packit Service a31ea6
$   procdir = f$parse(whoami,,,"DEVICE") + f$parse(whoami,,,"DIRECTORY")
Packit Service a31ea6
$   set default 'procdir'
Packit Service a31ea6
$!
Packit Service a31ea6
$   if f$trnlnm("XML_LIBDIR").eqs.""
Packit Service a31ea6
$   then
Packit Service a31ea6
$     if f$search("[-]lib.dir") .eqs. ""
Packit Service a31ea6
$     then
Packit Service a31ea6
$       create/directory/log [-.lib]
Packit Service a31ea6
$     endif
Packit Service a31ea6
$     xml_libdir = f$parse("[-.lib]",,,"DEVICE") + f$parse("[-.lib]",,,"DIRECTORY")
Packit Service a31ea6
$     define/process XML_LIBDIR 'xml_libdir'
Packit Service a31ea6
$     write sys$output "Defining XML_LIBDIR as """ + f$trnlnm("XML_LIBDIR") + """
Packit Service a31ea6
$   endif
Packit Service a31ea6
$!
Packit Service a31ea6
$   if f$trnlnm("XML_SRCDIR").eqs.""
Packit Service a31ea6
$   then
Packit Service a31ea6
$     globfile = f$search("[-...]globals.c")
Packit Service a31ea6
$     if globfile.eqs.""
Packit Service a31ea6
$     then
Packit Service a31ea6
$	write sys$output "Can't locate globals.c.  You need to manually define a XML_SRCDIR logical"
Packit Service a31ea6
$	exit
Packit Service a31ea6
$     else
Packit Service a31ea6
$	srcdir = f$parse(globfile,,,"DEVICE") + f$parse(globfile,,,"DIRECTORY")
Packit Service a31ea6
$	define/process XML_SRCDIR "''srcdir'"
Packit Service a31ea6
$       write sys$output "Defining XML_SRCDIR as ""''srcdir'"""
Packit Service a31ea6
$     endif
Packit Service a31ea6
$   endif
Packit Service a31ea6
$!
Packit Service a31ea6
$   copy/log config.vms xml_srcdir:config.h
Packit Service a31ea6
$!   copy/log xmlversion.h [-.include.libxml]
Packit Service a31ea6
$!
Packit Service a31ea6
$   if f$trnlnm("libxml").eqs.""
Packit Service a31ea6
$   then
Packit Service a31ea6
$     globfile = f$search("[-...]globals.h")
Packit Service a31ea6
$     if globfile.eqs.""
Packit Service a31ea6
$     then
Packit Service a31ea6
$	write sys$output "Can't locate globals.h.  You need to manually define a LIBXML logical"
Packit Service a31ea6
$	exit
Packit Service a31ea6
$     else
Packit Service a31ea6
$	includedir = f$parse(globfile,,,"DEVICE") + f$parse(globfile,,,"DIRECTORY")
Packit Service a31ea6
$	define/process libxml "''includedir'"
Packit Service a31ea6
$       write sys$output "Defining libxml as ""''includedir'"""
Packit Service a31ea6
$     endif
Packit Service a31ea6
$   endif
Packit Service a31ea6
$!
Packit Service a31ea6
$!- set up error handling (such as it is) -------------------------------------
Packit Service a31ea6
$!
Packit Service a31ea6
$ exit_status = 1
Packit Service a31ea6
$ saved_default = f$environment("default")
Packit Service a31ea6
$ on error then goto ERROR_OUT
Packit Service a31ea6
$ on control_y then goto ERROR_OUT
Packit Service a31ea6
$!
Packit Service a31ea6
$!- move to the source directory and create any necessary subdirs and the
Packit Service a31ea6
$!  object library
Packit Service a31ea6
$!
Packit Service a31ea6
$ set default xml_srcdir
Packit Service a31ea6
$ if f$search("DEBUG.DIR").eqs."" then create/dir [.DEBUG]
Packit Service a31ea6
$ if f$search("XML_LIBDIR:LIBXML.OLB").eqs.""
Packit Service a31ea6
$ then
Packit Service a31ea6
$   write sys$output "Creating new object library XML_LIBDIR:LIBXML.OLB"
Packit Service a31ea6
$   library/create XML_LIBDIR:LIBXML.OLB
Packit Service a31ea6
$ endif
Packit Service a31ea6
$!
Packit Service a31ea6
$ goto start_here
Packit Service a31ea6
$ start_here:	  ! move this line to debug/rerun parts of this command file
Packit Service a31ea6
$!
Packit Service a31ea6
$!- compile modules into the library ------------------------------------------
Packit Service a31ea6
$!
Packit Service a31ea6
$ lib_command   = "LIBRARY/REPLACE/LOG XML_LIBDIR:LIBXML.OLB"
Packit Service a31ea6
$ link_command	= ""
Packit Service a31ea6
$!
Packit Service a31ea6
$ write sys$output ""
Packit Service a31ea6
$ write sys$output "Building modules into the LIBXML object library"
Packit Service a31ea6
$ write sys$output ""
Packit Service a31ea6
$!
Packit Service a31ea6
$ s_no = 0
Packit Service a31ea6
$ sources = f$edit(sources,"COMPRESS")
Packit Service a31ea6
$!
Packit Service a31ea6
$ source_loop:
Packit Service a31ea6
$!
Packit Service a31ea6
$   next_source = f$element (S_no," ",sources)
Packit Service a31ea6
$   if next_source.nes."" .and. next_source.nes." "
Packit Service a31ea6
$   then
Packit Service a31ea6
$!
Packit Service a31ea6
$     on error then goto ERROR_OUT
Packit Service a31ea6
$     on control_y then goto ERROR_OUT
Packit Service a31ea6
$     call build 'next_source'
Packit Service a31ea6
$     s_no = s_no + 1
Packit Service a31ea6
$     goto source_loop
Packit Service a31ea6
$!
Packit Service a31ea6
$   endif
Packit Service a31ea6
$!
Packit Service a31ea6
$!- now build self-test programs ----------------------------------------------
Packit Service a31ea6
$!
Packit Service a31ea6
$! these programs are built as ordinary modules into XML_LIBDIR:LIBXML.OLB.  Here they
Packit Service a31ea6
$! are built a second time with /DEFINE=(STANDALONE) in which case a main()
Packit Service a31ea6
$! is also compiled into the module
Packit Service a31ea6
$
Packit Service a31ea6
$ lib_command	= ""
Packit Service a31ea6
$ link_command	= "LINK"
Packit Service a31ea6
$!
Packit Service a31ea6
$ library/compress XML_LIBDIR:LIBXML.OLB
Packit Service a31ea6
$ purge XML_LIBDIR:LIBXML.OLB
Packit Service a31ea6
$!
Packit Service a31ea6
$ write sys$output ""
Packit Service a31ea6
$ write sys$output "Building STANDALONE self-test programs"
Packit Service a31ea6
$ write sys$output ""
Packit Service a31ea6
$!
Packit Service a31ea6
$ call build NANOFTP.C	/DEFINE=(STANDALONE)
Packit Service a31ea6
$ call build NANOHTTP.C	/DEFINE=(STANDALONE)
Packit Service a31ea6
$ call build TRIONAN.C	/DEFINE=(STANDALONE)
Packit Service a31ea6
$!
Packit Service a31ea6
$!- now build main and test programs ------------------------------------------
Packit Service a31ea6
$!
Packit Service a31ea6
$!
Packit Service a31ea6
$ lib_command	= ""
Packit Service a31ea6
$ link_command	= "LINK"
Packit Service a31ea6
$!
Packit Service a31ea6
$ write sys$output ""
Packit Service a31ea6
$ write sys$output "Building main programs and test programs"
Packit Service a31ea6
$ write sys$output ""
Packit Service a31ea6
$!
Packit Service a31ea6
$ p_no = 0
Packit Service a31ea6
$ all_progs = bin_progs + " " + check_PROGRAMS
Packit Service a31ea6
$ all_progs = f$edit(all_progs,"COMPRESS")
Packit Service a31ea6
$!
Packit Service a31ea6
$ prog_loop:
Packit Service a31ea6
$!
Packit Service a31ea6
$   next_prog = f$element (p_no," ",all_progs)
Packit Service a31ea6
$   if next_prog.nes."" .and. next_prog.nes." "
Packit Service a31ea6
$   then
Packit Service a31ea6
$!
Packit Service a31ea6
$     on error then goto ERROR_OUT
Packit Service a31ea6
$     on control_y then goto ERROR_OUT
Packit Service a31ea6
$     call build 'next_prog'.c
Packit Service a31ea6
$     p_no = p_no + 1
Packit Service a31ea6
$     goto prog_loop
Packit Service a31ea6
$!
Packit Service a31ea6
$   endif
Packit Service a31ea6
$!
Packit Service a31ea6
$!- Th-th-th-th-th-that's all folks! ------------------------------------------
Packit Service a31ea6
$!
Packit Service a31ea6
$ goto exit_here ! move this line to avoid parts of this command file
Packit Service a31ea6
$ exit_here:
Packit Service a31ea6
$!
Packit Service a31ea6
$ exit
Packit Service a31ea6
$ goto exit_out
Packit Service a31ea6
$!
Packit Service a31ea6
$!
Packit Service a31ea6
$EXIT_OUT:
Packit Service a31ea6
$!
Packit Service a31ea6
$ purge/nolog [.debug]
Packit Service a31ea6
$ set default 'saved_default
Packit Service a31ea6
$ exit 'exit_status
Packit Service a31ea6
$!
Packit Service a31ea6
$
Packit Service a31ea6
$ERROR_OUT:
Packit Service a31ea6
$ exit_status = $status
Packit Service a31ea6
$ write sys$output "''f$message(exit_status)'"
Packit Service a31ea6
$ goto EXIT_OUT
Packit Service a31ea6
$!
Packit Service a31ea6
$!- the BUILD subroutine.  Compile then insert into library or link as required
Packit Service a31ea6
$!
Packit Service a31ea6
$BUILD: subroutine
Packit Service a31ea6
$   on warning then goto EXIT_BUILD
Packit Service a31ea6
$   source_file = p1
Packit Service a31ea6
$   name = f$parse(source_file,,,"NAME")
Packit Service a31ea6
$   object_file = f$parse("[.debug].OBJ",name,,,"SYNTAX_ONLY")
Packit Service a31ea6
$!
Packit Service a31ea6
$!- compile
Packit Service a31ea6
$!
Packit Service a31ea6
$   write sys$output "''cc_command'''p2'/object=''object_file' ''source_file'"
Packit Service a31ea6
$   cc_command'p2' /object='object_file 'source_file'
Packit Service a31ea6
$!
Packit Service a31ea6
$!- insert into library if command defined
Packit Service a31ea6
$!
Packit Service a31ea6
$   if lib_command.nes.""  then lib_command 'object_file'
Packit Service a31ea6
$!
Packit Service a31ea6
$!- link module if command defined
Packit Service a31ea6
$   if link_command.nes.""
Packit Service a31ea6
$   then
Packit Service a31ea6
$	opts = ""
Packit Service a31ea6
$	if debug then opts = "/DEBUG"
Packit Service a31ea6
$	write sys$output "''link_command'''opts' ''object_file',XML_LIBDIR:libxml.olb/library"
Packit Service a31ea6
$	if f$search( "sys$library:iconv.olb" ) .eqs. ""
Packit Service a31ea6
$	then
Packit Service a31ea6
$	  link_command'opts' 'object_file',-
Packit Service a31ea6
      		XML_LIBDIR:libxml.olb/library
Packit Service a31ea6
$	else
Packit Service a31ea6
$	  link_command'opts' 'object_file',-
Packit Service a31ea6
      		XML_LIBDIR:libxml.olb/library,sys$library:iconv/lib
Packit Service a31ea6
$	endif
Packit Service a31ea6
$   endif
Packit Service a31ea6
$!
Packit Service a31ea6
$EXIT_BUILD:
Packit Service a31ea6
$   exit $status
Packit Service a31ea6
$!
Packit Service a31ea6
$endsubroutine