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