1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-04-26 16:48:48 +03:00
libssh2/os400/make-include.sh
Viktor Szakats 81341e1e80
os400: fix shellcheck warnings in scripts (fixups)
- Build scripts must be executed by the os/400 shell (sh), not bash which
  is a PASE program: The `-ot` non-POSIX test extension works in os/400 as
  well. Ref: https://github.com/libssh2/libssh2/pull/1364#issue-2241646754

- Drop/fixup mods trying to make some syntax highlighters happier.

Follow-up to c6625707b94d9093f38f1a0a4d89c11b64f12ba8 #1358
Assisted-by: Patrick Monnerat
Closes #1364
Closes #1366
2024-04-14 01:52:11 +00:00

59 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
# Copyright (C) The libssh2 project and its contributors.
# SPDX-License-Identifier: BSD-3-Clause
#
# Installation of the header files in the OS/400 library.
#
SCRIPTDIR=$(dirname "${0}")
. "${SCRIPTDIR}/initscript.sh"
cd "${TOPDIR}/include" || exit 1
# Create the OS/400 source program file for the header files.
SRCPF="${LIBIFSNAME}/H.FILE"
if action_needed "${SRCPF}"
then CMD="CRTSRCPF FILE(${TARGETLIB}/H) RCDLEN(112)"
CMD="${CMD} CCSID(${TGTCCSID}) TEXT('libssh2: Header files')"
system "${CMD}"
fi
# Create the IFS directory for the header files.
IFSINCLUDE="${IFSDIR}/include"
if action_needed "${IFSINCLUDE}"
then mkdir -p "${IFSINCLUDE}"
fi
copy_hfile()
{
destfile="${1}"
srcfile="${2}"
shift
shift
sed -e '1i\
#pragma datamodel(P128)\
' "${@}" -e '$a\
#pragma datamodel(pop)\
' < "${srcfile}" > "${destfile}"
}
# Copy the header files.
for HFILE in *.h "${TOPDIR}/os400/libssh2_ccsid.h"
do DEST="${SRCPF}/$(db2_name "${HFILE}").MBR"
if action_needed "${DEST}" "${HFILE}"
then copy_hfile "${DEST}" "${HFILE}"
IFSDEST="${IFSINCLUDE}/$(basename "${HFILE}")"
rm -f "${IFSDEST}"
ln -s "${DEST}" "${IFSDEST}"
fi
done