blob: daf32627cbc1642a2a4f5d37b45ba9decdb0d9fc [file] [log] [blame]
xf.li6c8fc1e2023-08-12 00:11:09 -07001#!/bin/sh
2#***************************************************************************
3# _ _ ____ _
4# Project ___| | | | _ \| |
5# / __| | | | |_) | |
6# | (__| |_| | _ <| |___
7# \___|\___/|_| \_\_____|
8#
9# Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
10#
11# This software is licensed as described in the file COPYING, which
12# you should have received as part of this distribution. The terms
13# are also available at https://curl.se/docs/copyright.html.
14#
15# You may opt to use, copy, modify, merge, publish, distribute and/or sell
16# copies of the Software, and permit persons to whom the Software is
17# furnished to do so, under the terms of the COPYING file.
18#
19# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20# KIND, either express or implied.
21#
22# SPDX-License-Identifier: curl
23#
24###########################################################################
25#
26# Installation of the header files in the OS/400 library.
27#
28
29SCRIPTDIR=`dirname "${0}"`
30. "${SCRIPTDIR}/initscript.sh"
31cd "${TOPDIR}/include"
32
33
34# Create the OS/400 source program file for the header files.
35
36SRCPF="${LIBIFSNAME}/H.FILE"
37
38if action_needed "${SRCPF}"
39then CMD="CRTSRCPF FILE(${TARGETLIB}/H) RCDLEN(112)"
40 CMD="${CMD} CCSID(${TGTCCSID}) TEXT('curl: Header files')"
41 system "${CMD}"
42fi
43
44
45# Create the IFS directory for the header files.
46
47IFSINCLUDE="${IFSDIR}/include/curl"
48
49if action_needed "${IFSINCLUDE}"
50then mkdir -p "${IFSINCLUDE}"
51fi
52
53
54# Enumeration values are used as va_arg tagfields, so they MUST be
55# integers.
56
57copy_hfile()
58
59{
60 destfile="${1}"
61 srcfile="${2}"
62 shift
63 shift
64 sed -e '1i\
65#pragma enum(int)\
66' "${@}" -e '$a\
67#pragma enum(pop)\
68' < "${srcfile}" > "${destfile}"
69}
70
71# Copy the header files.
72
73for HFILE in curl/*.h ${SCRIPTDIR}/ccsidcurl.h
74do case "`basename \"${HFILE}\" .h`" in
75 stdcheaders|typecheck-gcc)
76 continue;;
77 esac
78
79 DEST="${SRCPF}/`db2_name \"${HFILE}\" nomangle`.MBR"
80
81 if action_needed "${DEST}" "${HFILE}"
82 then copy_hfile "${DEST}" "${HFILE}"
83 IFSDEST="${IFSINCLUDE}/`basename \"${HFILE}\"`"
84 rm -f "${IFSDEST}"
85 ln -s "${DEST}" "${IFSDEST}"
86 fi
87done
88
89
90# Copy the ILE/RPG header file, setting-up version number.
91
92versioned_copy "${SCRIPTDIR}/curl.inc.in" "${SRCPF}/CURL.INC.MBR"
93rm -f "${IFSINCLUDE}/curl.inc.rpgle"
94ln -s "${SRCPF}/CURL.INC.MBR" "${IFSINCLUDE}/curl.inc.rpgle"
95
96
97# Duplicate file H as CURL to support more include path forms.
98
99if action_needed "${LIBIFSNAME}/CURL.FILE"
100then :
101else system "DLTF FILE(${TARGETLIB}/CURL)"
102fi
103
104CMD="CRTDUPOBJ OBJ(H) FROMLIB(${TARGETLIB}) OBJTYPE(*FILE) TOLIB(*FROMLIB)"
105CMD="${CMD} NEWOBJ(CURL) DATA(*YES)"
106system "${CMD}"