make-include.sh 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #!/bin/sh
  2. #
  3. # Installation of the header files in the OS/400 library.
  4. #
  5. SCRIPTDIR=`dirname "${0}"`
  6. . "${SCRIPTDIR}/initscript.sh"
  7. cd "${TOPDIR}/include"
  8. # Produce the curlbuild.h header file if not yet in distribution (CVS).
  9. if action_needed curl/curlbuild.h
  10. then if action_needed curl/curlbuild.h curl/curlbuild.h.dist
  11. then cp -p curl/curlbuild.h.dist curl/curlbuild.h
  12. fi
  13. fi
  14. # Create the OS/400 source program file for the header files.
  15. SRCPF="${LIBIFSNAME}/H.FILE"
  16. if action_needed "${SRCPF}"
  17. then CMD="CRTSRCPF FILE(${TARGETLIB}/H) RCDLEN(112)"
  18. CMD="${CMD} CCSID(${TGTCCSID}) TEXT('curl: Header files')"
  19. system "${CMD}"
  20. fi
  21. # Create the IFS directory for the header files.
  22. IFSINCLUDE="${IFSDIR}/include/curl"
  23. if action_needed "${IFSINCLUDE}"
  24. then mkdir -p "${IFSINCLUDE}"
  25. fi
  26. # Enumeration values are used as va_arg tagfields, so they MUST be
  27. # integers.
  28. copy_hfile()
  29. {
  30. destfile="${1}"
  31. srcfile="${2}"
  32. shift
  33. shift
  34. sed -e '1i\
  35. #pragma enum(int)\
  36. ' "${@}" -e '$a\
  37. #pragma enum(pop)\
  38. ' < "${srcfile}" > "${destfile}"
  39. }
  40. # Copy the header files.
  41. for HFILE in curl/*.h ${SCRIPTDIR}/ccsidcurl.h
  42. do case "`basename \"${HFILE}\" .h`" in
  43. stdcheaders|typecheck-gcc)
  44. continue;;
  45. esac
  46. DEST="${SRCPF}/`db2_name \"${HFILE}\" nomangle`.MBR"
  47. if action_needed "${DEST}" "${HFILE}"
  48. then copy_hfile "${DEST}" "${HFILE}"
  49. IFSDEST="${IFSINCLUDE}/`basename \"${HFILE}\"`"
  50. rm -f "${IFSDEST}"
  51. ln -s "${DEST}" "${IFSDEST}"
  52. fi
  53. done
  54. # Copy the ILE/RPG header file, setting-up version number.
  55. versioned_copy "${SCRIPTDIR}/curl.inc.in" "${SRCPF}/CURL.INC.MBR"
  56. rm -f "${IFSINCLUDE}/curl.inc.rpgle"
  57. ln -s "${SRCPF}/CURL.INC.MBR" "${IFSINCLUDE}/curl.inc.rpgle"
  58. # Duplicate file H as CURL to support more include path forms.
  59. if action_needed "${LIBIFSNAME}/CURL.FILE"
  60. then :
  61. else system "DLTF FILE(${TARGETLIB}/CURL)"
  62. fi
  63. CMD="CRTDUPOBJ OBJ(H) FROMLIB(${TARGETLIB}) OBJTYPE(*FILE) TOLIB(*FROMLIB)"
  64. CMD="${CMD} NEWOBJ(CURL) DATA(*YES)"
  65. system "${CMD}"