Rev | Line | |
---|
[62] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
| 3 | set -e -u
|
---|
| 4 |
|
---|
| 5 | # Script to build all components needed for the X-Plane Remote Access plugin.
|
---|
| 6 | #
|
---|
| 7 | # Usage: buildall.sh <configuration file> <destination directory> <host> [<C/C++ flags>]
|
---|
| 8 | #
|
---|
| 9 | # The C/C++ flags default to -O2
|
---|
| 10 |
|
---|
| 11 | scriptdir=`dirname $0`
|
---|
| 12 |
|
---|
| 13 | if test $# -lt 3; then
|
---|
| 14 | echo "Usage: buildall.sh <configuration file> <destination directory> <host> [<C/C++ flags>]"
|
---|
| 15 | exit 1
|
---|
| 16 | fi
|
---|
| 17 |
|
---|
| 18 | config="${1}"
|
---|
| 19 | dest="${2}"
|
---|
| 20 | host="${3}"
|
---|
| 21 | cflags="${4:-}"
|
---|
| 22 | if test -z "${cflags}"; then
|
---|
| 23 | cflags="-O2"
|
---|
| 24 | fi
|
---|
| 25 |
|
---|
| 26 | XPLRA_SOURCE_DIR=`cd "${scriptdir}"; pwd`
|
---|
| 27 |
|
---|
| 28 | if test -r "${config}"; then
|
---|
| 29 | . ${config}
|
---|
| 30 | else
|
---|
| 31 | echo "Configuration file \"${config}\" not found"
|
---|
| 32 | exit 2
|
---|
| 33 | fi
|
---|
| 34 |
|
---|
| 35 | echo "Building all into \"${dest}\" with host ${host} using C/C++ flags '${cflags}'"
|
---|
| 36 | echo
|
---|
| 37 |
|
---|
| 38 | instdir="${dest}/install"
|
---|
| 39 | vscpldir="${dest}/vscpl"
|
---|
| 40 | xplcommondir="${dest}/xplcommon"
|
---|
| 41 | xplradir="${dest}/xplra"
|
---|
| 42 |
|
---|
| 43 | libconfigopts=""
|
---|
| 44 | case "${host}" in
|
---|
| 45 | x86_64-linux-gnu)
|
---|
| 46 | libconfigopts="--disable-shared"
|
---|
| 47 | cflags="${cflags} -fPIC"
|
---|
| 48 | ;;
|
---|
| 49 | i686-linux-gnu)
|
---|
| 50 | libconfigopts="--disable-shared"
|
---|
| 51 | cflags="${cflags} -m32"
|
---|
| 52 | ;;
|
---|
| 53 | esac
|
---|
| 54 |
|
---|
| 55 | echo "Removing destination directory ${dest}"
|
---|
| 56 | rm -rf "${dest}"
|
---|
| 57 | echo
|
---|
| 58 |
|
---|
| 59 | build()
|
---|
| 60 | {
|
---|
| 61 | local sourcedir="${1}"
|
---|
| 62 | local builddir="${2}"
|
---|
| 63 | local configopts="${3}"
|
---|
| 64 | local maketarget="${4}"
|
---|
| 65 |
|
---|
| 66 | mkdir -p "${builddir}"
|
---|
| 67 | cd "${builddir}"
|
---|
| 68 | "${sourcedir}/configure" --prefix="${instdir}" --with-xpsdk="${XPSDK_DIR}" ${configopts} --host "${host}" CFLAGS="${cflags}" CXXFLAGS="${cflags}" PKG_CONFIG_PATH="${instdir}/lib/pkgconfig" > "configure.log" 2>&1
|
---|
| 69 | make ${MAKEOPTS} ${maketarget} > make.log 2>&1
|
---|
| 70 |
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | echo "Building VSCPL"
|
---|
| 74 | build "${VSCPL_SOURCE_DIR}" "${vscpldir}" "${libconfigopts}" install
|
---|
| 75 | echo
|
---|
| 76 |
|
---|
| 77 | echo "Building XPLCOMMON"
|
---|
| 78 | build "${XPLCOMMON_SOURCE_DIR}" "${xplcommondir}" "${libconfigopts}" install
|
---|
| 79 | echo
|
---|
| 80 |
|
---|
| 81 | echo "Building XPLRA"
|
---|
| 82 | build "${XPLRA_SOURCE_DIR}" "${xplradir}" "" all
|
---|
| 83 | echo
|
---|
| 84 |
|
---|
| 85 | echo "Building successful"
|
---|
Note:
See
TracBrowser
for help on using the repository browser.