geom_gate userland utility improvements
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

93 lines
2.6 KiB

  1. #!/bin/sh
  2. #
  3. # Installation of the ILE/RPG header files in the OS/400 library.
  4. #
  5. SCRIPTDIR=`dirname "${0}"`
  6. . "${SCRIPTDIR}/initscript.sh"
  7. cd "${TOPDIR}/os400/libssh2rpg"
  8. # Create the OS/400 source program file for the ILE/RPG header files.
  9. SRCPF="${LIBIFSNAME}/LIBSSH2RPG.FILE"
  10. if action_needed "${SRCPF}"
  11. then CMD="CRTSRCPF FILE(${TARGETLIB}/LIBSSH2RPG) RCDLEN(112)"
  12. CMD="${CMD} CCSID(${TGTCCSID}) TEXT('libssh2: ILE/RPG header files')"
  13. system "${CMD}"
  14. fi
  15. # Map file names to DB2 name syntax.
  16. for HFILE in *.rpgle *.rpgle.in
  17. do NAME="`basename \"${HFILE}\" .in`"
  18. VAR="`basename \"${NAME}\" .rpgle`"
  19. VAL="`db2_name \"${NAME}\"`"
  20. eval "VAR_${VAR}=\"${VAL}\""
  21. echo "${VAR} s/${VAR}/${VAL}/g"
  22. done > tmpsubstfile1
  23. # Order substitution commands so that a prefix appears after all
  24. # file names beginning with the prefix.
  25. sort -r tmpsubstfile1 | sed 's/^[^ ]*[ ]*//' > tmpsubstfile2
  26. change_include()
  27. {
  28. sed -e '\#^....../include *"libssh2rpg/#{' \
  29. -e 's///' \
  30. -e 's/".*//' \
  31. -f tmpsubstfile2 \
  32. -e 's#.*# /include libssh2rpg,&#' \
  33. -e '}'
  34. }
  35. # Create the IFS directory for the ILE/RPG header files.
  36. RPGIFSDIR="${IFSDIR}/include/libssh2rpg"
  37. if action_needed "${RPGIFSDIR}"
  38. then mkdir -p "${RPGIFSDIR}"
  39. fi
  40. # Copy the header files to IFS ILE/RPG include directory.
  41. # Copy them with include path editing to the DB2 library.
  42. for HFILE in *.rpgle *.rpgle.in
  43. do IFSCMD="cat \"${HFILE}\""
  44. DB2CMD="change_include < \"${HFILE}\""
  45. IFSFILE="`basename \"${HFILE}\" .in`"
  46. case "${HFILE}" in
  47. *.in) IFSCMD="${IFSCMD} | versioned_copy"
  48. DB2CMD="${DB2CMD} | versioned_copy"
  49. ;;
  50. esac
  51. IFSDEST="${RPGIFSDIR}/${IFSFILE}"
  52. if action_needed "${IFSDEST}" "${HFILE}"
  53. then eval "${IFSCMD}" > "${IFSDEST}"
  54. fi
  55. eval DB2MBR="\"\${VAR_`basename \"${IFSDEST}\" .rpgle`}\""
  56. DB2DEST="${SRCPF}/${DB2MBR}.MBR"
  57. if action_needed "${DB2DEST}" "${HFILE}"
  58. then eval "${DB2CMD}" | change_include > tmphdrfile
  59. # Need to translate to target CCSID.
  60. CMD="CPY OBJ('`pwd`/tmphdrfile') TOOBJ('${DB2DEST}')"
  61. CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)"
  62. system "${CMD}"
  63. fi
  64. done