3 # libcurl compilation script for the OS/400.
5 # $Id: make-lib.sh,v 1.1 2008-09-23 16:32:05 hoffman Exp $
7 SCRIPTDIR
=`dirname "${0}"`
8 .
"${SCRIPTDIR}/initscript.sh"
12 # Create and compile the identification source file.
14 echo '#pragma comment(user, "libcurl version '"${LIBCURL_VERSION}"'")' > os400.c
15 echo '#pragma comment(date)' >> os400.c
16 echo '#pragma comment(copyright, "Copyright (C) 1998-2008 Daniel Stenberg et al. OS/400 version by P. Monnerat")' >> os400.c
17 make_module OS400 os400.c
18 LINK
= # No need to rebuild service program yet.
27 shift # Drop the equal sign.
28 CSOURCES
="$*" # Get the file names.
34 shift # Drop the equal sign.
35 HHEADERS
="$*" # Get the file names.
41 # Compile the sources into modules.
45 make_module OS400SYS
"${SCRIPTDIR}/os400sys.c"
46 make_module CCSIDCURL
"${SCRIPTDIR}/ccsidcurl.c"
48 for SRC
in ${CSOURCES}
49 do MODULE
=`basename "${SRC}" .c |
51 sed -e 's/^\(..........\).*/\1/'`
52 make_module
"${MODULE}" "${SRC}"
56 # If needed, (re)create the static binding directory.
58 if action_needed
"${LIBIFSNAME}/${STATBNDDIR}.BNDDIR"
63 then rm -rf "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR"
64 CMD
="CRTBNDDIR BNDDIR(${TARGETLIB}/${STATBNDDIR})"
65 CMD
="${CMD} TEXT('LibCurl API static binding directory')"
68 for MODULE
in ${MODULES}
69 do CMD
="ADDBNDDIRE BNDDIR(${TARGETLIB}/${STATBNDDIR})"
70 CMD
="${CMD} OBJ((${TARGETLIB}/${MODULE} *MODULE))"
76 # The exportation file for service program creation must be in a DB2
77 # source file, so make sure it exists.
79 if action_needed
"${LIBIFSNAME}/TOOLS.FILE"
80 then CMD
="CRTSRCPF FILE(${TARGETLIB}/TOOLS) RCDLEN(112)"
81 CMD
="${CMD} TEXT('curl: build tools')"
86 # Gather the list of symbols to export.
88 EXPORTS
=`grep '^CURL_EXTERN[ ]' \
89 "${TOPDIR}"/include/curl/*.h \
90 "${SCRIPTDIR}/ccsidcurl.h" |
91 sed -e 's/^.*CURL_EXTERN[ ]\(.*\)(.*$/\1/' \
97 # Create the service program exportation file in DB2 member if needed.
99 BSF
="${LIBIFSNAME}/TOOLS.FILE/BNDSRC.MBR"
101 if action_needed
"${BSF}" Makefile.am
106 then echo " STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('LIBCURL_${SONAME}')" \
108 for EXPORT
in ${EXPORTS}
109 do echo ' EXPORT SYMBOL("'"${EXPORT}"'")' >> "${BSF}"
112 echo ' ENDPGMEXP' >> "${BSF}"
116 # Build the service program if needed.
118 if action_needed
"${LIBIFSNAME}/${SRVPGM}.SRVPGM"
123 then CMD
="CRTSRVPGM SRVPGM(${TARGETLIB}/${SRVPGM})"
124 CMD
="${CMD} SRCFILE(${TARGETLIB}/TOOLS) SRCMBR(BNDSRC)"
125 CMD
="${CMD} MODULE(${TARGETLIB}/OS400)"
126 CMD
="${CMD} BNDDIR(${TARGETLIB}/${STATBNDDIR})"
127 CMD
="${CMD} BNDSRVPGM(QADRTTS QGLDCLNT QGLDBRDR)"
128 CMD
="${CMD} TEXT('curl API library')"
129 CMD
="${CMD} TGTRLS(${TGTRLS})"
135 # If needed, (re)create the dynamic binding directory.
137 if action_needed
"${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR"
142 then rm -rf "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR"
143 CMD
="CRTBNDDIR BNDDIR(${TARGETLIB}/${DYNBNDDIR})"
144 CMD
="${CMD} TEXT('LibCurl API dynamic binding directory')"
146 CMD
="ADDBNDDIRE BNDDIR(${TARGETLIB}/${DYNBNDDIR})"
147 CMD
="${CMD} OBJ((*LIBL/${SRVPGM} *SRVPGM))"
152 # Rebuild the formdata test if needed.
154 if [ "${TEST_FORMDATA}" ]
156 make_module TFORMDATA formdata.c
"'_FORM_DEBUG' 'CURLDEBUG'"
157 make_module TSTREQUAL strequal.c
"'_FORM_DEBUG' 'CURLDEBUG'"
158 make_module TMEMDEBUG memdebug.c
"'_FORM_DEBUG' 'CURLDEBUG'"
159 make_module TMPRINTF mprintf.c
"'_FORM_DEBUG' 'CURLDEBUG'"
160 make_module TSTRERROR strerror.c
"'_FORM_DEBUG' 'CURLDEBUG'"
161 # The following modules should not be needed (see comment in
162 # formdata.c. However, there are some unsatisfied
163 # external references leading in the following
164 # modules to be (recursively) needed.
165 MODULES
="${MODULES} EASY STRDUP SSLGEN QSSL HOSTIP HOSTIP4 HOSTIP6"
166 MODULES
="${MODULES} URL HASH TRANSFER GETINFO COOKIE SENDF SELECT"
167 MODULES
="${MODULES} INET_NTOP SHARE HOSTTHRE MULTI LLIST FTP HTTP"
168 MODULES
="${MODULES} HTTP_DIGES HTTP_CHUNK HTTP_NEGOT TIMEVAL HOSTSYN"
169 MODULES
="${MODULES} CONNECT SOCKS PROGRESS ESCAPE INET_PTON GETENV"
170 MODULES
="${MODULES} DICT LDAP TELNET FILE TFTP NETRC PARSEDATE"
171 MODULES
="${MODULES} SPEEDCHECK SPLAY BASE64 SECURITY IF2IP MD5"
172 MODULES
="${MODULES} KRB5 OS400SYS"
174 PGMIFSNAME
="${LIBIFSNAME}/TFORMDATA.PGM"
176 if action_needed
"${PGMIFSNAME}"
181 then CMD
="CRTPGM PGM(${TARGETLIB}/TFORMDATA)"
182 CMD
="${CMD} ENTMOD(QADRT/QADRTMAIN2)"
185 for MODULE
in ${MODULES}
186 do CMD
="${CMD} ${TARGETLIB}/${MODULE}"
189 CMD
="${CMD} ) BNDSRVPGM(QADRTTS)"
190 CMD
="${CMD} TGTRLS(${TGTRLS})"