2007-08-23 22:30:24 +08:00
|
|
|
#!/bin/sh
|
2020-03-23 21:44:29 +08:00
|
|
|
#***************************************************************************
|
|
|
|
# _ _ ____ _
|
|
|
|
# Project ___| | | | _ \| |
|
|
|
|
# / __| | | | |_) | |
|
|
|
|
# | (__| |_| | _ <| |___
|
|
|
|
# \___|\___/|_| \_\_____|
|
|
|
|
#
|
2023-01-02 20:51:48 +08:00
|
|
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
2020-03-23 21:44:29 +08:00
|
|
|
#
|
|
|
|
# This software is licensed as described in the file COPYING, which
|
|
|
|
# you should have received as part of this distribution. The terms
|
2020-11-04 21:02:01 +08:00
|
|
|
# are also available at https://curl.se/docs/copyright.html.
|
2020-03-23 21:44:29 +08:00
|
|
|
#
|
|
|
|
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
# copies of the Software, and permit persons to whom the Software is
|
|
|
|
# furnished to do so, under the terms of the COPYING file.
|
|
|
|
#
|
|
|
|
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
# KIND, either express or implied.
|
|
|
|
#
|
2007-08-23 22:30:24 +08:00
|
|
|
# SPDX-License-Identifier: curl
|
2022-05-17 17:16:50 +08:00
|
|
|
#
|
2020-03-23 21:44:29 +08:00
|
|
|
###########################################################################
|
2007-08-23 22:30:24 +08:00
|
|
|
#
|
|
|
|
# libcurl compilation script for the OS/400.
|
|
|
|
#
|
|
|
|
|
|
|
|
SCRIPTDIR=`dirname "${0}"`
|
|
|
|
. "${SCRIPTDIR}/initscript.sh"
|
|
|
|
cd "${TOPDIR}/lib"
|
|
|
|
|
2014-12-05 23:11:07 +08:00
|
|
|
# Need to have IFS access to the mih/cipher header file.
|
|
|
|
|
|
|
|
if action_needed cipher.mih '/QSYS.LIB/QSYSINC.LIB/MIH.FILE/CIPHER.MBR'
|
|
|
|
then rm -f cipher.mih
|
|
|
|
ln -s '/QSYS.LIB/QSYSINC.LIB/MIH.FILE/CIPHER.MBR' cipher.mih
|
|
|
|
fi
|
|
|
|
|
2007-08-23 22:30:24 +08:00
|
|
|
|
|
|
|
# Create and compile the identification source file.
|
|
|
|
|
|
|
|
echo '#pragma comment(user, "libcurl version '"${LIBCURL_VERSION}"'")' > os400.c
|
2011-04-18 22:52:27 +08:00
|
|
|
echo '#pragma comment(user, __DATE__)' >> os400.c
|
|
|
|
echo '#pragma comment(user, __TIME__)' >> os400.c
|
2023-01-02 20:51:48 +08:00
|
|
|
echo '#pragma comment(copyright, "Copyright (C) Daniel Stenberg et al. OS/400 version by P. Monnerat")' >> os400.c
|
2007-08-23 22:30:24 +08:00
|
|
|
make_module OS400 os400.c
|
|
|
|
LINK= # No need to rebuild service program yet.
|
|
|
|
MODULES=
|
|
|
|
|
|
|
|
|
|
|
|
# Get source list.
|
|
|
|
|
2014-06-19 02:22:44 +08:00
|
|
|
sed -e ':begin' \
|
|
|
|
-e '/\\$/{' \
|
|
|
|
-e 's/\\$/ /' \
|
|
|
|
-e 'N' \
|
|
|
|
-e 'bbegin' \
|
|
|
|
-e '}' \
|
|
|
|
-e 's/\n//g' \
|
|
|
|
-e 's/[[:space:]]*$//' \
|
|
|
|
-e 's/^\([A-Za-z][A-Za-z0-9_]*\)[[:space:]]*=[[:space:]]*\(.*\)/\1="\2"/' \
|
|
|
|
-e 's/\$(\([A-Za-z][A-Za-z0-9_]*\))/${\1}/g' \
|
|
|
|
< Makefile.inc > tmpscript.sh
|
|
|
|
. ./tmpscript.sh
|
2007-08-23 22:30:24 +08:00
|
|
|
|
|
|
|
|
|
|
|
# Compile the sources into modules.
|
|
|
|
|
|
|
|
INCLUDES="'`pwd`'"
|
|
|
|
|
2020-01-27 16:23:43 +08:00
|
|
|
# Create a small C program to check ccsidcurl.c is up to date
|
|
|
|
if action_needed "${LIBIFSNAME}/CHKSTRINGS.PGM"
|
|
|
|
then
|
|
|
|
CMD="CRTBNDC PGM(${TARGETLIB}/CHKSTRINGS) SRCSTMF('${SCRIPTDIR}/chkstrings.c')"
|
|
|
|
CMD="${CMD} INCDIR('${TOPDIR}/include/curl' '${TOPDIR}/include' '${SRCDIR}' ${INCLUDES})"
|
|
|
|
system -i "${CMD}"
|
|
|
|
if [ $? -ne 0 ]
|
|
|
|
then
|
|
|
|
echo "ERROR: Failed to build CHKSTRINGS *PGM object!"
|
|
|
|
exit 2
|
|
|
|
else
|
|
|
|
${LIBIFSNAME}/CHKSTRINGS.PGM
|
|
|
|
if [ $? -ne 0 ]
|
|
|
|
then
|
|
|
|
echo "ERROR: CHKSTRINGS failed!"
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2007-08-23 22:30:24 +08:00
|
|
|
make_module OS400SYS "${SCRIPTDIR}/os400sys.c"
|
|
|
|
make_module CCSIDCURL "${SCRIPTDIR}/ccsidcurl.c"
|
|
|
|
|
|
|
|
for SRC in ${CSOURCES}
|
2011-07-14 23:07:35 +08:00
|
|
|
do MODULE=`db2_name "${SRC}"`
|
2007-08-23 22:30:24 +08:00
|
|
|
make_module "${MODULE}" "${SRC}"
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
# If needed, (re)create the static binding directory.
|
|
|
|
|
|
|
|
if action_needed "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR"
|
|
|
|
then LINK=YES
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${LINK}" ]
|
|
|
|
then rm -rf "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR"
|
|
|
|
CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${STATBNDDIR})"
|
|
|
|
CMD="${CMD} TEXT('LibCurl API static binding directory')"
|
|
|
|
system "${CMD}"
|
|
|
|
|
|
|
|
for MODULE in ${MODULES}
|
|
|
|
do CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${STATBNDDIR})"
|
|
|
|
CMD="${CMD} OBJ((${TARGETLIB}/${MODULE} *MODULE))"
|
|
|
|
system "${CMD}"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# The exportation file for service program creation must be in a DB2
|
|
|
|
# source file, so make sure it exists.
|
|
|
|
|
|
|
|
if action_needed "${LIBIFSNAME}/TOOLS.FILE"
|
|
|
|
then CMD="CRTSRCPF FILE(${TARGETLIB}/TOOLS) RCDLEN(112)"
|
|
|
|
CMD="${CMD} TEXT('curl: build tools')"
|
|
|
|
system "${CMD}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Gather the list of symbols to export.
|
2023-01-09 21:22:36 +08:00
|
|
|
# First use awk to pull all CURL_EXTERN function prototypes from
|
|
|
|
# the header files, pass through to sed to strip CURL_DEPRECATED(..)
|
|
|
|
# then back to awk to pull the string immediately to the left of a
|
|
|
|
# bracket stripping any spaces or *'s.
|
2007-08-23 22:30:24 +08:00
|
|
|
|
2023-01-09 21:22:36 +08:00
|
|
|
EXPORTS=`awk '/^CURL_EXTERN/,/;/' \
|
2007-08-23 22:30:24 +08:00
|
|
|
"${TOPDIR}"/include/curl/*.h \
|
|
|
|
"${SCRIPTDIR}/ccsidcurl.h" |
|
2023-01-09 21:22:36 +08:00
|
|
|
sed 's| CURL_DEPRECATED(.*)||g' |
|
|
|
|
awk '{br=index($0,"("); \
|
|
|
|
if (br) { \
|
|
|
|
for(c=br-1; ;c--) { \
|
|
|
|
if (c==1) { \
|
|
|
|
print substr($0,c,br-1); break \
|
|
|
|
} else if (match(substr($0, c, br-c), "[ *]") != 0) { \
|
|
|
|
print substr($0, c+1, br-c-1); break \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
}'`
|
2007-08-23 22:30:24 +08:00
|
|
|
|
|
|
|
# Create the service program exportation file in DB2 member if needed.
|
|
|
|
|
|
|
|
BSF="${LIBIFSNAME}/TOOLS.FILE/BNDSRC.MBR"
|
|
|
|
|
2008-01-17 00:04:47 +08:00
|
|
|
if action_needed "${BSF}" Makefile.am
|
2007-08-23 22:30:24 +08:00
|
|
|
then LINK=YES
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${LINK}" ]
|
2008-01-17 00:04:47 +08:00
|
|
|
then echo " STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('LIBCURL_${SONAME}')" \
|
|
|
|
> "${BSF}"
|
2007-08-23 22:30:24 +08:00
|
|
|
for EXPORT in ${EXPORTS}
|
|
|
|
do echo ' EXPORT SYMBOL("'"${EXPORT}"'")' >> "${BSF}"
|
|
|
|
done
|
|
|
|
|
|
|
|
echo ' ENDPGMEXP' >> "${BSF}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Build the service program if needed.
|
|
|
|
|
|
|
|
if action_needed "${LIBIFSNAME}/${SRVPGM}.SRVPGM"
|
|
|
|
then LINK=YES
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${LINK}" ]
|
|
|
|
then CMD="CRTSRVPGM SRVPGM(${TARGETLIB}/${SRVPGM})"
|
|
|
|
CMD="${CMD} SRCFILE(${TARGETLIB}/TOOLS) SRCMBR(BNDSRC)"
|
|
|
|
CMD="${CMD} MODULE(${TARGETLIB}/OS400)"
|
2013-10-26 00:37:37 +08:00
|
|
|
CMD="${CMD} BNDDIR(${TARGETLIB}/${STATBNDDIR}"
|
|
|
|
if [ "${WITH_ZLIB}" != 0 ]
|
|
|
|
then CMD="${CMD} ${ZLIB_LIB}/${ZLIB_BNDDIR}"
|
2015-11-19 20:35:29 +08:00
|
|
|
liblist -a "${ZLIB_LIB}"
|
|
|
|
fi
|
|
|
|
if [ "${WITH_LIBSSH2}" != 0 ]
|
|
|
|
then CMD="${CMD} ${LIBSSH2_LIB}/${LIBSSH2_BNDDIR}"
|
|
|
|
liblist -a "${LIBSSH2_LIB}"
|
2013-10-26 00:37:37 +08:00
|
|
|
fi
|
|
|
|
CMD="${CMD})"
|
2007-12-11 01:09:09 +08:00
|
|
|
CMD="${CMD} BNDSRVPGM(QADRTTS QGLDCLNT QGLDBRDR)"
|
2007-08-23 22:30:24 +08:00
|
|
|
CMD="${CMD} TEXT('curl API library')"
|
|
|
|
CMD="${CMD} TGTRLS(${TGTRLS})"
|
|
|
|
system "${CMD}"
|
|
|
|
LINK=YES
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# If needed, (re)create the dynamic binding directory.
|
|
|
|
|
|
|
|
if action_needed "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR"
|
|
|
|
then LINK=YES
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${LINK}" ]
|
|
|
|
then rm -rf "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR"
|
|
|
|
CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${DYNBNDDIR})"
|
|
|
|
CMD="${CMD} TEXT('LibCurl API dynamic binding directory')"
|
|
|
|
system "${CMD}"
|
|
|
|
CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${DYNBNDDIR})"
|
|
|
|
CMD="${CMD} OBJ((*LIBL/${SRVPGM} *SRVPGM))"
|
|
|
|
system "${CMD}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Rebuild the formdata test if needed.
|
|
|
|
|
|
|
|
if [ "${TEST_FORMDATA}" ]
|
|
|
|
then MODULES=
|
2013-01-04 09:50:28 +08:00
|
|
|
make_module TFORMDATA formdata.c "'_FORM_DEBUG' 'CURLDEBUG'"
|
|
|
|
make_module TSTREQUAL strequal.c "'_FORM_DEBUG' 'CURLDEBUG'"
|
|
|
|
make_module TMEMDEBUG memdebug.c "'_FORM_DEBUG' 'CURLDEBUG'"
|
|
|
|
make_module TMPRINTF mprintf.c "'_FORM_DEBUG' 'CURLDEBUG'"
|
|
|
|
make_module TSTRERROR strerror.c "'_FORM_DEBUG' 'CURLDEBUG'"
|
2007-08-23 22:30:24 +08:00
|
|
|
# The following modules should not be needed (see comment in
|
2013-01-04 09:50:28 +08:00
|
|
|
# formdata.c. However, there are some unsatisfied
|
2007-08-23 22:30:24 +08:00
|
|
|
# external references leading in the following
|
|
|
|
# modules to be (recursively) needed.
|
2014-10-13 22:33:47 +08:00
|
|
|
MODULES="${MODULES} EASY STRDUP SSLGEN GSKIT HOSTIP HOSTIP4 HOSTIP6"
|
2007-08-23 22:30:24 +08:00
|
|
|
MODULES="${MODULES} URL HASH TRANSFER GETINFO COOKIE SENDF SELECT"
|
|
|
|
MODULES="${MODULES} INET_NTOP SHARE HOSTTHRE MULTI LLIST FTP HTTP"
|
|
|
|
MODULES="${MODULES} HTTP_DIGES HTTP_CHUNK HTTP_NEGOT TIMEVAL HOSTSYN"
|
|
|
|
MODULES="${MODULES} CONNECT SOCKS PROGRESS ESCAPE INET_PTON GETENV"
|
|
|
|
MODULES="${MODULES} DICT LDAP TELNET FILE TFTP NETRC PARSEDATE"
|
|
|
|
MODULES="${MODULES} SPEEDCHECK SPLAY BASE64 SECURITY IF2IP MD5"
|
|
|
|
MODULES="${MODULES} KRB5 OS400SYS"
|
|
|
|
|
|
|
|
PGMIFSNAME="${LIBIFSNAME}/TFORMDATA.PGM"
|
|
|
|
|
|
|
|
if action_needed "${PGMIFSNAME}"
|
|
|
|
then LINK=YES
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${LINK}" ]
|
|
|
|
then CMD="CRTPGM PGM(${TARGETLIB}/TFORMDATA)"
|
|
|
|
CMD="${CMD} ENTMOD(QADRT/QADRTMAIN2)"
|
|
|
|
CMD="${CMD} MODULE("
|
|
|
|
|
|
|
|
for MODULE in ${MODULES}
|
|
|
|
do CMD="${CMD} ${TARGETLIB}/${MODULE}"
|
|
|
|
done
|
|
|
|
|
|
|
|
CMD="${CMD} ) BNDSRVPGM(QADRTTS)"
|
|
|
|
CMD="${CMD} TGTRLS(${TGTRLS})"
|
|
|
|
system "${CMD}"
|
|
|
|
fi
|
|
|
|
fi
|