From e72b4e738965e9ef4bd667b01114f9e27672d232 Mon Sep 17 00:00:00 2001 From: Patrick Monnerat Date: Tue, 4 Mar 2014 17:26:13 +0100 Subject: [PATCH] OS400: Add compilation scripts. --- os400/initscript.sh | 282 ++++++++++++++++++++++++++++++++ os400/make-bldcsndfa.sh | 43 +++++ os400/make-include.sh | 81 +++++++++ os400/make-rpg.sh | 97 +++++++++++ os400/make-src.sh | 241 +++++++++++++++++++++++++++ os400/make.sh | 72 ++++++++ os400/os400config.h.in | 353 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 1169 insertions(+) create mode 100644 os400/initscript.sh create mode 100644 os400/make-bldcsndfa.sh create mode 100644 os400/make-include.sh create mode 100644 os400/make-rpg.sh create mode 100644 os400/make-src.sh create mode 100644 os400/make.sh create mode 100644 os400/os400config.h.in diff --git a/os400/initscript.sh b/os400/initscript.sh new file mode 100644 index 00000000..d2175cb5 --- /dev/null +++ b/os400/initscript.sh @@ -0,0 +1,282 @@ +#!/bin/sh +# +# Compilation scripts initialization for the OS/400 implementation. +# +# See Copyright for the status of this software. +# +# Author: Patrick Monnerat , DATASPHERE S.A. +# + + +case "${SCRIPTDIR}" in +/*) ;; +*) SCRIPTDIR="`pwd`/${SCRIPTDIR}" +esac + +while true +do case "${SCRIPTDIR}" in + */.) SCRIPTDIR="${SCRIPTDIR%/.}";; + *) break;; + esac +done + +# The script directory is supposed to be in $TOPDIR/os400. + +TOPDIR=`dirname "${SCRIPTDIR}"` +export SCRIPTDIR TOPDIR + + +setenv() + +{ + # Define and export. + + eval ${1}="${2}" + export ${1} +} + + +################################################################################ +# +# Tunable configuration parameters. +# +################################################################################ + +setenv TARGETLIB 'LIBXML2' # Target OS/400 program library. +setenv STATBNDDIR 'LIBXML2_A' # Static binding directory. +setenv DYNBNDDIR 'LIBXML2' # Dynamic binding directory. +setenv SRVPGM "LIBXML2" # Service program. +setenv TGTCCSID '500' # Target CCSID of objects. +setenv DEBUG '*ALL' # Debug level. +setenv OPTIMIZE '10' # Optimisation level. +setenv OUTPUT '*NONE' # Compilation output option. +setenv TGTRLS 'V5R3M0' # Target OS release. +setenv IFSDIR '/libxml2' # Installation IFS directory. + + +################################################################################ +# +# Conditional compilation parameters. +# +################################################################################ + +setenv WITH_TRIO 1 # Configure trio support. +setenv WITH_THREADS 1 # Configure thread support. +setenv WITH_THREAD_ALLOC 1 # Whether allocation hooks are per-thread. +setenv WITH_TREE 1 # Compile DOM tree API. +setenv WITH_OUTPUT 1 # Compile serialization/saving support. +setenv WITH_PUSH 1 # Compile push parser. +setenv WITH_READER 1 # Compile parsing interface. +setenv WITH_PATTERN 1 # Compile pattern node selection interface. +setenv WITH_WRITER 1 # Compile saving interface. +setenv WITH_SAX1 1 # Compile SAX version 1 interface. +setenv WITH_FTP 1 # Compile FTP support. +setenv WITH_HTTP 1 # Compile HTTP support. +setenv WITH_VALID 1 # Compile DTD validation support. +setenv WITH_HTML 1 # Compile HTML support. +setenv WITH_LEGACY 1 # Compile deprecated API. +setenv WITH_C14N 1 # Compile canonicalization support. +setenv WITH_CATALOG 1 # Compile catalog support. +setenv WITH_DOCB 1 # Compile SGML Docbook support. +setenv WITH_XPATH 1 # Compile XPath support. +setenv WITH_XPTR 1 # Compile XPointer support. +setenv WITH_XINCLUDE 1 # Compile XInclude support. +setenv WITH_ICONV 1 # Whether iconv support is available. +setenv WITH_ICU 0 # Whether icu support is available. +setenv WITH_ISO8859X 1 # Compile ISO-8859-* support if no iconv. +setenv WITH_DEBUG 1 # Compile debugging module. +setenv WITH_MEM_DEBUG 1 # Compile memory debugging module. +setenv WITH_RUN_DEBUG 1 # Compile runtime debugging. +setenv WITH_REGEXPS 1 # Compile regular expression interfaces. +setenv WITH_SCHEMAS 1 # Compile schema validation interface. +setenv WITH_SCHEMATRON 1 # Compile schematron validation interface. +setenv WITH_MODULES 1 # Compile module interfaces. +setenv WITH_ZLIB 0 # Whether zlib is available. +setenv WITH_LZMA 0 # Whether LZMA is available. + +# Define ZLIB locations. This is ignored if WITH_ZLIB is 0. + +setenv ZLIB_INCLUDE '/zlib/include' # ZLIB include IFS directory. +setenv ZLIB_LIB 'ZLIB' # ZLIB library. +setenv ZLIB_BNDDIR 'ZLIB_A' # ZLIB binding directory. + +################################################################################ +# +# OS/400 specific definitions. +# +################################################################################ + +setenv LIBIFSNAME "/QSYS.LIB/${TARGETLIB}.LIB" +setenv MODULE_EXTENSION '.SRVPGM' + + +################################################################################ +# +# Extract version information. +# +################################################################################ + + +# Need to get the version definitions. + +eval "`grep '^LIBXML_[A-Z]*_VERSION=' \"${TOPDIR}/configure.in\"`" +eval "`grep '^LIBXML_MICRO_VERSION_SUFFIX=' \"${TOPDIR}/configure.in\"`" +LIBXML_VERSION="${LIBXML_MAJOR_VERSION}.${LIBXML_MINOR_VERSION}" +LIBXML_VERSION="${LIBXML_VERSION}.${LIBXML_MICRO_VERSION}" +LIBXML_VERSION="${LIBXML_VERSION}${LIBXML_MICRO_VERSION_SUFFIX}" +LIBXML_VERSION_NUMBER=`expr "${LIBXML_MAJOR_VERSION}" \* 10000 + \ + "${LIBXML_MINOR_VERSION}" \* 100 + \ + "${LIBXML_MICRO_VERSION}"` +export LIBXML_MAJOR_VERSION LIBXML_MINOR_VERSION +export LIBXML_MICRO_VERSION LIBXML_MICROVERSION_SUFFIX +export LIBXML_VERSION LIBXML_VERSION_NUMBER +setenv LIBXML_VERSION_EXTRA '' +setenv VERSION "${LIBXML_VERSION}" + + +################################################################################ +# +# Procedures. +# +################################################################################ + +# action_needed dest [src] +# +# dest is an object to build +# if specified, src is an object on which dest depends. +# +# exit 0 (succeeds) if some action has to be taken, else 1. + +action_needed() + +{ + [ ! -e "${1}" ] && return 0 + [ "${2}" ] || return 1 + [ "${1}" -ot "${2}" ] && return 0 + return 1 +} + + +# make_module module_name source_name [additional_definitions] +# +# Compile source name into ASCII module if needed. +# As side effect, append the module name to variable MODULES. +# Set LINK to "YES" if the module has been compiled. + +make_module() + +{ + MODULES="${MODULES} ${1}" + MODIFSNAME="${LIBIFSNAME}/${1}.MODULE" + action_needed "${MODIFSNAME}" "${2}" || return 0; + + # #pragma convert has to be in the source file itself, i.e. + # putting it in an include file makes it only active + # for that include file. + # Thus we build a temporary file with the pragma prepended to + # the source file and we compile that temporary file. + + rm -f __tmpsrcf.c + if [ "${4}" != 'ebcdic' ] + then echo "#line 1 \"${2}\"" >> __tmpsrcf.c + echo "#pragma convert(819)" >> __tmpsrcf.c + echo '#include "wrappers.h"' >> __tmpsrcf.c + fi + echo "#line 1 \"${2}\"" >> __tmpsrcf.c + cat "${2}" >> __tmpsrcf.c + CMD="CRTCMOD MODULE(${TARGETLIB}/${1}) SRCSTMF('__tmpsrcf.c')" +# CMD="${CMD} OPTION(*INCDIRFIRST *SHOWINC *SHOWSYS)" + CMD="${CMD} OPTION(*INCDIRFIRST)" + CMD="${CMD} SYSIFCOPT(*IFS64IO) LANGLVL(*EXTENDED) LOCALETYPE(*LOCALE)" + CMD="${CMD} INCDIR(" + CMD="${CMD} '${TOPDIR}/os400/iconv'" + if [ "${4}" != 'ebcdic' ] + then CMD="${CMD} '/qibm/proddata/qadrt/include'" + fi + CMD="${CMD} '${TOPDIR}/os400' '${TOPDIR}/os400/dlfcn'" + CMD="${CMD} '${IFSDIR}/include/libxml' '${IFSDIR}/include'" + if [ "${ZLIB_INCLUDE}" ] + then CMD="${CMD} '${ZLIB_INCLUDE}'" + fi + CMD="${CMD} '${TOPDIR}' ${INCLUDES})" + CMD="${CMD} TGTCCSID(${TGTCCSID}) TGTRLS(${TGTRLS})" + CMD="${CMD} OUTPUT(${OUTPUT})" + CMD="${CMD} OPTIMIZE(${OPTIMIZE})" + CMD="${CMD} DBGVIEW(${DEBUG})" + CMD="${CMD} DEFINE('_REENTRANT' 'TRIO_HAVE_CONFIG_H' 'NDEBUG' ${3})" + + system "${CMD}" + rm -f __tmpsrcf.c + LINK=YES +} + + +# Determine DB2 object name from IFS name. + +db2_name() + +{ + if [ "${2}" = 'nomangle' ] + then basename "${1}" | + tr 'a-z-' 'A-Z_' | + sed -e 's/\..*//' \ + -e 's/^\(..........\).*$/\1/' + else basename "${1}" | + tr 'a-z-' 'A-Z_' | + sed -e 's/\..*//' \ + -e 's/^TEST/T/' \ + -e 's/^XML/X/' \ + -e 's/^\(.\).*\(.........\)$/\1\2/' + fi +} + + +# Copy IFS file replacing version & configuration info. + +versioned_copy() + +{ + sed -e "s/@LIBXML_VERSION@/${LIBXML_VERSION}/g" \ + \ + -e "s#@LIBXML_MAJOR_VERSION@#${LIBXML_MAJOR_VERSION}#g" \ + -e "s#@LIBXML_MINOR_VERSION@#${LIBXML_MINOR_VERSION}#g" \ + -e "s#@LIBXML_MICRO_VERSION@#${LIBXML_MICRO_VERSION}#g" \ + -e "s#@LIBXML_MICRO_VERSION_SUFFIX@#${LIBXML_MICRO_VERSION_SUFFIX}#g" \ + -e "s#@LIBXML_VERSION@#${LIBXML_VERSION}#g" \ + -e "s#@LIBXML_VERSION_NUMBER@#${LIBXML_VERSION_NUMBER}#g" \ + -e "s#@LIBXML_VERSION_EXTRA@#${LIBXML_VERSION_EXTRA}#g" \ + -e "s#@VERSION@#${VERSION}#g" \ + -e "s#@WITH_TRIO@#${WITH_TRIO}#g" \ + -e "s#@WITH_THREADS@#${WITH_THREADS}#g" \ + -e "s#@WITH_THREAD_ALLOC@#${WITH_THREAD_ALLOC}#g" \ + -e "s#@WITH_TREE@#${WITH_TREE}#g" \ + -e "s#@WITH_OUTPUT@#${WITH_OUTPUT}#g" \ + -e "s#@WITH_PUSH@#${WITH_PUSH}#g" \ + -e "s#@WITH_READER@#${WITH_READER}#g" \ + -e "s#@WITH_PATTERN@#${WITH_PATTERN}#g" \ + -e "s#@WITH_WRITER@#${WITH_WRITER}#g" \ + -e "s#@WITH_SAX1@#${WITH_SAX1}#g" \ + -e "s#@WITH_FTP@#${WITH_FTP}#g" \ + -e "s#@WITH_HTTP@#${WITH_HTTP}#g" \ + -e "s#@WITH_VALID@#${WITH_VALID}#g" \ + -e "s#@WITH_HTML@#${WITH_HTML}#g" \ + -e "s#@WITH_LEGACY@#${WITH_LEGACY}#g" \ + -e "s#@WITH_C14N@#${WITH_C14N}#g" \ + -e "s#@WITH_CATALOG@#${WITH_CATALOG}#g" \ + -e "s#@WITH_DOCB@#${WITH_DOCB}#g" \ + -e "s#@WITH_XPATH@#${WITH_XPATH}#g" \ + -e "s#@WITH_XPTR@#${WITH_XPTR}#g" \ + -e "s#@WITH_XINCLUDE@#${WITH_XINCLUDE}#g" \ + -e "s#@WITH_ICONV@#${WITH_ICONV}#g" \ + -e "s#@WITH_ICU@#${WITH_ICU}#g" \ + -e "s#@WITH_ISO8859X@#${WITH_ISO8859X}#g" \ + -e "s#@WITH_DEBUG@#${WITH_DEBUG}#g" \ + -e "s#@WITH_MEM_DEBUG@#${WITH_MEM_DEBUG}#g" \ + -e "s#@WITH_RUN_DEBUG@#${WITH_RUN_DEBUG}#g" \ + -e "s#@WITH_REGEXPS@#${WITH_REGEXPS}#g" \ + -e "s#@WITH_SCHEMAS@#${WITH_SCHEMAS}#g" \ + -e "s#@WITH_SCHEMATRON@#${WITH_SCHEMATRON}#g" \ + -e "s#@WITH_MODULES@#${WITH_MODULES}#g" \ + -e "s#@WITH_ZLIB@#${WITH_ZLIB}#g" \ + -e "s#@WITH_LZMA@#${WITH_LZMA}#g" +} diff --git a/os400/make-bldcsndfa.sh b/os400/make-bldcsndfa.sh new file mode 100644 index 00000000..57cf0120 --- /dev/null +++ b/os400/make-bldcsndfa.sh @@ -0,0 +1,43 @@ +#!/bin/sh +# +# Compilation script for the iconv names DFA builer. +# +# See Copyright for the status of this software. +# +# Author: Patrick Monnerat , DATASPHERE S.A. +# + +SCRIPTDIR=`dirname "${0}"` +. "${SCRIPTDIR}/initscript.sh" +cd "${TOPDIR}/os400/iconv/bldcsndfa" + + +# This is for old XML library (bootstrapping). +#rm -rf xml.h xml +#ln -s /QSYS.LIB/XML.LIB/H.FILE/XML.MBR xml.h +#mkdir xml +#mkdir xml/h +#ln -s /QSYS.LIB/XML.LIB/H.FILE/UTF8.MBR xml/h/utf8 + + +# Compile. + +CMD="CRTCMOD MODULE(${TARGETLIB}/BLDCSNDFA) SRCSTMF('bldcsndfa.c')" +CMD="${CMD} SYSIFCOPT(*IFS64IO) LANGLVL(*EXTENDED) LOCALETYPE(*LOCALE)" +CMD="${CMD} INCDIR(" +CMD="${CMD} '${IFSDIR}/include' ${INCLUDES})" +CMD="${CMD} TGTCCSID(${TGTCCSID}) TGTRLS(${TGTRLS})" +CMD="${CMD} OUTPUT(${OUTPUT})" +CMD="${CMD} OPTIMIZE(10)" +CMD="${CMD} DBGVIEW(${DEBUG})" +#CMD="${CMD} DEFINE('OLDXML' 'xmlXPathSetContextNode=xmlXPathSetCurrentNode')" + +system "${CMD}" + +# Link + +CMD="CRTPGM PGM(${TARGETLIB}/BLDCSNDFA) MODULE(${TARGETLIB}/BLDCSNDFA)" +CMD="${CMD} BNDDIR(${TARGETLIB}/${DYNBNDDIR})" +#CMD="${CMD} BNDDIR(XML/XML)" +CMD="${CMD} TGTRLS(${TGTRLS})" +system "${CMD}" diff --git a/os400/make-include.sh b/os400/make-include.sh new file mode 100644 index 00000000..4e5b0589 --- /dev/null +++ b/os400/make-include.sh @@ -0,0 +1,81 @@ +#!/bin/sh +# +# Installation of the C header files in the OS/400 library. +# +# See Copyright for the status of this software. +# +# Author: Patrick Monnerat , DATASPHERE S.A. +# + +SCRIPTDIR=`dirname "${0}"` +. "${SCRIPTDIR}/initscript.sh" +cd "${TOPDIR}/include" + + +# Create the OS/400 source program file for the C header files. + +SRCPF="${LIBIFSNAME}/LIBXML.FILE" + +if action_needed "${SRCPF}" +then CMD="CRTSRCPF FILE(${TARGETLIB}/LIBXML) RCDLEN(112)" + CMD="${CMD} CCSID(${TGTCCSID}) TEXT('libxml2: C/C++ header files')" + system "${CMD}" +fi + + +# Create the IFS directory for the C header files. + +if action_needed "${IFSDIR}/include/libxml" +then mkdir -p "${IFSDIR}/include/libxml" +fi + + + +# Enumeration values may be used as va_arg tagfields, so they MUST be +# integers. + +copy_hfile() + +{ + sed -e '1i\ +#pragma enum(int)\ +' "${@}" -e '$a\ +#pragma enum(pop)\ +' +} + +# Copy the header files to DB2 library. Link from IFS include directory. + +for HFILE in "${TOPDIR}/os400/transcode.h" libxml/*.h libxml/*.h.in +do CMD="cat \"${HFILE}\"" + DEST="${SRCPF}/`db2_name \"${HFILE}\" nomangle`.MBR" + + case "`basename \"${HFILE}\"`" in + + xmlwin32version.h*) + continue;; # Not on M$W ! + + *.in) CMD="${CMD} | versioned_copy";; + + xmlschemastypes.h) # Special case: rename colliding file. + DEST="${SRCPF}/SCHMTYPES.MBR";; + + esac + + if action_needed "${DEST}" "${HFILE}" + then eval "${CMD}" | copy_hfile > tmphdrfile + + # Need to translate to target CCSID. + + CMD="CPY OBJ('`pwd`/tmphdrfile') TOOBJ('${DEST}')" + CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)" + system "${CMD}" + fi + + IFSFILE="${IFSDIR}/include/libxml/`basename \"${HFILE}\" .in`" + + if action_needed "${IFSFILE}" "${DEST}" + then rm -f "${IFSFILE}" + ln -s "${DEST}" "${IFSFILE}" + fi +done diff --git a/os400/make-rpg.sh b/os400/make-rpg.sh new file mode 100644 index 00000000..95d3249c --- /dev/null +++ b/os400/make-rpg.sh @@ -0,0 +1,97 @@ +#!/bin/sh +# +# Installation of the ILE/RPG header files in the OS/400 library. +# +# See Copyright for the status of this software. +# +# Author: Patrick Monnerat , DATASPHERE S.A. +# + +SCRIPTDIR=`dirname "${0}"` +. "${SCRIPTDIR}/initscript.sh" +cd "${TOPDIR}/os400/libxmlrpg" + + +# Create the OS/400 source program file for the ILE/RPG header files. + +SRCPF="${LIBIFSNAME}/LIBXMLRPG.FILE" + +if action_needed "${SRCPF}" +then CMD="CRTSRCPF FILE(${TARGETLIB}/LIBXMLRPG) RCDLEN(112)" + CMD="${CMD} CCSID(${TGTCCSID}) TEXT('libxml2: ILE/RPG header files')" + system "${CMD}" +fi + + +# Map file names to DB2 name syntax. + +> tmpsubstfile + +for HFILE in *.rpgle *.rpgle.in +do NAME="`basename \"${HFILE}\" .in`" + VAR="`basename \"${NAME}\" .rpgle`" + VAL="`db2_name \"${NAME}\" nomangle`" + + if [ "${VAR}" = 'xmlschemastypes' ] + then VAL=SCHMTYPES + fi + + echo "s/${VAR}/${VAL}/g" >> tmpsubstfile + eval "VAR_${VAR}=\"${VAL}\"" +done + + +change_include() + +{ + sed -e '\#^....../include *"libxmlrpg/#{' \ + -e 's///' \ + -e 's/".*//' \ + -f tmpsubstfile \ + -e 's#.*# /include libxmlrpg,&#' \ + -e '}' +} + + +# Create the IFS directory for the ILE/RPG header files. + +RPGIFSDIR="${IFSDIR}/include/libxmlrpg" + +if action_needed "${RPGIFSDIR}" +then mkdir -p "${RPGIFSDIR}" +fi + +# Copy the header files to IFS ILE/RPG include directory. +# Copy them with include path editing to the DB2 library. + +for HFILE in *.rpgle *.rpgle.in +do IFSCMD="cat \"${HFILE}\"" + DB2CMD="change_include < \"${HFILE}\"" + IFSFILE="`basename \"${HFILE}\" .in`" + + case "${HFILE}" in + + *.in) IFSCMD="${IFSCMD} | versioned_copy" + DB2CMD="${DB2CMD} | versioned_copy" + ;; + esac + + IFSDEST="${RPGIFSDIR}/${IFSFILE}" + + if action_needed "${IFSDEST}" "${HFILE}" + then eval "${IFSCMD}" > "${IFSDEST}" + fi + + eval DB2MBR="\"\${VAR_`basename \"${IFSDEST}\" .rpgle`}\"" + DB2DEST="${SRCPF}/${DB2MBR}.MBR" + + if action_needed "${DB2DEST}" "${HFILE}" + then eval "${DB2CMD}" | change_include > tmphdrfile + + # Need to translate to target CCSID. + + CMD="CPY OBJ('`pwd`/tmphdrfile') TOOBJ('${DB2DEST}')" + CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)" + system "${CMD}" + fi +done diff --git a/os400/make-src.sh b/os400/make-src.sh new file mode 100644 index 00000000..ccc8ec7e --- /dev/null +++ b/os400/make-src.sh @@ -0,0 +1,241 @@ +#!/bin/sh +# +# libxml compilation script for the OS/400. +# +# See Copyright for the status of this software. +# +# Author: Patrick Monnerat , DATASPHERE S.A. +# + +SCRIPTDIR=`dirname "${0}"` +. "${SCRIPTDIR}/initscript.sh" +cd "${TOPDIR}" + + +# Create and compile the identification source file. + +echo '#pragma comment(user, "libxml2 version '"${LIBXML_VERSION}"'")' > os400.c +echo '#pragma comment(user, __DATE__)' >> os400.c +echo '#pragma comment(user, __TIME__)' >> os400.c +echo '#pragma comment(copyright, "Copyright (C) 1998-2013 Daniel Veillard. OS/400 version by P. Monnerat.")' >> os400.c +make_module OS400 os400.c +LINK= # No need to rebuild service program yet. +MODULES= + + +# Get source list. + +foldlines() + +{ + sed -e ':begin' \ + -e '/\\$/{' \ + -e 's/\\$/ /' \ + -e 'N' \ + -e 'bbegin' \ + -e '}' \ + -e 's/\n//g' \ + -e 's/[[:space:]]*$//' +} + + +get_make_var() + +{ + foldlines < Makefile.am | + sed -e "/^${1}[[:space:]]*=[[:space:]]*/{" \ + -e 's///' \ + -e 'q' \ + -e '}' \ + -e 'd' +} + + +docb_sources=`get_make_var docb_sources` +trio_sources=`get_make_var trio_sources` +CSOURCES=`eval echo "\`get_make_var libxml2_la_SOURCES | tr '()' '{}'\`"` + + +# Compile the sources into modules. + +INCLUDES="'`pwd`'" + +# OS/400 specific modules first. + +make_module DLFCN "${SCRIPTDIR}/dlfcn/dlfcn.c" '' ebcdic +make_module ICONV "${SCRIPTDIR}/iconv/iconv.c" '' ebcdic +make_module WRAPPERS "${SCRIPTDIR}/wrappers.c" '' ebcdic +make_module TRANSCODE "${SCRIPTDIR}/transcode.c" +make_module RPGSUPPORT "${SCRIPTDIR}/rpgsupport.c" + +# Regular libxml2 modules. + +for SRC in ${CSOURCES} +do MODULE=`db2_name "${SRC}"` + make_module "${MODULE}" "${SRC}" +done + + +# If needed, (re)create the static binding directory. + +if action_needed "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR" +then LINK=YES +fi + +if [ "${LINK}" ] +then rm -rf "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR" + CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${STATBNDDIR})" + CMD="${CMD} TEXT('libxml2 static binding directory')" + system "${CMD}" + + for MODULE in ${MODULES} + do CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${STATBNDDIR})" + CMD="${CMD} OBJ((${TARGETLIB}/${MODULE} *MODULE))" + system "${CMD}" + done +fi + + +# The exportation file for service program creation must be in a DB2 +# source file, so make sure it exists. + +if action_needed "${LIBIFSNAME}/TOOLS.FILE" +then CMD="CRTSRCPF FILE(${TARGETLIB}/TOOLS) RCDLEN(112)" + CMD="${CMD} TEXT('libxml2: build tools')" + system "${CMD}" +fi + + +# Generate all exported symbol table versions in a binding source file. + +BSF="${LIBIFSNAME}/TOOLS.FILE/BNDSRC.MBR" +PGMEXPS= + +OS400SYMS=`cat os400/transcode.h os400/rpgsupport.h | + sed -e 'H' \ + -e 'g' \ + -e 's/\n/ /' \ + -e 's/\\$/ /' \ + -e 's/.*/& /' \ + -e 's/\/\*.*\*\// /g' \ + -e 'h' \ + -e ':loop' \ + -e 'g' \ + -e '/\/\*/d' \ + -e '/;/!d' \ + -e 's/[^;]*;//' \ + -e 'x' \ + -e 's/[[:space:]]*;.*$//' \ + -e '/XMLPUBFUN/{' \ + -e 's/[[:space:]]*(.*$//' \ + -e 's/.*[[:space:]*]//' \ + -e 'p' \ + -e 'bloop' \ + -e '}' \ + -e '/XMLPUBVAR/!bloop' \ + -e ':loop2' \ + -e '/\[[^][]*\]/{' \ + -e 's///' \ + -e 'bloop2' \ + -e '}' \ + -e 's/[[:space:]]*,[[:space:]]*/,/g' \ + -e 's/[^,]*[[:space:]*]//' \ + -e 's/[^[:alnum:]_,]//g' \ + -e 's/,/\n/g' \ + -e 'p' \ + -e 'bloop'` + +sed -e 's/#.*//' \ + -e 's/[[:space:]]*$//' \ + -e 's/^[[:space:]]*//' \ + -e '/^*global:$/d' \ + -e '/^$/d' \ + -e '/[[:space:]]*{$/{' \ + -e 's///' \ + -e 'h' \ + -e 's/[^A-Za-z0-9]/_/g' \ + -e 's/^[0-9]/_&/' \ + -e 'x' \ + -e 'G' \ + -e 's/\(.*\)\n\(.*\)/\2_SIGNATURE="\1"/' \ + -e 'p' \ + -e 's/.*//' \ + -e 'x' \ + -e "s/.*/SONAME='&'/" \ + -e 'b' \ + -e '}' \ + -e '/[[:space:]]*;$/!d' \ + -e 's///' \ + -e '/^xmlDllMain$/d' \ + -e '/^}[[:space:]]*/!{' \ + -e 'H' \ + -e 'd' \ + -e '}' \ + -e 's///' \ + -e '/^$/!{' \ + -e 's/[^A-Za-z0-9]/_/g' \ + -e 's/^[0-9]/_&/' \ + -e 's/.*/${&}/' \ + -e 'x' \ + -e 'H' \ + -e 's/.*//' \ + -e '}' \ + -e 'x' \ + -e 's/\n/ /g' \ + -e 's/^[[:space:]]*//' \ + -e 's/.*/declare ${SONAME}="&"/' \ + -e 's/.*/&; PGMEXPS="${SONAME} ${PGMEXPS}"/' \ + < "${TOPDIR}/libxml2.syms" > bndvars +. ./bndvars + +PGMLVL=CURRENT +for PGMEXP in ${PGMEXPS} +do SIGNATURE=`echo "${PGMEXP}" | sed 's/^LIBXML2_//'` + eval ENTRIES=\"\${${PGMEXP}}\" + echo " STRPGMEXP PGMLVL(*${PGMLVL}) SIGNATURE('${SIGNATURE}')" + for ENTRY in ${OS400SYMS} ${ENTRIES} + do echo " EXPORT SYMBOL('${ENTRY}')" + done + echo ' ENDPGMEXP' + PGMLVL=PRV +done > "${BSF}" + + +# Build the service program if needed. + +if action_needed "${LIBIFSNAME}/${SRVPGM}.SRVPGM" +then LINK=YES +fi + +if [ "${LINK}" ] +then CMD="CRTSRVPGM SRVPGM(${TARGETLIB}/${SRVPGM})" + CMD="${CMD} SRCFILE(${TARGETLIB}/TOOLS) SRCMBR(BNDSRC)" + CMD="${CMD} MODULE(${TARGETLIB}/OS400)" + CMD="${CMD} BNDDIR((${TARGETLIB}/${STATBNDDIR})" + if [ "${WITH_ZLIB}" -ne 0 ] + then CMD="${CMD} (${ZLIB_LIB}/${ZLIB_BNDDIR})" + fi + CMD="${CMD})" + CMD="${CMD} BNDSRVPGM(QADRTTS)" + CMD="${CMD} TEXT('libxml2 dynamic library')" + CMD="${CMD} TGTRLS(${TGTRLS})" + system "${CMD}" + LINK=YES +fi + + +# If needed, (re)create the dynamic binding directory. + +if action_needed "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR" +then LINK=YES +fi + +if [ "${LINK}" ] +then rm -rf "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR" + CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${DYNBNDDIR})" + CMD="${CMD} TEXT('libxml2 dynamic binding directory')" + system "${CMD}" + CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${DYNBNDDIR})" + CMD="${CMD} OBJ((*LIBL/${SRVPGM} *SRVPGM))" + system "${CMD}" +fi diff --git a/os400/make.sh b/os400/make.sh new file mode 100644 index 00000000..836c339c --- /dev/null +++ b/os400/make.sh @@ -0,0 +1,72 @@ +#!/bin/sh +# +# libxml2 compilation script for the OS/400. +# This is a shell script since make is not a standard component of OS/400. +# +# See Copyright for the status of this software. +# +# Author: Patrick Monnerat , DATASPHERE S.A. +# + +SCRIPTDIR=`dirname "${0}"` +. "${SCRIPTDIR}/initscript.sh" +cd "${TOPDIR}" + + +# Create the OS/400 library if it does not exist. + +if action_needed "${LIBIFSNAME}" +then CMD="CRTLIB LIB(${TARGETLIB})" + CMD="${CMD} TEXT('libxml2: XML parser and toolkit API')" + system "${CMD}" +fi + + +# Create the DOCS source file if it does not exist. + +if action_needed "${LIBIFSNAME}/DOCS.FILE" +then CMD="CRTSRCPF FILE(${TARGETLIB}/DOCS) RCDLEN(112)" + CMD="${CMD} CCSID(${TGTCCSID}) TEXT('Documentation texts')" + system "${CMD}" +fi + + +# Copy some documentation files if needed. + +for TEXT in "${TOPDIR}/AUTHORS" "${TOPDIR}/ChangeLog" \ + "${TOPDIR}/Copyright" "${TOPDIR}/HACKING" "${TOPDIR}/README" \ + "${TOPDIR}/MAINTAINERS" "${TOPDIR}/NEWS" "${TOPDIR}/TODO" \ + "${TOPDIR}/TODO_SCHEMAS" "${TOPDIR}/os400/README400" +do MEMBER="`basename \"${TEXT}\" .OS400`" + MEMBER="${LIBIFSNAME}/DOCS.FILE/`db2_name \"${MEMBER}\"`.MBR" + + if action_needed "${MEMBER}" "${TEXT}" + then CMD="CPY OBJ('${TEXT}') TOOBJ('${MEMBER}') TOCCSID(${TGTCCSID})" + CMD="${CMD} DTAFMT(*TEXT) REPLACE(*YES)" + system "${CMD}" + fi +done + + +# Build files from template. + +configFile() + +{ + args=`set | sed -e '/^[A-Za-z_][A-Za-z0-9_]*=/!d' \ + -e 's/[\/\\\\&]/\\\\&/g' \ + -e "s/'/'\\\\\\''/g" \ + -e 's/^\([^=]*\)=\(.*\)$/-e '\''s\/@\1@\/\2\/g'\'/` + eval sed ${args} < "${1}".in > "${1}" +} + +configFile include/libxml/xmlversion.h +configFile os400/os400config.h +mv os400/os400config.h config.h + + +# Build in each directory. + +for SUBDIR in include rpg src +do "${SCRIPTDIR}/make-${SUBDIR}.sh" +done diff --git a/os400/os400config.h.in b/os400/os400config.h.in new file mode 100644 index 00000000..3966ac81 --- /dev/null +++ b/os400/os400config.h.in @@ -0,0 +1,353 @@ +/** +*** Configuration parameters for the OS/400 implementation. +*** +*** See Copyright for the status of this software. +*** +*** Author: Patrick Monnerat , DATASPHERE S.A. +**/ + +/* Define to 1 if you have the header file. */ +#undef HAVE_ANSIDECL_H + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_NAMESER_H 1 + +/* Whether struct sockaddr::__ss_family exists */ +#undef HAVE_BROKEN_SS_FAMILY + +/* Define to 1 if you have the `class' function. */ +#undef HAVE_CLASS + +/* Define to 1 if you have the header file. */ +#define HAVE_CTYPE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 /* Locally emulated. */ + +/* Have dlopen based dso */ +#define HAVE_DLOPEN 1 /* Locally emulated. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_DL_H + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `finite' function. */ +#undef HAVE_FINITE + +/* Define to 1 if you have the header file. */ +#define HAVE_FLOAT_H 1 + +/* Define to 1 if you have the `fpclass' function. */ +#undef HAVE_FPCLASS + +/* Define to 1 if you have the `fprintf' function. */ +#undef HAVE_FPRINTF /* Use trio. */ + +/* Define to 1 if you have the `fp_class' function. */ +#undef HAVE_FP_CLASS + +/* Define to 1 if you have the header file. */ +#undef HAVE_FP_CLASS_H + +/* Define to 1 if you have the `ftime' function. */ +#undef HAVE_FTIME + +/* Define if getaddrinfo is there */ +#define HAVE_GETADDRINFO 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the header file. */ +#undef HAVE_IEEEFP_H + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `isascii' function. */ +#define HAVE_ISASCII 1 + +/* Define if isinf is there */ +#undef HAVE_ISINF + +/* Define if isnan is there */ +#undef HAVE_ISNAN + +/* Define to 1 if you have the `isnand' function. */ +#undef HAVE_ISNAND + +/* Define if history library is there (-lhistory) */ +#undef HAVE_LIBHISTORY + +/* Have compression library */ +#undef HAVE_LIBLZMA + +/* Define if pthread library is there (-lpthread) */ +#undef HAVE_LIBPTHREAD + +/* Define if readline library is there (-lreadline) */ +#undef HAVE_LIBREADLINE + +/* Have compression library */ +#undef HAVE_LIBZ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the `localtime' function. */ +#define HAVE_LOCALTIME 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_LZMA_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MALLOC_H + +/* Define to 1 if you have the header file. */ +#define HAVE_MATH_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mmap' function. */ +#undef HAVE_MMAP + +/* Define to 1 if you have the `munmap' function. */ +#undef HAVE_MUNMAP + +/* mmap() is no good without munmap() */ +#if defined(HAVE_MMAP) && !defined(HAVE_MUNMAP) +# undef /**/ HAVE_MMAP +#endif + +/* Define to 1 if you have the header file. */ +#undef HAVE_NAN_H + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +#undef HAVE_NDIR_H + +/* Define to 1 if you have the header file. */ +#define HAVE_NETDB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_POLL_H + +/* Define to 1 if you have the `printf' function. */ +#undef HAVE_PRINTF /* Use trio. */ + +/* Define to 1 if you have the `vprintf' function. */ +#undef HAVE_VPRINTF /* Use trio. */ + +/* Define if is there */ +#define HAVE_PTHREAD_H 1 + +/* Define to 1 if you have the `putenv' function. */ +#define HAVE_PUTENV 1 + +/* Define to 1 if you have the `rand' function. */ +#define HAVE_RAND 1 + +/* Define to 1 if you have the `rand_r' function. */ +#define HAVE_RAND_R 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_RESOLV_H 1 + +/* Have shl_load based dso */ +#undef HAVE_SHLLOAD + +/* Define to 1 if you have the `signal' function. */ +#undef HAVE_SIGNAL + +/* Define to 1 if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF /* Use trio. */ + +/* Define to 1 if you have the `sprintf' function. */ +#undef HAVE_SPRINTF /* Use trio. */ + +/* Define to 1 if you have the `srand' function. */ +#define HAVE_SRAND 1 + +/* Define to 1 if you have the `scanf' function. */ +#undef HAVE_SCANF /* Use trio. */ + +/* Define to 1 if you have the `fscanf' function. */ +#undef HAVE_FSCANF /* Use trio. */ + +/* Define to 1 if you have the `sscanf' function. */ +#undef HAVE_SSCANF /* Use trio. */ + +/* Define to 1 if you have the `stat' function. */ +#define HAVE_STAT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDARG_H 1 /* Overloaded */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the `strftime' function. */ +#define HAVE_STRFTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strndup' function. */ +#undef HAVE_STRNDUP + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_DIR_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_MMAN_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_NDIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIMEB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the `time' function. */ +#define HAVE_TIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Whether va_copy() is available */ +#undef HAVE_VA_COPY + +/* Define to 1 if you have the `vfprintf' function. */ +#undef HAVE_VFPRINTF /* Use trio. */ + +/* Define to 1 if you have the `vsnprintf' function. */ +#undef HAVE_VSNPRINTF /* Use trio. */ + +/* Define to 1 if you have the `vsprintf' function. */ +#undef HAVE_VSPRINTF /* Use trio. */ + +/* Define to 1 if you have the header file. */ +/* Actually dependent on the compilation script. */ +#if @WITH_ZLIB@ +#define HAVE_ZLIB_H 1 +#else +#undef HAVE_ZLIB_H +#endif + +/* Define to 1 if you have the `_stat' function. */ +#undef HAVE__STAT + +/* Whether __va_copy() is available */ +#undef HAVE___VA_COPY + +/* Define as const if the declaration of iconv() needs const. */ +#define ICONV_CONST + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Name of package */ +#define PACKAGE "libxml2" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Support for IPv6 */ +#define SUPPORT_IP6 + +/* Version number of package */ +#define VERSION "@VERSION@" + +/* Determine what socket length (socklen_t) data type is */ +#define XML_SOCKLEN_T socklen_t + +/* Define for Solaris 2.5.1 so the uint32_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT32_T + +/* Using the Win32 Socket implementation */ +#undef _WINSOCKAPI_ + +/* ss_family is not defined here, use __ss_family instead */ +#undef ss_family + +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +#undef uint32_t + +/* Type cast for the send() function 2nd arg */ +#define SEND_ARG2_CAST (char *) + +/* Type cast for the gethostbyname() argument */ +#define GETHOSTBYNAME_ARG_CAST (char *) + +/* Define if va_list is an array type */ +#define VA_LIST_IS_ARRAY 1