1#!/bin/sh
2#
3#       libssh2 compilation script for the OS/400.
4#
5#
6#       This is a shell script since make is not a standard component of OS/400.
7
8SCRIPTDIR=`dirname "${0}"`
9. "${SCRIPTDIR}/initscript.sh"
10cd "${TOPDIR}"
11
12
13#       Create the OS/400 library if it does not exist.
14
15if action_needed "${LIBIFSNAME}"
16then    CMD="CRTLIB LIB(${TARGETLIB}) TEXT('libssh2: SSH2 protocol API')"
17        system "${CMD}"
18fi
19
20
21#       Create the DOCS source file if it does not exist.
22
23if action_needed "${LIBIFSNAME}/DOCS.FILE"
24then    CMD="CRTSRCPF FILE(${TARGETLIB}/DOCS) RCDLEN(240)"
25        CMD="${CMD} CCSID(${TGTCCSID}) TEXT('Documentation texts')"
26        system "${CMD}"
27fi
28
29
30#       Copy some documentation files if needed.
31
32for TEXT in "${TOPDIR}/COPYING" "${SCRIPTDIR}/README400"                \
33    "${TOPDIR}/NEWS" "${TOPDIR}/README" "${TOPDIR}/docs/AUTHORS"        \
34    "${TOPDIR}/docs/BINDINGS"
35do      MEMBER="${LIBIFSNAME}/DOCS.FILE/`db2_name \"${TEXT}\"`.MBR"
36
37        if action_needed "${MEMBER}" "${TEXT}"
38        then    CMD="CPY OBJ('${TEXT}') TOOBJ('${MEMBER}') TOCCSID(${TGTCCSID})"
39                CMD="${CMD} DTAFMT(*TEXT) REPLACE(*YES)"
40                system "${CMD}"
41        fi
42done
43
44
45#       Build in each directory.
46
47for SUBDIR in include rpg src
48do      "${SCRIPTDIR}/make-${SUBDIR}.sh"
49done
50