1#!/bin/sh
2#
3#       libxml2 compilation script for the OS/400.
4#       This is a shell script since make is not a standard component of OS/400.
5#
6#       See Copyright for the status of this software.
7#
8#       Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
9#
10
11SCRIPTDIR=`dirname "${0}"`
12. "${SCRIPTDIR}/initscript.sh"
13cd "${TOPDIR}"
14
15
16#       Create the OS/400 library if it does not exist.
17
18if action_needed "${LIBIFSNAME}"
19then    CMD="CRTLIB LIB(${TARGETLIB})"
20        CMD="${CMD} TEXT('libxml2: XML parser and toolkit API')"
21        system "${CMD}"
22fi
23
24
25#       Create the DOCS source file if it does not exist.
26
27if action_needed "${LIBIFSNAME}/DOCS.FILE"
28then    CMD="CRTSRCPF FILE(${TARGETLIB}/DOCS) RCDLEN(112)"
29        CMD="${CMD} CCSID(${TGTCCSID}) TEXT('Documentation texts')"
30        system "${CMD}"
31fi
32
33
34#       Copy some documentation files if needed.
35
36for 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"
40do      if [ -f "${TEXT}" ]
41        then    MEMBER="`basename \"${TEXT}\" .OS400`"
42                MEMBER="${LIBIFSNAME}/DOCS.FILE/`db2_name \"${MEMBER}\"`.MBR"
43
44                if action_needed "${MEMBER}" "${TEXT}"
45                then    CMD="CPY OBJ('${TEXT}') TOOBJ('${MEMBER}')"
46                        CMD="${CMD} TOCCSID(${TGTCCSID})"
47                        CMD="${CMD} DTAFMT(*TEXT) REPLACE(*YES)"
48                        system "${CMD}"
49                fi
50        fi
51done
52
53
54#       Build files from template.
55
56configFile()
57
58{
59        args=`set | sed -e '/^[A-Za-z_][A-Za-z0-9_]*=/!d'               \
60                        -e 's/[\/\\\\&]/\\\\&/g'                        \
61                        -e "s/'/'\\\\\\''/g"                            \
62                        -e 's/^\([^=]*\)=\(.*\)$/-e '\''s\/@\1@\/\2\/g'\'/`
63        eval sed ${args} < "${1}".in > "${1}"
64}
65
66configFile include/libxml/xmlversion.h
67configFile os400/os400config.h
68mv os400/os400config.h config.h
69
70
71#       Build in each directory.
72
73for SUBDIR in include rpg src
74do      "${SCRIPTDIR}/make-${SUBDIR}.sh"
75done
76