1#!/bin/sh 2#*************************************************************************** 3# _ _ ____ _ 4# Project ___| | | | _ \| | 5# / __| | | | |_) | | 6# | (__| |_| | _ <| |___ 7# \___|\___/|_| \_\_____| 8# 9# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 10# 11# This software is licensed as described in the file COPYING, which 12# you should have received as part of this distribution. The terms 13# are also available at https://curl.se/docs/copyright.html. 14# 15# You may opt to use, copy, modify, merge, publish, distribute and/or sell 16# copies of the Software, and permit persons to whom the Software is 17# furnished to do so, under the terms of the COPYING file. 18# 19# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 20# KIND, either express or implied. 21# 22# SPDX-License-Identifier: curl 23# 24########################################################################### 25# 26# Command line interface tool compilation script for the OS/400. 27 28SCRIPTDIR=$(dirname "${0}") 29. "${SCRIPTDIR}/initscript.sh" 30cd "${TOPDIR}/src" || exit 1 31 32 33# Check if built-in manual can be generated. 34 35USE_MANUAL= 36if [ -f "${IFSDIR}/docs/curl.txt" ] && [ -n "${PASEPERL}" ] 37then "${PASEPERL}" ./mkhelp.pl < "${IFSDIR}/docs/curl.txt" > tool_hugehelp.c 38 USE_MANUAL="'USE_MANUAL'" 39fi 40 41 42# Get source lists. 43# CURL_CFILES are in the current directory. 44# CURLX_CFILES are in the lib directory and need to be recompiled because 45# some function names change using macros. 46 47get_make_vars Makefile.inc 48 49 50# Compile the sources into modules. 51 52# shellcheck disable=SC2034 53LINK= 54MODULES= 55# shellcheck disable=SC2034 56INCLUDES="'${TOPDIR}/lib'" 57 58for SRC in ${CURLX_CFILES} 59do MODULE=$(db2_name "${SRC}") 60 MODULE=$(db2_name "X${MODULE}") 61 make_module "${MODULE}" "${SRC}" "${USE_MANUAL}" 62done 63 64for SRC in ${CURL_CFILES} 65do MODULE=$(db2_name "${SRC}") 66 make_module "${MODULE}" "${SRC}" "${USE_MANUAL}" 67done 68 69 70# Link modules into program. 71 72MODULES="$(echo "${MODULES}" | sed "s/[^ ][^ ]*/${TARGETLIB}\/&/g")" 73CMD="CRTPGM PGM(${TARGETLIB}/${CURLPGM})" 74CMD="${CMD} ENTMOD(${TARGETLIB}/CURLMAIN)" 75CMD="${CMD} MODULE(${MODULES})" 76CMD="${CMD} BNDSRVPGM(${TARGETLIB}/${SRVPGM} QADRTTS)" 77CMD="${CMD} TGTRLS(${TGTRLS})" 78CLcommand "${CMD}" 79 80 81# Create the IFS command. 82 83IFSBIN="${IFSDIR}/bin" 84 85if action_needed "${IFSBIN}" 86then mkdir -p "${IFSBIN}" 87fi 88 89rm -f "${IFSBIN}/curl" 90ln -s "/QSYS.LIB/${TARGETLIB}.LIB/${CURLPGM}.PGM" "${IFSBIN}/curl" 91 92 93# Create the CL interface program. 94 95if action_needed "${LIBIFSNAME}/CURLCL.PGM" "${SCRIPTDIR}/curlcl.c" 96then CMD="CRTBNDC PGM(${TARGETLIB}/${CURLCLI})" 97 CMD="${CMD} SRCSTMF('${SCRIPTDIR}/curlcl.c')" 98 CMD="${CMD} DEFINE('CURLPGM=\"${CURLPGM}\"')" 99 CMD="${CMD} TGTCCSID(${TGTCCSID})" 100 CLcommand "${CMD}" 101fi 102 103 104# Create the CL command. 105 106if action_needed "${LIBIFSNAME}/${CURLCMD}.CMD" "${SCRIPTDIR}/curl.cmd" 107then CMD="CRTCMD CMD(${TARGETLIB}/${CURLCMD}) PGM(${TARGETLIB}/${CURLCLI})" 108 CMD="${CMD} SRCSTMF('${SCRIPTDIR}/curl.cmd')" 109 CLcommand "${CMD}" 110fi 111