3 # libxml2 compilation script for the OS/400.
4 # This is a shell script since make is not a standard component of OS/400.
6 # See Copyright for the status of this software.
8 # Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
11 SCRIPTDIR=`dirname "${0}"`
12 . "${SCRIPTDIR}/initscript.sh"
16 # Create the OS/400 library if it does not exist.
18 if action_needed "${LIBIFSNAME}"
19 then CMD="CRTLIB LIB(${TARGETLIB})"
20 CMD="${CMD} TEXT('libxml2: XML parser and toolkit API')"
25 # Create the DOCS source file if it does not exist.
27 if action_needed "${LIBIFSNAME}/DOCS.FILE"
28 then CMD="CRTSRCPF FILE(${TARGETLIB}/DOCS) RCDLEN(112)"
29 CMD="${CMD} CCSID(${TGTCCSID}) TEXT('Documentation texts')"
34 # Copy some documentation files if needed.
36 for TEXT in "${TOPDIR}/AUTHORS" "${TOPDIR}/ChangeLog" \
37 "${TOPDIR}/Copyright" "${TOPDIR}/HACKING" "${TOPDIR}/README" \
38 "${TOPDIR}/MAINTAINERS" "${TOPDIR}/NEWS" "${TOPDIR}/TODO" \
39 "${TOPDIR}/TODO_SCHEMAS" "${TOPDIR}/os400/README400"
40 do if [ -f "${TEXT}" ]
41 then MEMBER="`basename \"${TEXT}\" .OS400`"
42 MEMBER="${LIBIFSNAME}/DOCS.FILE/`db2_name \"${MEMBER}\"`.MBR"
44 if action_needed "${MEMBER}" "${TEXT}"
45 then # Sources are in UTF-8.
46 rm -f "${TOPDIR}/tmpfile"[12]
47 CMD="CPY OBJ('${TEXT}') TOOBJ('${TOPDIR}/tmpfile1')"
48 CMD="${CMD} FROMCCSID(1208) TOCCSID(${TGTCCSID})"
49 CMD="${CMD} DTAFMT(*TEXT) REPLACE(*YES)"
51 # Make sure all lines are < 100 characters.
53 /g' -e 's/\n$//' "${TOPDIR}/tmpfile1" > "${TOPDIR}/tmpfile2"
54 CMD="CPY OBJ('${TOPDIR}/tmpfile2') TOOBJ('${MEMBER}')"
55 CMD="${CMD} TOCCSID(${TGTCCSID})"
56 CMD="${CMD} DTAFMT(*TEXT) REPLACE(*YES)"
63 # Build files from template.
68 args=`set | sed -e '/^[A-Za-z_][A-Za-z0-9_]*=/!d' \
69 -e 's/[\/\\\\&]/\\\\&/g' \
70 -e "s/'/'\\\\\\''/g" \
71 -e 's/^\([^=]*\)=\(.*\)$/-e '\''s\/@\1@\/\2\/g'\'/`
72 eval sed ${args} < "${1}".in > "${1}"
75 configFile include/libxml/xmlversion.h
76 configFile os400/os400config.h
77 mv os400/os400config.h config.h
80 # Build in each directory.
82 for SUBDIR in include rpg src
83 do "${SCRIPTDIR}/make-${SUBDIR}.sh"