make-include.sh 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. SCRIPTDIR=`dirname "${0}"`
  27. . "${SCRIPTDIR}/initscript.sh"
  28. cd "${TOPDIR}/include"
  29. # Create the OS/400 source program file for the header files.
  30. SRCPF="${LIBIFSNAME}/H.FILE"
  31. if action_needed "${SRCPF}"
  32. then CMD="CRTSRCPF FILE(${TARGETLIB}/H) RCDLEN(112)"
  33. CMD="${CMD} CCSID(${TGTCCSID}) TEXT('curl: Header files')"
  34. system "${CMD}"
  35. fi
  36. # Create the IFS directory for the header files.
  37. IFSINCLUDE="${IFSDIR}/include/curl"
  38. if action_needed "${IFSINCLUDE}"
  39. then mkdir -p "${IFSINCLUDE}"
  40. fi
  41. # Enumeration values are used as va_arg tagfields, so they MUST be
  42. # integers.
  43. copy_hfile()
  44. {
  45. destfile="${1}"
  46. srcfile="${2}"
  47. shift
  48. shift
  49. sed -e '1i\
  50. #pragma enum(int)\
  51. ' "${@}" -e '$a\
  52. #pragma enum(pop)\
  53. ' < "${srcfile}" > "${destfile}"
  54. }
  55. # Copy the header files.
  56. for HFILE in curl/*.h ${SCRIPTDIR}/ccsidcurl.h
  57. do case "`basename \"${HFILE}\" .h`" in
  58. stdcheaders|typecheck-gcc)
  59. continue;;
  60. esac
  61. DEST="${SRCPF}/`db2_name \"${HFILE}\" nomangle`.MBR"
  62. if action_needed "${DEST}" "${HFILE}"
  63. then copy_hfile "${DEST}" "${HFILE}"
  64. IFSDEST="${IFSINCLUDE}/`basename \"${HFILE}\"`"
  65. rm -f "${IFSDEST}"
  66. ln -s "${DEST}" "${IFSDEST}"
  67. fi
  68. done
  69. # Copy the ILE/RPG header file, setting-up version number.
  70. versioned_copy "${SCRIPTDIR}/curl.inc.in" "${SRCPF}/CURL.INC.MBR"
  71. rm -f "${IFSINCLUDE}/curl.inc.rpgle"
  72. ln -s "${SRCPF}/CURL.INC.MBR" "${IFSINCLUDE}/curl.inc.rpgle"
  73. # Duplicate file H as CURL to support more include path forms.
  74. if action_needed "${LIBIFSNAME}/CURL.FILE"
  75. then :
  76. else system "DLTF FILE(${TARGETLIB}/CURL)"
  77. fi
  78. CMD="CRTDUPOBJ OBJ(H) FROMLIB(${TARGETLIB}) OBJTYPE(*FILE) TOLIB(*FROMLIB)"
  79. CMD="${CMD} NEWOBJ(CURL) DATA(*YES)"
  80. system "${CMD}"