Git init
[external/curl.git] / packages / OS400 / make-include.sh
1 #!/bin/sh
2 #
3 #       Installation of the include files in the OS/400 library.
4 #
5
6 SCRIPTDIR=`dirname "${0}"`
7 . "${SCRIPTDIR}/initscript.sh"
8 cd "${TOPDIR}/include"
9
10
11 #       Produce the curlbuild.h include file if not yet in distribution (CVS).
12
13 if action_needed curl/curlbuild.h
14 then    if action_needed curl/curlbuild.h curl/curlbuild.h.dist
15         then    cp -p curl/curlbuild.h.dist curl/curlbuild.h
16         fi
17 fi
18
19
20 #       Create the OS/400 source program file for the include files.
21
22 SRCPF="${LIBIFSNAME}/H.FILE"
23
24 if action_needed "${SRCPF}"
25 then    CMD="CRTSRCPF FILE(${TARGETLIB}/H) RCDLEN(112)"
26         CMD="${CMD} CCSID(${TGTCCSID}) TEXT('curl: Header files')"
27         system "${CMD}"
28 fi
29
30
31 #       Enumeration values are used as va_arg tagfields, so they MUST be
32 #               integers.
33
34 copy_hfile()
35
36 {
37         destfile="${1}"
38         srcfile="${2}"
39         shift
40         shift
41         sed -e '1i\
42 #pragma enum(int)\
43 ' "${@}" -e '$a\
44 #pragma enum(pop)\
45 ' < "${srcfile}" > "${destfile}"
46 }
47
48 #       Copy the header files.
49
50 for HFILE in curl/*.h ${SCRIPTDIR}/ccsidcurl.h
51 do      DEST="${SRCPF}/`db2_name \"${HFILE}\"`.MBR"
52         if action_needed "${DEST}" "${HFILE}"
53         then    copy_hfile "${DEST}" "${HFILE}"
54         fi
55 done
56
57
58 #       Copy the ILE/RPG include file, setting-up version number.
59
60         versioned_copy "${SCRIPTDIR}/curl.inc.in" "${SRCPF}/CURL.INC.MBR"
61
62
63 #       Duplicate file H as CURL to support more include path forms.
64
65 if action_needed "${LIBIFSNAME}/CURL.FILE"
66 then    :
67 else    system "DLTF FILE(${TARGETLIB}/CURL)"
68 fi
69
70 CMD="CRTDUPOBJ OBJ(H) FROMLIB(${TARGETLIB}) OBJTYPE(*FILE) TOLIB(*FROMLIB)"
71 CMD="${CMD} NEWOBJ(CURL) DATA(*YES)"
72 system "${CMD}"