• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2#
3#       Installation of the header files in the OS/400 library.
4#
5
6SCRIPTDIR=`dirname "${0}"`
7. "${SCRIPTDIR}/initscript.sh"
8cd "${TOPDIR}/include"
9
10
11#       Create the OS/400 source program file for the header files.
12
13SRCPF="${LIBIFSNAME}/H.FILE"
14
15if action_needed "${SRCPF}"
16then    CMD="CRTSRCPF FILE(${TARGETLIB}/H) RCDLEN(112)"
17        CMD="${CMD} CCSID(${TGTCCSID}) TEXT('curl: Header files')"
18        system "${CMD}"
19fi
20
21
22#       Create the IFS directory for the header files.
23
24IFSINCLUDE="${IFSDIR}/include/curl"
25
26if action_needed "${IFSINCLUDE}"
27then    mkdir -p "${IFSINCLUDE}"
28fi
29
30
31#       Enumeration values are used as va_arg tagfields, so they MUST be
32#               integers.
33
34copy_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
50for HFILE in curl/*.h ${SCRIPTDIR}/ccsidcurl.h
51do      case "`basename \"${HFILE}\" .h`" in
52        stdcheaders|typecheck-gcc)
53                continue;;
54        esac
55
56        DEST="${SRCPF}/`db2_name \"${HFILE}\" nomangle`.MBR"
57
58        if action_needed "${DEST}" "${HFILE}"
59        then    copy_hfile "${DEST}" "${HFILE}"
60                IFSDEST="${IFSINCLUDE}/`basename \"${HFILE}\"`"
61                rm -f "${IFSDEST}"
62                ln -s "${DEST}" "${IFSDEST}"
63        fi
64done
65
66
67#       Copy the ILE/RPG header file, setting-up version number.
68
69versioned_copy "${SCRIPTDIR}/curl.inc.in" "${SRCPF}/CURL.INC.MBR"
70rm -f "${IFSINCLUDE}/curl.inc.rpgle"
71ln -s "${SRCPF}/CURL.INC.MBR" "${IFSINCLUDE}/curl.inc.rpgle"
72
73
74#       Duplicate file H as CURL to support more include path forms.
75
76if action_needed "${LIBIFSNAME}/CURL.FILE"
77then    :
78else    system "DLTF FILE(${TARGETLIB}/CURL)"
79fi
80
81CMD="CRTDUPOBJ OBJ(H) FROMLIB(${TARGETLIB}) OBJTYPE(*FILE) TOLIB(*FROMLIB)"
82CMD="${CMD} NEWOBJ(CURL) DATA(*YES)"
83system "${CMD}"
84