blob: ad72cf4a7b184d32f258bf91b98928e69a45bfb0 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#!/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# Produce the curlbuild.h header file if not yet in distribution (CVS).
12
13if action_needed curl/curlbuild.h
14then if action_needed curl/curlbuild.h curl/curlbuild.h.dist
15 then cp -p curl/curlbuild.h.dist curl/curlbuild.h
16 fi
17fi
18
19
20# Create the OS/400 source program file for the header files.
21
22SRCPF="${LIBIFSNAME}/H.FILE"
23
24if action_needed "${SRCPF}"
25then CMD="CRTSRCPF FILE(${TARGETLIB}/H) RCDLEN(112)"
26 CMD="${CMD} CCSID(${TGTCCSID}) TEXT('curl: Header files')"
27 system "${CMD}"
28fi
29
30
31# Create the IFS directory for the header files.
32
33IFSINCLUDE="${IFSDIR}/include/curl"
34
35if action_needed "${IFSINCLUDE}"
36then mkdir -p "${IFSINCLUDE}"
37fi
38
39
40# Enumeration values are used as va_arg tagfields, so they MUST be
41# integers.
42
43copy_hfile()
44
45{
46 destfile="${1}"
47 srcfile="${2}"
48 shift
49 shift
50 sed -e '1i\
51#pragma enum(int)\
52' "${@}" -e '$a\
53#pragma enum(pop)\
54' < "${srcfile}" > "${destfile}"
55}
56
57# Copy the header files.
58
59for HFILE in curl/*.h ${SCRIPTDIR}/ccsidcurl.h
60do case "`basename \"${HFILE}\" .h`" in
61 stdcheaders|typecheck-gcc)
62 continue;;
63 esac
64
65 DEST="${SRCPF}/`db2_name \"${HFILE}\" nomangle`.MBR"
66
67 if action_needed "${DEST}" "${HFILE}"
68 then copy_hfile "${DEST}" "${HFILE}"
69 IFSDEST="${IFSINCLUDE}/`basename \"${HFILE}\"`"
70 rm -f "${IFSDEST}"
71 ln -s "${DEST}" "${IFSDEST}"
72 fi
73done
74
75
76# Copy the ILE/RPG header file, setting-up version number.
77
78versioned_copy "${SCRIPTDIR}/curl.inc.in" "${SRCPF}/CURL.INC.MBR"
79rm -f "${IFSINCLUDE}/curl.inc.rpgle"
80ln -s "${SRCPF}/CURL.INC.MBR" "${IFSINCLUDE}/curl.inc.rpgle"
81
82
83# Duplicate file H as CURL to support more include path forms.
84
85if action_needed "${LIBIFSNAME}/CURL.FILE"
86then :
87else system "DLTF FILE(${TARGETLIB}/CURL)"
88fi
89
90CMD="CRTDUPOBJ OBJ(H) FROMLIB(${TARGETLIB}) OBJTYPE(*FILE) TOLIB(*FROMLIB)"
91CMD="${CMD} NEWOBJ(CURL) DATA(*YES)"
92system "${CMD}"