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