Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line | 
|---|---|---|---|
| 36 | pmbaty | 1 | #!/bin/sh | 
| 2 | # *NATIVE* build script for POSIX systems by Pierre-Marie Baty <pm@pmbaty.com> | ||
| 3 | |||
| 4 | THISDIR="$(pwd)" | ||
| 5 | cd ../qnx800 | ||
| 6 | . ./qnxsdp-env.sh > /dev/null || exit 1 | ||
| 7 | cd "${THISDIR}" | ||
| 8 | |||
| 9 | # figure out the target triple | ||
| 10 | if [ "$(uname)" = "QNX" ]; then | ||
| 11 |         # host is native QNX8. Neutrino has its own ABI. | ||
| 12 | TRIPLE="$(uname -p)-$(test "$(uname -m)" = "x86pc" && echo "pc" || echo "unknown")-nto-qnx800" | ||
| 13 | SYSROOT="../qnx800/host/qnx8/$(uname -p)" | ||
| 14 | elif [ "$(uname)" = "FreeBSD" ] || [ "$(uname)" = "NetBSD" ] || [ "$(uname)" = "OpenBSD" ]; then | ||
| 15 |         # host is a BSD. BSDs have their own ABI. | ||
| 16 | TRIPLE="$(uname -m)-unknown-$(uname|tr '[:upper:]' '[:lower:]')" | ||
| 17 | elif [ "$(uname)" = "Linux" ]; then | ||
| 18 |         # host is Linux. Linux uses the GNU ABI (same as Hurd) | ||
| 19 | TRIPLE="$(uname -m)-unknown-linux-gnu" | ||
| 20 | SYSROOT="../qnx800/host/linux/$(uname -m)" | ||
| 21 | elif [ "$(uname)" = "Darwin" ]; then | ||
| 22 |         # host is Apple. May be macOS or even a mobile platform (heh, why not?) - they use the Mach-O ABI | ||
| 23 | TRIPLE="$(uname -m)-apple-$(uname|tr '[:upper:]' '[:lower:]')" | ||
| 24 | else | ||
| 25 |         # best guess... assume a GNU ABI | ||
| 26 | TRIPLE="$(uname -m)-unknown-$(uname|tr '[:upper:]' '[:lower:]')-gnu" | ||
| 27 | fi | ||
| 28 | |||
| 29 | CPPFLAGS="-D_QNX_SOURCE -Ilibucl/include -Ilibucl/src -Ilibucl -Iliblzo" | ||
| 30 | LDFLAGS="" | ||
| 31 | # for debug CPPFLAGS add: -fsanitize=address -g | ||
| 32 | # for debug LDFLAGS add: -static-libasan | ||
| 33 | |||
| 34 | rm -f ifstool.$(uname) > /dev/null 2>&1 | ||
| 35 | rm -rf .build > /dev/null 2>&1 | ||
| 36 | mkdir .build > /dev/null 2>&1 | ||
| 37 | |||
| 38 | echo "Building ifstool for ${TRIPLE}..." | ||
| 39 | cc ${CPPFLAGS} $(grep 'ClCompile Include' ifstool.vcxproj|awk -F'"' '{print $2}'|tr '\\' '/') ${LDFLAGS} -o "${TRIPLE}-ifstool" || exit 1 | ||
| 40 | |||
| 41 | if [ -d "${SYSROOT}/usr/bin" ]; then | ||
| 42 |         echo Deploying ifstool to QNX8 $(uname) host toolchain... | ||
| 43 | cp "${TRIPLE}-ifstool" "${SYSROOT}/usr/bin/ifstool" || exit 1 | ||
| 44 | fi | ||
| 45 | |||
| 46 | echo "Done" | ||
| 47 | exit 0 |