Imported Upstream version 2.9.2
[platform/upstream/libxml2.git] / os400 / make.sh
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
11 SCRIPTDIR=`dirname "${0}"`
12 . "${SCRIPTDIR}/initscript.sh"
13 cd "${TOPDIR}"
14
15
16 #       Create the OS/400 library if it does not exist.
17
18 if action_needed "${LIBIFSNAME}"
19 then    CMD="CRTLIB LIB(${TARGETLIB})"
20         CMD="${CMD} TEXT('libxml2: XML parser and toolkit API')"
21         system "${CMD}"
22 fi
23
24
25 #       Create the DOCS source file if it does not exist.
26
27 if action_needed "${LIBIFSNAME}/DOCS.FILE"
28 then    CMD="CRTSRCPF FILE(${TARGETLIB}/DOCS) RCDLEN(112)"
29         CMD="${CMD} CCSID(${TGTCCSID}) TEXT('Documentation texts')"
30         system "${CMD}"
31 fi
32
33
34 #       Copy some documentation files if needed.
35
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"
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
51 done
52
53
54 #       Build files from template.
55
56 configFile()
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
66 configFile include/libxml/xmlversion.h
67 configFile os400/os400config.h
68 mv os400/os400config.h config.h
69
70
71 #       Build in each directory.
72
73 for SUBDIR in include rpg src
74 do      "${SCRIPTDIR}/make-${SUBDIR}.sh"
75 done