Blame vms/build_libxml.com

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