| xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame] | 1 | #!/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 |  | 
|  | 29 | SCRIPTDIR=`dirname "${0}"` | 
|  | 30 | . "${SCRIPTDIR}/initscript.sh" | 
|  | 31 | cd "${TOPDIR}/include" | 
|  | 32 |  | 
|  | 33 |  | 
|  | 34 | #       Create the OS/400 source program file for the header files. | 
|  | 35 |  | 
|  | 36 | SRCPF="${LIBIFSNAME}/H.FILE" | 
|  | 37 |  | 
|  | 38 | if action_needed "${SRCPF}" | 
|  | 39 | then    CMD="CRTSRCPF FILE(${TARGETLIB}/H) RCDLEN(112)" | 
|  | 40 | CMD="${CMD} CCSID(${TGTCCSID}) TEXT('curl: Header files')" | 
|  | 41 | system "${CMD}" | 
|  | 42 | fi | 
|  | 43 |  | 
|  | 44 |  | 
|  | 45 | #       Create the IFS directory for the header files. | 
|  | 46 |  | 
|  | 47 | IFSINCLUDE="${IFSDIR}/include/curl" | 
|  | 48 |  | 
|  | 49 | if action_needed "${IFSINCLUDE}" | 
|  | 50 | then    mkdir -p "${IFSINCLUDE}" | 
|  | 51 | fi | 
|  | 52 |  | 
|  | 53 |  | 
|  | 54 | #       Enumeration values are used as va_arg tagfields, so they MUST be | 
|  | 55 | #               integers. | 
|  | 56 |  | 
|  | 57 | copy_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 |  | 
|  | 73 | for HFILE in curl/*.h ${SCRIPTDIR}/ccsidcurl.h | 
|  | 74 | do      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 | 
|  | 87 | done | 
|  | 88 |  | 
|  | 89 |  | 
|  | 90 | #       Copy the ILE/RPG header file, setting-up version number. | 
|  | 91 |  | 
|  | 92 | versioned_copy "${SCRIPTDIR}/curl.inc.in" "${SRCPF}/CURL.INC.MBR" | 
|  | 93 | rm -f "${IFSINCLUDE}/curl.inc.rpgle" | 
|  | 94 | ln -s "${SRCPF}/CURL.INC.MBR" "${IFSINCLUDE}/curl.inc.rpgle" | 
|  | 95 |  | 
|  | 96 |  | 
|  | 97 | #       Duplicate file H as CURL to support more include path forms. | 
|  | 98 |  | 
|  | 99 | if action_needed "${LIBIFSNAME}/CURL.FILE" | 
|  | 100 | then    : | 
|  | 101 | else    system "DLTF FILE(${TARGETLIB}/CURL)" | 
|  | 102 | fi | 
|  | 103 |  | 
|  | 104 | CMD="CRTDUPOBJ OBJ(H) FROMLIB(${TARGETLIB}) OBJTYPE(*FILE) TOLIB(*FROMLIB)" | 
|  | 105 | CMD="${CMD} NEWOBJ(CURL) DATA(*YES)" | 
|  | 106 | system "${CMD}" |