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