3 # libxml compilation script for the OS/400.
5 # See Copyright for the status of this software.
7 # Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
10 SCRIPTDIR=`dirname "${0}"`
11 . "${SCRIPTDIR}/initscript.sh"
15 # Create and compile the identification source file.
17 echo '#pragma comment(user, "libxml2 version '"${LIBXML_VERSION}"'")' > os400.c
18 echo '#pragma comment(user, __DATE__)' >> os400.c
19 echo '#pragma comment(user, __TIME__)' >> os400.c
20 echo '#pragma comment(copyright, "Copyright (C) 1998-2014 Daniel Veillard. OS/400 version by P. Monnerat.")' >> os400.c
21 make_module OS400 os400.c
22 LINK= # No need to rebuild service program yet.
38 -e 's/[[:space:]]*$//'
45 foldlines < Makefile.am |
46 sed -e "/^${1}[[:space:]]*=[[:space:]]*/{" \
54 docb_sources=`get_make_var docb_sources`
55 trio_sources=`get_make_var trio_sources`
56 CSOURCES=`eval echo "\`get_make_var libxml2_la_SOURCES | tr '()' '{}'\`"`
59 # Compile the sources into modules.
63 # OS/400 specific modules first.
65 make_module DLFCN "${SCRIPTDIR}/dlfcn/dlfcn.c" '' ebcdic
66 make_module ICONV "${SCRIPTDIR}/iconv/iconv.c" '' ebcdic
67 make_module WRAPPERS "${SCRIPTDIR}/wrappers.c" '' ebcdic
68 make_module TRANSCODE "${SCRIPTDIR}/transcode.c"
69 make_module RPGSUPPORT "${SCRIPTDIR}/rpgsupport.c"
71 # Regular libxml2 modules.
73 for SRC in ${CSOURCES}
74 do MODULE=`db2_name "${SRC}"`
75 make_module "${MODULE}" "${SRC}"
79 # If needed, (re)create the static binding directory.
81 if action_needed "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR"
86 then rm -rf "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR"
87 CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${STATBNDDIR})"
88 CMD="${CMD} TEXT('libxml2 static binding directory')"
91 for MODULE in ${MODULES}
92 do CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${STATBNDDIR})"
93 CMD="${CMD} OBJ((${TARGETLIB}/${MODULE} *MODULE))"
99 # The exportation file for service program creation must be in a DB2
100 # source file, so make sure it exists.
102 if action_needed "${LIBIFSNAME}/TOOLS.FILE"
103 then CMD="CRTSRCPF FILE(${TARGETLIB}/TOOLS) RCDLEN(112)"
104 CMD="${CMD} CCSID(${TGTCCSID}) TEXT('libxml2: build tools')"
109 # Generate all exported symbol table versions in a binding source file.
111 BSF="${LIBIFSNAME}/TOOLS.FILE/BNDSRC.MBR"
114 OS400SYMS=`cat os400/transcode.h os400/rpgsupport.h |
120 -e 's/\/\*.*\*\// /g' \
128 -e 's/[[:space:]]*;.*$//' \
130 -e 's/[[:space:]]*(.*$//' \
131 -e 's/.*[[:space:]*]//' \
135 -e '/XMLPUBVAR/!bloop' \
141 -e 's/[[:space:]]*,[[:space:]]*/,/g' \
142 -e 's/[^,]*[[:space:]*]//' \
143 -e 's/[^[:alnum:]_,]//g' \
149 -e 's/[[:space:]]*$//' \
150 -e 's/^[[:space:]]*//' \
153 -e '/[[:space:]]*{$/{' \
156 -e 's/[^A-Za-z0-9]/_/g' \
160 -e 's/\(.*\)\n\(.*\)/\2_SIGNATURE="\1"/' \
164 -e "s/.*/SONAME='&'/" \
167 -e '/[[:space:]]*;$/!d' \
169 -e '/^xmlDllMain$/d' \
170 -e '/^}[[:space:]]*/!{' \
176 -e 's/[^A-Za-z0-9]/_/g' \
185 -e 's/^[[:space:]]*//' \
186 -e 's/.*/declare ${SONAME}="&"/' \
187 -e 's/.*/&; PGMEXPS="${SONAME} ${PGMEXPS}"/' \
188 < "${TOPDIR}/libxml2.syms" > bndvars
192 for PGMEXP in ${PGMEXPS}
193 do SIGNATURE=`echo "${PGMEXP}" | sed 's/^LIBXML2_//'`
194 eval ENTRIES=\"\${${PGMEXP}}\"
195 echo " STRPGMEXP PGMLVL(*${PGMLVL}) SIGNATURE('${SIGNATURE}')"
196 for ENTRY in ${ENTRIES} ${OS400SYMS}
197 do echo " EXPORT SYMBOL('${ENTRY}')"
204 # Build the service program if needed.
206 if action_needed "${LIBIFSNAME}/${SRVPGM}.SRVPGM"
211 then CMD="CRTSRVPGM SRVPGM(${TARGETLIB}/${SRVPGM})"
212 CMD="${CMD} SRCFILE(${TARGETLIB}/TOOLS) SRCMBR(BNDSRC)"
213 CMD="${CMD} MODULE(${TARGETLIB}/OS400)"
214 CMD="${CMD} BNDDIR((${TARGETLIB}/${STATBNDDIR})"
215 if [ "${WITH_ZLIB}" -ne 0 ]
216 then CMD="${CMD} (${ZLIB_LIB}/${ZLIB_BNDDIR})"
219 CMD="${CMD} BNDSRVPGM(QADRTTS)"
220 CMD="${CMD} TEXT('libxml2 dynamic library')"
221 CMD="${CMD} TGTRLS(${TGTRLS})"
227 # If needed, (re)create the dynamic binding directory.
229 if action_needed "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR"
234 then rm -rf "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR"
235 CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${DYNBNDDIR})"
236 CMD="${CMD} TEXT('libxml2 dynamic binding directory')"
238 CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${DYNBNDDIR})"
239 CMD="${CMD} OBJ((*LIBL/${SRVPGM} *SRVPGM))"