Revert "Update to 7.40.1"
[platform/upstream/curl.git] / packages / OS400 / make-lib.sh
index c41e68f..ec9e2f0 100644 (file)
@@ -2,33 +2,18 @@
 #
 #       libcurl compilation script for the OS/400.
 #
-# $Id$
 
 SCRIPTDIR=`dirname "${0}"`
 . "${SCRIPTDIR}/initscript.sh"
 cd "${TOPDIR}/lib"
 
 
-#       Create ca-bundle.h file.
-
-if action_needed "ca-bundle.h"
-then    echo "/* This file is generated automatically */" > ca-bundle.h
-        echo "#ifndef CURL_CA_BUNDLE" >> ca-bundle.h
-
-        if [ "${CABUNDLE}" ]
-        then    echo '#define CURL_CA_BUNDLE @CURL_CA_BUNDLE@' >> ca-bundle.h
-        else    echo '#undef CURL_CA_BUNDLE /* unknown */' >> ca-bundle.h
-        fi
-
-        echo "#endif" >> ca-bundle.h
-fi
-
-
 #      Create and compile the identification source file.
 
 echo '#pragma comment(user, "libcurl version '"${LIBCURL_VERSION}"'")' > os400.c
-echo '#pragma comment(date)' >> os400.c
-echo '#pragma comment(copyright, "Copyright (C) 1998-2007 Daniel Stenberg et al. OS/400 version by P. Monnerat")' >> os400.c
+echo '#pragma comment(user, __DATE__)' >> os400.c
+echo '#pragma comment(user, __TIME__)' >> os400.c
+echo '#pragma comment(copyright, "Copyright (C) 1998-2013 Daniel Stenberg et al. OS/400 version by P. Monnerat")' >> os400.c
 make_module     OS400           os400.c
 LINK=                           # No need to rebuild service program yet.
 MODULES=
@@ -36,21 +21,18 @@ MODULES=
 
 #       Get source list.
 
-CSOURCES()
-
-{
-        shift                   # Drop the equal sign.
-        CSOURCES="$*"           # Get the file names.
-}
-
-HHEADERS()
-
-{
-        shift                   # Drop the equal sign.
-        HHEADERS="$*"           # Get the file names.
-}
-
-. Makefile.inc
+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
 
 
 #       Compile the sources into modules.
@@ -61,9 +43,7 @@ make_module     OS400SYS        "${SCRIPTDIR}/os400sys.c"
 make_module     CCSIDCURL       "${SCRIPTDIR}/ccsidcurl.c"
 
 for SRC in ${CSOURCES}
-do      MODULE=`basename "${SRC}" .c |
-                tr '[a-z]' '[A-Z]'   |
-                sed -e 's/^\(..........\).*/\1/'`
+do      MODULE=`db2_name "${SRC}"`
         make_module "${MODULE}" "${SRC}"
 done
 
@@ -100,12 +80,12 @@ fi
 
 #       Gather the list of symbols to export.
 
-EXPORTS=`grep '^CURL_EXTERN[   ]'                                      \
+EXPORTS=`grep '^CURL_EXTERN[[:space:]]'                                 \
               "${TOPDIR}"/include/curl/*.h                              \
               "${SCRIPTDIR}/ccsidcurl.h"                                |
-         sed -e 's/^.*CURL_EXTERN[     ]\(.*\)(.*$/\1/'                \
-             -e 's/[   ]*$//'                                          \
-             -e 's/^.*[        ][      ]*//'                           \
+         sed -e 's/^.*CURL_EXTERN[[:space:]]\(.*\)(.*$/\1/'             \
+             -e 's/[[:space:]]*$//'                                     \
+             -e 's/^.*[[:space:]][[:space:]]*//'                        \
              -e 's/^\*//'                                               \
              -e 's/(\(.*\))/\1/'`
 
@@ -113,12 +93,13 @@ EXPORTS=`grep '^CURL_EXTERN[       ]'                                      \
 
 BSF="${LIBIFSNAME}/TOOLS.FILE/BNDSRC.MBR"
 
-if action_needed "${BSF}"
+if action_needed "${BSF}" Makefile.am
 then    LINK=YES
 fi
 
 if [ "${LINK}" ]
-then    echo " STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('LIBCURL')" > "${BSF}"
+then    echo " STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('LIBCURL_${SONAME}')" \
+            > "${BSF}"
         for EXPORT in ${EXPORTS}
         do      echo ' EXPORT    SYMBOL("'"${EXPORT}"'")' >> "${BSF}"
         done
@@ -137,8 +118,12 @@ if [ "${LINK}" ]
 then    CMD="CRTSRVPGM SRVPGM(${TARGETLIB}/${SRVPGM})"
         CMD="${CMD} SRCFILE(${TARGETLIB}/TOOLS) SRCMBR(BNDSRC)"
         CMD="${CMD} MODULE(${TARGETLIB}/OS400)"
-        CMD="${CMD} BNDDIR(${TARGETLIB}/${STATBNDDIR})"
-        CMD="${CMD} BNDSRVPGM(QADRTTS)"
+        CMD="${CMD} BNDDIR(${TARGETLIB}/${STATBNDDIR}"
+        if [ "${WITH_ZLIB}" != 0 ]
+        then    CMD="${CMD} ${ZLIB_LIB}/${ZLIB_BNDDIR}"
+        fi
+        CMD="${CMD})"
+        CMD="${CMD} BNDSRVPGM(QADRTTS QGLDCLNT QGLDBRDR)"
         CMD="${CMD} TEXT('curl API library')"
         CMD="${CMD} TGTRLS(${TGTRLS})"
         system "${CMD}"