#!/bin/sh1#***************************************************************************2# _ _ ____ _3# Project ___| | | | _ \| |4# / __| | | | |_) | |5# | (__| |_| | _ <| |___6# \___|\___/|_| \_\_____|7#8# Copyright (C) Daniel Stenberg, <[email protected]>, et al.9#10# This software is licensed as described in the file COPYING, which11# you should have received as part of this distribution. The terms12# are also available at https://curl.se/docs/copyright.html.13#14# You may opt to use, copy, modify, merge, publish, distribute and/or sell15# copies of the Software, and permit persons to whom the Software is16# furnished to do so, under the terms of the COPYING file.17#18# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY19# KIND, either express or implied.20#21# SPDX-License-Identifier: curl22#23###########################################################################24#25# Command line interface tool compilation script for the OS/400.2627SCRIPTDIR=$(dirname "${0}")28. "${SCRIPTDIR}/initscript.sh"29cd "${TOPDIR}/src" || exit 1303132# Check if built-in manual can be generated.3334USE_MANUAL=35if [ -f "${IFSDIR}/docs/curl.txt" ] && [ -n "${PASEPERL}" ]36then "${PASEPERL}" ./mkhelp.pl < "${IFSDIR}/docs/curl.txt" > tool_hugehelp.c37USE_MANUAL="'USE_MANUAL'"38fi394041# Get source lists.42# CURL_CFILES are in the current directory.43# CURLX_CFILES are in the lib directory and need to be recompiled because44# some function names change using macros.4546get_make_vars Makefile.inc474849# Add hugehelp, as it is not included in Makefile.inc.50if [ "${USE_MANUAL}" = "'USE_MANUAL'" ]51then52CURL_CFILES="${CURL_CFILES} tool_hugehelp.c"53CURL_HFILES="${CURL_HFILES} tool_hugehelp.h"54fi5556# Compile the sources into modules.5758# shellcheck disable=SC203459LINK=60MODULES=61# shellcheck disable=SC203462INCLUDES="'${TOPDIR}/lib' '${TOPDIR}/lib/curlx'"6364# shellcheck disable=SC215365for SRC in ${CURLX_CFILES}66do MODULE=$(db2_name "${SRC}")67MODULE=$(db2_name "X${MODULE}")68make_module "${MODULE}" "${SRC}" "${USE_MANUAL}"69done7071for SRC in ${CURL_CFILES}72do MODULE=$(db2_name "${SRC}")73make_module "${MODULE}" "${SRC}" "${USE_MANUAL}"74done757677# Link modules into program.7879MODULES="$(echo "${MODULES}" | sed "s/[^ ][^ ]*/${TARGETLIB}\/&/g")"80CMD="CRTPGM PGM(${TARGETLIB}/${CURLPGM})"81CMD="${CMD} ENTMOD(${TARGETLIB}/CURLMAIN)"82CMD="${CMD} MODULE(${MODULES})"83CMD="${CMD} BNDSRVPGM(${TARGETLIB}/${SRVPGM} QADRTTS)"84CMD="${CMD} TGTRLS(${TGTRLS})"85CLcommand "${CMD}"868788# Create the IFS command.8990IFSBIN="${IFSDIR}/bin"9192if action_needed "${IFSBIN}"93then mkdir -p "${IFSBIN}"94fi9596rm -f "${IFSBIN}/curl"97ln -s "/QSYS.LIB/${TARGETLIB}.LIB/${CURLPGM}.PGM" "${IFSBIN}/curl"9899100# Create the CL interface program.101102if action_needed "${LIBIFSNAME}/CURLCL.PGM" "${SCRIPTDIR}/curlcl.c"103then CMD="CRTBNDC PGM(${TARGETLIB}/${CURLCLI})"104CMD="${CMD} SRCSTMF('${SCRIPTDIR}/curlcl.c')"105CMD="${CMD} DEFINE('CURLPGM=\"${CURLPGM}\"')"106CMD="${CMD} TGTCCSID(${TGTCCSID})"107CLcommand "${CMD}"108fi109110111# Create the CL command.112113if action_needed "${LIBIFSNAME}/${CURLCMD}.CMD" "${SCRIPTDIR}/curl.cmd"114then CMD="CRTCMD CMD(${TARGETLIB}/${CURLCMD}) PGM(${TARGETLIB}/${CURLCLI})"115CMD="${CMD} SRCSTMF('${SCRIPTDIR}/curl.cmd')"116CLcommand "${CMD}"117fi118119120