xref: /curl/packages/OS400/make-src.sh (revision 5e46c290)
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#       Get source lists.
34#       CURL_CFILES are in the current directory.
35#       CURLX_CFILES are in the lib directory and need to be recompiled because
36#               some function names change using macros.
37
38get_make_vars Makefile.inc
39
40
41#       Compile the sources into modules.
42
43# shellcheck disable=SC2034
44LINK=
45MODULES=
46# shellcheck disable=SC2034
47INCLUDES="'${TOPDIR}/lib'"
48
49for SRC in ${CURLX_CFILES}
50do      MODULE=$(db2_name "${SRC}")
51        MODULE=$(db2_name "X${MODULE}")
52        make_module "${MODULE}" "${SRC}"
53done
54
55for SRC in ${CURL_CFILES}
56do      MODULE=$(db2_name "${SRC}")
57        make_module "${MODULE}" "${SRC}"
58done
59
60
61#       Link modules into program.
62
63MODULES="$(echo "${MODULES}" | sed "s/[^ ][^ ]*/${TARGETLIB}\/&/g")"
64CMD="CRTPGM PGM(${TARGETLIB}/${CURLPGM})"
65CMD="${CMD} ENTMOD(${TARGETLIB}/CURLMAIN)"
66CMD="${CMD} MODULE(${MODULES})"
67CMD="${CMD} BNDSRVPGM(${TARGETLIB}/${SRVPGM} QADRTTS)"
68CMD="${CMD} TGTRLS(${TGTRLS})"
69CLcommand "${CMD}"
70
71
72#       Create the IFS command.
73
74IFSBIN="${IFSDIR}/bin"
75
76if action_needed "${IFSBIN}"
77then    mkdir -p "${IFSBIN}"
78fi
79
80rm -f "${IFSBIN}/curl"
81ln -s "/QSYS.LIB/${TARGETLIB}.LIB/${CURLPGM}.PGM" "${IFSBIN}/curl"
82
83
84#       Create the CL interface program.
85
86if action_needed "${LIBIFSNAME}/CURLCL.PGM" "${SCRIPTDIR}/curlcl.c"
87then    CMD="CRTBNDC PGM(${TARGETLIB}/${CURLCLI})"
88        CMD="${CMD} SRCSTMF('${SCRIPTDIR}/curlcl.c')"
89        CMD="${CMD} DEFINE('CURLPGM=\"${CURLPGM}\"')"
90        CMD="${CMD} TGTCCSID(${TGTCCSID})"
91        CLcommand "${CMD}"
92fi
93
94
95#       Create the CL command.
96
97if action_needed "${LIBIFSNAME}/${CURLCMD}.CMD" "${SCRIPTDIR}/curl.cmd"
98then    CMD="CRTCMD CMD(${TARGETLIB}/${CURLCMD}) PGM(${TARGETLIB}/${CURLCLI})"
99        CMD="${CMD} SRCSTMF('${SCRIPTDIR}/curl.cmd')"
100        CLcommand "${CMD}"
101fi
102