ENH: fix bug where sharedforward would not work if there was a space in the path...
[cmake.git] / Utilities / cmcurl-7.19.0 / packages / OS400 / make-lib.sh
blob942c05b448a70b33ef1a7f3f3dfc5104bc8fc0df
1 #!/bin/sh
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"
9 cd "${TOPDIR}/lib"
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.
19 MODULES=
22 # Get source list.
24 CSOURCES()
27 shift # Drop the equal sign.
28 CSOURCES="$*" # Get the file names.
31 HHEADERS()
34 shift # Drop the equal sign.
35 HHEADERS="$*" # Get the file names.
38 . Makefile.inc
41 # Compile the sources into modules.
43 INCLUDES="'`pwd`'"
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 |
50 tr '[a-z]' '[A-Z]' |
51 sed -e 's/^\(..........\).*/\1/'`
52 make_module "${MODULE}" "${SRC}"
53 done
56 # If needed, (re)create the static binding directory.
58 if action_needed "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR"
59 then LINK=YES
62 if [ "${LINK}" ]
63 then rm -rf "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR"
64 CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${STATBNDDIR})"
65 CMD="${CMD} TEXT('LibCurl API static binding directory')"
66 system "${CMD}"
68 for MODULE in ${MODULES}
69 do CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${STATBNDDIR})"
70 CMD="${CMD} OBJ((${TARGETLIB}/${MODULE} *MODULE))"
71 system "${CMD}"
72 done
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')"
82 system "${CMD}"
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/' \
92 -e 's/[ ]*$//' \
93 -e 's/^.*[ ][ ]*//' \
94 -e 's/^\*//' \
95 -e 's/(\(.*\))/\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
102 then LINK=YES
105 if [ "${LINK}" ]
106 then echo " STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('LIBCURL_${SONAME}')" \
107 > "${BSF}"
108 for EXPORT in ${EXPORTS}
109 do echo ' EXPORT SYMBOL("'"${EXPORT}"'")' >> "${BSF}"
110 done
112 echo ' ENDPGMEXP' >> "${BSF}"
116 # Build the service program if needed.
118 if action_needed "${LIBIFSNAME}/${SRVPGM}.SRVPGM"
119 then LINK=YES
122 if [ "${LINK}" ]
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})"
130 system "${CMD}"
131 LINK=YES
135 # If needed, (re)create the dynamic binding directory.
137 if action_needed "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR"
138 then LINK=YES
141 if [ "${LINK}" ]
142 then rm -rf "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR"
143 CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${DYNBNDDIR})"
144 CMD="${CMD} TEXT('LibCurl API dynamic binding directory')"
145 system "${CMD}"
146 CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${DYNBNDDIR})"
147 CMD="${CMD} OBJ((*LIBL/${SRVPGM} *SRVPGM))"
148 system "${CMD}"
152 # Rebuild the formdata test if needed.
154 if [ "${TEST_FORMDATA}" ]
155 then MODULES=
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}"
177 then LINK=YES
180 if [ "${LINK}" ]
181 then CMD="CRTPGM PGM(${TARGETLIB}/TFORMDATA)"
182 CMD="${CMD} ENTMOD(QADRT/QADRTMAIN2)"
183 CMD="${CMD} MODULE("
185 for MODULE in ${MODULES}
186 do CMD="${CMD} ${TARGETLIB}/${MODULE}"
187 done
189 CMD="${CMD} ) BNDSRVPGM(QADRTTS)"
190 CMD="${CMD} TGTRLS(${TGTRLS})"
191 system "${CMD}"