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 <[email protected]>, 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 | *.in) CMD="${CMD} | versioned_copy";;
|
---|
56 |
|
---|
57 | xmlschemastypes.h) # Special case: rename colliding file.
|
---|
58 | DEST="${SRCPF}/SCHMTYPES.MBR";;
|
---|
59 |
|
---|
60 | esac
|
---|
61 |
|
---|
62 | if action_needed "${DEST}" "${HFILE}"
|
---|
63 | then eval "${CMD}" | copy_hfile > tmphdrfile
|
---|
64 |
|
---|
65 | # Need to translate to target CCSID.
|
---|
66 |
|
---|
67 | CMD="CPY OBJ('`pwd`/tmphdrfile') TOOBJ('${DEST}')"
|
---|
68 | CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)"
|
---|
69 | system "${CMD}"
|
---|
70 | fi
|
---|
71 |
|
---|
72 | IFSFILE="${IFSDIR}/include/libxml/`basename \"${HFILE}\" .in`"
|
---|
73 |
|
---|
74 | if action_needed "${IFSFILE}" "${DEST}"
|
---|
75 | then rm -f "${IFSFILE}"
|
---|
76 | ln -s "${DEST}" "${IFSFILE}"
|
---|
77 | fi
|
---|
78 | done
|
---|