make-include.sh 1.8 KB

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