Bump to libxml2 2.9.4
[platform/upstream/libxml2.git] / os400 / make-include.sh
1 #!/bin/sh
2 #
3 #       Installation of the C header files in the OS/400 library.
4 #
5 #       See Copyright for the status of this software.
6 #
7 #       Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
8 #
9
10 SCRIPTDIR=`dirname "${0}"`
11 . "${SCRIPTDIR}/initscript.sh"
12 cd "${TOPDIR}/include"
13
14
15 #       Create the OS/400 source program file for the C header files.
16
17 SRCPF="${LIBIFSNAME}/LIBXML.FILE"
18
19 if action_needed "${SRCPF}"
20 then    CMD="CRTSRCPF FILE(${TARGETLIB}/LIBXML) RCDLEN(112)"
21         CMD="${CMD} CCSID(${TGTCCSID}) TEXT('libxml2: C/C++ header files')"
22         system "${CMD}"
23 fi
24
25
26 #       Create the IFS directory for the C header files.
27
28 if action_needed "${IFSDIR}/include/libxml"
29 then    mkdir -p "${IFSDIR}/include/libxml"
30 fi
31
32
33
34 #       Enumeration values may be used as va_arg tagfields, so they MUST be
35 #               integers.
36
37 copy_hfile()
38
39 {
40         sed -e '1i\
41 #pragma enum(int)\
42 ' "${@}" -e '$a\
43 #pragma enum(pop)\
44 '
45 }
46
47 #       Copy the header files to DB2 library. Link from IFS include directory.
48
49 for HFILE in "${TOPDIR}/os400/transcode.h" libxml/*.h libxml/*.h.in
50 do      CMD="cat \"${HFILE}\""
51         DEST="${SRCPF}/`db2_name \"${HFILE}\" nomangle`.MBR"
52
53         case "`basename \"${HFILE}\"`" in
54
55         xmlwin32version.h*)
56                 continue;;      # Not on M$W !
57
58         *.in)   CMD="${CMD} | versioned_copy";;
59
60         xmlschemastypes.h)      #       Special case: rename colliding file.
61                 DEST="${SRCPF}/SCHMTYPES.MBR";;
62
63         esac
64
65         if action_needed "${DEST}" "${HFILE}"
66         then    eval "${CMD}" | copy_hfile > tmphdrfile
67
68                 #       Need to translate to target CCSID.
69
70                 CMD="CPY OBJ('`pwd`/tmphdrfile') TOOBJ('${DEST}')"
71                 CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)"
72                 system "${CMD}"
73         fi
74
75         IFSFILE="${IFSDIR}/include/libxml/`basename \"${HFILE}\" .in`"
76
77         if action_needed "${IFSFILE}" "${DEST}"
78         then    rm -f "${IFSFILE}"
79                 ln -s "${DEST}" "${IFSFILE}"
80         fi
81 done