3 # libcurl compilation script for the OS/400.
6 SCRIPTDIR=`dirname "${0}"`
7 . "${SCRIPTDIR}/initscript.sh"
11 # Create and compile the identification source file.
13 echo '#pragma comment(user, "libcurl version '"${LIBCURL_VERSION}"'")' > os400.c
14 echo '#pragma comment(date)' >> os400.c
15 echo '#pragma comment(copyright, "Copyright (C) 1998-2010 Daniel Stenberg et al. OS/400 version by P. Monnerat")' >> os400.c
16 make_module OS400 os400.c
17 LINK= # No need to rebuild service program yet.
26 shift # Drop the equal sign.
27 CSOURCES="$*" # Get the file names.
33 shift # Drop the equal sign.
34 HHEADERS="$*" # Get the file names.
40 # Compile the sources into modules.
44 make_module OS400SYS "${SCRIPTDIR}/os400sys.c"
45 make_module CCSIDCURL "${SCRIPTDIR}/ccsidcurl.c"
47 for SRC in ${CSOURCES}
48 do MODULE=`basename "${SRC}" .c |
50 sed -e 's/^\(..........\).*/\1/'`
51 make_module "${MODULE}" "${SRC}"
55 # If needed, (re)create the static binding directory.
57 if action_needed "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR"
62 then rm -rf "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR"
63 CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${STATBNDDIR})"
64 CMD="${CMD} TEXT('LibCurl API static binding directory')"
67 for MODULE in ${MODULES}
68 do CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${STATBNDDIR})"
69 CMD="${CMD} OBJ((${TARGETLIB}/${MODULE} *MODULE))"
75 # The exportation file for service program creation must be in a DB2
76 # source file, so make sure it exists.
78 if action_needed "${LIBIFSNAME}/TOOLS.FILE"
79 then CMD="CRTSRCPF FILE(${TARGETLIB}/TOOLS) RCDLEN(112)"
80 CMD="${CMD} TEXT('curl: build tools')"
85 # Gather the list of symbols to export.
87 EXPORTS=`grep '^CURL_EXTERN[ ]' \
88 "${TOPDIR}"/include/curl/*.h \
89 "${SCRIPTDIR}/ccsidcurl.h" |
90 sed -e 's/^.*CURL_EXTERN[ ]\(.*\)(.*$/\1/' \
96 # Create the service program exportation file in DB2 member if needed.
98 BSF="${LIBIFSNAME}/TOOLS.FILE/BNDSRC.MBR"
100 if action_needed "${BSF}" Makefile.am
105 then echo " STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('LIBCURL_${SONAME}')" \
107 for EXPORT in ${EXPORTS}
108 do echo ' EXPORT SYMBOL("'"${EXPORT}"'")' >> "${BSF}"
111 echo ' ENDPGMEXP' >> "${BSF}"
115 # Build the service program if needed.
117 if action_needed "${LIBIFSNAME}/${SRVPGM}.SRVPGM"
122 then CMD="CRTSRVPGM SRVPGM(${TARGETLIB}/${SRVPGM})"
123 CMD="${CMD} SRCFILE(${TARGETLIB}/TOOLS) SRCMBR(BNDSRC)"
124 CMD="${CMD} MODULE(${TARGETLIB}/OS400)"
125 CMD="${CMD} BNDDIR(${TARGETLIB}/${STATBNDDIR})"
126 CMD="${CMD} BNDSRVPGM(QADRTTS QGLDCLNT QGLDBRDR)"
127 CMD="${CMD} TEXT('curl API library')"
128 CMD="${CMD} TGTRLS(${TGTRLS})"
134 # If needed, (re)create the dynamic binding directory.
136 if action_needed "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR"
141 then rm -rf "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR"
142 CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${DYNBNDDIR})"
143 CMD="${CMD} TEXT('LibCurl API dynamic binding directory')"
145 CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${DYNBNDDIR})"
146 CMD="${CMD} OBJ((*LIBL/${SRVPGM} *SRVPGM))"
151 # Rebuild the formdata test if needed.
153 if [ "${TEST_FORMDATA}" ]
155 make_module TFORMDATA formdata.c "'_FORM_DEBUG' 'CURLDEBUG'"
156 make_module TSTREQUAL strequal.c "'_FORM_DEBUG' 'CURLDEBUG'"
157 make_module TMEMDEBUG memdebug.c "'_FORM_DEBUG' 'CURLDEBUG'"
158 make_module TMPRINTF mprintf.c "'_FORM_DEBUG' 'CURLDEBUG'"
159 make_module TSTRERROR strerror.c "'_FORM_DEBUG' 'CURLDEBUG'"
160 # The following modules should not be needed (see comment in
161 # formdata.c. However, there are some unsatisfied
162 # external references leading in the following
163 # modules to be (recursively) needed.
164 MODULES="${MODULES} EASY STRDUP SSLGEN QSSL HOSTIP HOSTIP4 HOSTIP6"
165 MODULES="${MODULES} URL HASH TRANSFER GETINFO COOKIE SENDF SELECT"
166 MODULES="${MODULES} INET_NTOP SHARE HOSTTHRE MULTI LLIST FTP HTTP"
167 MODULES="${MODULES} HTTP_DIGES HTTP_CHUNK HTTP_NEGOT TIMEVAL HOSTSYN"
168 MODULES="${MODULES} CONNECT SOCKS PROGRESS ESCAPE INET_PTON GETENV"
169 MODULES="${MODULES} DICT LDAP TELNET FILE TFTP NETRC PARSEDATE"
170 MODULES="${MODULES} SPEEDCHECK SPLAY BASE64 SECURITY IF2IP MD5"
171 MODULES="${MODULES} KRB5 OS400SYS"
173 PGMIFSNAME="${LIBIFSNAME}/TFORMDATA.PGM"
175 if action_needed "${PGMIFSNAME}"
180 then CMD="CRTPGM PGM(${TARGETLIB}/TFORMDATA)"
181 CMD="${CMD} ENTMOD(QADRT/QADRTMAIN2)"
184 for MODULE in ${MODULES}
185 do CMD="${CMD} ${TARGETLIB}/${MODULE}"
188 CMD="${CMD} ) BNDSRVPGM(QADRTTS)"
189 CMD="${CMD} TGTRLS(${TGTRLS})"