3 # Installation of the ILE/RPG header files in the OS/400 library.
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"
12 cd "${TOPDIR}/os400/libxmlrpg"
15 # Create the OS/400 source program file for the ILE/RPG header files.
17 SRCPF="${LIBIFSNAME}/LIBXMLRPG.FILE"
19 if action_needed "${SRCPF}"
20 then CMD="CRTSRCPF FILE(${TARGETLIB}/LIBXMLRPG) RCDLEN(112)"
21 CMD="${CMD} CCSID(${TGTCCSID}) TEXT('libxml2: ILE/RPG header files')"
26 # Map file names to DB2 name syntax.
28 for HFILE in *.rpgle *.rpgle.in
29 do NAME="`basename \"${HFILE}\" .in`"
30 VAR="`basename \"${NAME}\" .rpgle`"
31 VAL="`db2_name \"${NAME}\" nomangle`"
33 if [ "${VAR}" = 'xmlschemastypes' ]
37 eval "VAR_${VAR}=\"${VAL}\""
38 echo "${VAR} s/${VAR}/${VAL}/g"
41 # Order substitution commands so that a prefix appears after all
42 # file names beginning with the prefix.
44 sort -r tmpsubstfile1 | sed 's/^[^ ]*[ ]*//' > tmpsubstfile2
50 sed -e '\#^....../include *"libxmlrpg/#{' \
54 -e 's#.*# /include libxmlrpg,&#' \
59 # Create the IFS directory for the ILE/RPG header files.
61 RPGIFSDIR="${IFSDIR}/include/libxmlrpg"
63 if action_needed "${RPGIFSDIR}"
64 then mkdir -p "${RPGIFSDIR}"
67 # Copy the header files to IFS ILE/RPG include directory.
68 # Copy them with include path editing to the DB2 library.
70 for HFILE in *.rpgle *.rpgle.in
71 do IFSCMD="cat \"${HFILE}\""
72 DB2CMD="change_include < \"${HFILE}\""
73 IFSFILE="`basename \"${HFILE}\" .in`"
77 *.in) IFSCMD="${IFSCMD} | versioned_copy"
78 DB2CMD="${DB2CMD} | versioned_copy"
82 IFSDEST="${RPGIFSDIR}/${IFSFILE}"
84 if action_needed "${IFSDEST}" "${HFILE}"
85 then eval "${IFSCMD}" > "${IFSDEST}"
88 eval DB2MBR="\"\${VAR_`basename \"${IFSDEST}\" .rpgle`}\""
89 DB2DEST="${SRCPF}/${DB2MBR}.MBR"
91 if action_needed "${DB2DEST}" "${HFILE}"
92 then eval "${DB2CMD}" | change_include > tmphdrfile
94 # Need to translate to target CCSID.
96 CMD="CPY OBJ('`pwd`/tmphdrfile') TOOBJ('${DB2DEST}')"
97 CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)"