Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/pkg
Path: blob/main/external/curl/packages/OS400/makefile.sh
2066 views
1
#!/bin/sh
2
#***************************************************************************
3
# _ _ ____ _
4
# Project ___| | | | _ \| |
5
# / __| | | | |_) | |
6
# | (__| |_| | _ <| |___
7
# \___|\___/|_| \_\_____|
8
#
9
# Copyright (C) Daniel Stenberg, <[email protected]>, 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
# curl compilation script for the OS/400.
27
#
28
#
29
# This is a shell script since make is not a standard component of OS/400.
30
31
SCRIPTDIR=$(dirname "${0}")
32
. "${SCRIPTDIR}/initscript.sh"
33
cd "${TOPDIR}" || exit 1
34
35
36
# Make sure all files are UTF8-encoded.
37
38
# shellcheck disable=SC2038
39
find "${TOPDIR}" -type f -print | xargs ls -S | while read -r CCSID FILE
40
do if [ "${CCSID}" != 1208 ]
41
then CMD="CPY OBJ('${FILE}') TOOBJ('${FILE}') FROMCCSID(*OBJ)"
42
CMD="${CMD} TOCCSID(1208) DTAFMT(*TEXT) REPLACE(*YES)"
43
(CLcommand "${CMD}")
44
fi
45
done
46
47
48
# Create the OS/400 library if it does not exist.
49
50
if action_needed "${LIBIFSNAME}"
51
then CMD="CRTLIB LIB(${TARGETLIB}) TEXT('curl: multiprotocol support API')"
52
CLcommand "${CMD}"
53
fi
54
55
56
# Create the DOCS source file if it does not exist.
57
58
if action_needed "${LIBIFSNAME}/DOCS.FILE"
59
then CMD="CRTSRCPF FILE(${TARGETLIB}/DOCS) RCDLEN(240)"
60
CMD="${CMD} CCSID(${TGTCCSID}) TEXT('Documentation texts')"
61
CLcommand "${CMD}"
62
fi
63
64
65
# Copy some documentation files if needed.
66
67
for TEXT in "${TOPDIR}/COPYING" "${SCRIPTDIR}/README.OS400" \
68
"${TOPDIR}/CHANGES.md" "${TOPDIR}/docs/THANKS" "${TOPDIR}/docs/FAQ" \
69
"${TOPDIR}/docs/FEATURES" "${TOPDIR}/docs/SSLCERTS.md" \
70
"${TOPDIR}/docs/RESOURCES" "${TOPDIR}/docs/VERSIONS.md" \
71
"${TOPDIR}/docs/HISTORY.md"
72
do MEMBER="$(basename "${TEXT}" .OS400)"
73
MEMBER="$(basename "${MEMBER}" .md)"
74
MEMBER="${LIBIFSNAME}/DOCS.FILE/$(db2_name "${MEMBER}").MBR"
75
76
[ -e "${TEXT}" ] || continue
77
78
if action_needed "${MEMBER}" "${TEXT}"
79
then CMD="CPY OBJ('${TEXT}') TOOBJ('${MEMBER}') TOCCSID(${TGTCCSID})"
80
CMD="${CMD} DTAFMT(*TEXT) REPLACE(*YES)"
81
CLcommand "${CMD}"
82
fi
83
done
84
85
86
# Create the RPGXAMPLES source file if it does not exist.
87
88
if action_needed "${LIBIFSNAME}/RPGXAMPLES.FILE"
89
then CMD="CRTSRCPF FILE(${TARGETLIB}/RPGXAMPLES) RCDLEN(240)"
90
CMD="${CMD} CCSID(${TGTCCSID}) TEXT('ILE/RPG examples')"
91
CLcommand "${CMD}"
92
fi
93
94
95
# Copy RPG examples if needed.
96
97
for EXAMPLE in "${SCRIPTDIR}/rpg-examples"/*
98
do MEMBER="$(basename "${EXAMPLE}")"
99
IFSMEMBER="${LIBIFSNAME}/RPGXAMPLES.FILE/$(db2_name "${MEMBER}").MBR"
100
101
[ -e "${EXAMPLE}" ] || continue
102
103
if action_needed "${IFSMEMBER}" "${EXAMPLE}"
104
then CMD="CPY OBJ('${EXAMPLE}') TOOBJ('${IFSMEMBER}')"
105
CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)"
106
CLcommand "${CMD}"
107
MBRTEXT=$(sed -e '1!d;/^ \*/!d;s/^ *\* *//' \
108
-e 's/ *$//;s/'"'"'/&&/g' < "${EXAMPLE}")
109
CMD="CHGPFM FILE(${TARGETLIB}/RPGXAMPLES) MBR(${MEMBER})"
110
CMD="${CMD} SRCTYPE(RPGLE) TEXT('${MBRTEXT}')"
111
CLcommand "${CMD}"
112
fi
113
done
114
115
116
# Compile the QADRTMAIN2 replacement module.
117
118
if action_needed "${LIBIFSNAME}/CURLMAIN.MODULE" "${SCRIPTDIR}/curlmain.c"
119
then CMD="CRTCMOD MODULE(${TARGETLIB}/CURLMAIN)"
120
CMD="${CMD} SRCSTMF('${SCRIPTDIR}/curlmain.c')"
121
CMD="${CMD} SYSIFCOPT(*IFS64IO) LOCALETYPE(*LOCALE) FLAG(10)"
122
CMD="${CMD} TGTCCSID(${TGTCCSID}) TGTRLS(${TGTRLS})"
123
CMD="${CMD} OUTPUT(${OUTPUT})"
124
CMD="${CMD} OPTIMIZE(${OPTIMIZE})"
125
CMD="${CMD} DBGVIEW(${DEBUG})"
126
CLcommand "${CMD}"
127
fi
128
129
130
# Build in each directory.
131
132
# for SUBDIR in include lib docs src tests
133
for SUBDIR in include lib docs src
134
do "${SCRIPTDIR}/make-${SUBDIR}.sh"
135
done
136
137