• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2#***************************************************************************
3#                                  _   _ ____  _
4#  Project                     ___| | | |  _ \| |
5#                             / __| | | | |_) | |
6#                            | (__| |_| |  _ <| |___
7#                             \___|\___/|_| \_\_____|
8#
9# Copyright (C) 1998 - 2020, 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###########################################################################
23#
24#       Installation of the header files in the OS/400 library.
25#
26
27SCRIPTDIR=`dirname "${0}"`
28. "${SCRIPTDIR}/initscript.sh"
29cd "${TOPDIR}/include"
30
31
32#       Create the OS/400 source program file for the header files.
33
34SRCPF="${LIBIFSNAME}/H.FILE"
35
36if action_needed "${SRCPF}"
37then    CMD="CRTSRCPF FILE(${TARGETLIB}/H) RCDLEN(112)"
38        CMD="${CMD} CCSID(${TGTCCSID}) TEXT('curl: Header files')"
39        system "${CMD}"
40fi
41
42
43#       Create the IFS directory for the header files.
44
45IFSINCLUDE="${IFSDIR}/include/curl"
46
47if action_needed "${IFSINCLUDE}"
48then    mkdir -p "${IFSINCLUDE}"
49fi
50
51
52#       Enumeration values are used as va_arg tagfields, so they MUST be
53#               integers.
54
55copy_hfile()
56
57{
58        destfile="${1}"
59        srcfile="${2}"
60        shift
61        shift
62        sed -e '1i\
63#pragma enum(int)\
64' "${@}" -e '$a\
65#pragma enum(pop)\
66' < "${srcfile}" > "${destfile}"
67}
68
69#       Copy the header files.
70
71for HFILE in curl/*.h ${SCRIPTDIR}/ccsidcurl.h
72do      case "`basename \"${HFILE}\" .h`" in
73        stdcheaders|typecheck-gcc)
74                continue;;
75        esac
76
77        DEST="${SRCPF}/`db2_name \"${HFILE}\" nomangle`.MBR"
78
79        if action_needed "${DEST}" "${HFILE}"
80        then    copy_hfile "${DEST}" "${HFILE}"
81                IFSDEST="${IFSINCLUDE}/`basename \"${HFILE}\"`"
82                rm -f "${IFSDEST}"
83                ln -s "${DEST}" "${IFSDEST}"
84        fi
85done
86
87
88#       Copy the ILE/RPG header file, setting-up version number.
89
90versioned_copy "${SCRIPTDIR}/curl.inc.in" "${SRCPF}/CURL.INC.MBR"
91rm -f "${IFSINCLUDE}/curl.inc.rpgle"
92ln -s "${SRCPF}/CURL.INC.MBR" "${IFSINCLUDE}/curl.inc.rpgle"
93
94
95#       Duplicate file H as CURL to support more include path forms.
96
97if action_needed "${LIBIFSNAME}/CURL.FILE"
98then    :
99else    system "DLTF FILE(${TARGETLIB}/CURL)"
100fi
101
102CMD="CRTDUPOBJ OBJ(H) FROMLIB(${TARGETLIB}) OBJTYPE(*FILE) TOLIB(*FROMLIB)"
103CMD="${CMD} NEWOBJ(CURL) DATA(*YES)"
104system "${CMD}"
105