#!/bin/bash set -e -u # Script to build all components needed for the X-Plane Remote Access plugin. # # Usage: buildall.sh [] # # The C/C++ flags default to -O2 scriptdir=`dirname $0` if test $# -lt 3; then echo "Usage: buildall.sh []" exit 1 fi config="${1}" dest="${2}" host="${3}" cflags="${4:-}" if test -z "${cflags}"; then cflags="-O2" fi XPLRA_SOURCE_DIR=`cd "${scriptdir}"; pwd` if test -r "${config}"; then . ${config} else echo "Configuration file \"${config}\" not found" exit 2 fi echo "Building all into \"${dest}\" with host ${host} using C/C++ flags '${cflags}'" echo instdir="${dest}/install" vscpldir="${dest}/vscpl" xplcommondir="${dest}/xplcommon" xplradir="${dest}/xplra" libconfigopts="" case "${host}" in x86_64-linux-gnu) cflags="${cflags} -fPIC" ;; i686-linux-gnu) cflags="${cflags} -m32" ;; esac echo "Removing destination directory ${dest}" rm -rf "${dest}" echo build() { local sourcedir="${1}" local builddir="${2}" local configopts="${3}" local maketarget="${4}" mkdir -p "${builddir}" cd "${builddir}" "${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 make ${MAKEOPTS} ${maketarget} > make.log 2>&1 } echo "Building VSCPL" build "${VSCPL_SOURCE_DIR}" "${vscpldir}" "${libconfigopts}" install echo echo "Building XPLCOMMON" build "${XPLCOMMON_SOURCE_DIR}" "${xplcommondir}" "${libconfigopts}" install echo echo "Building XPLRA" build "${XPLRA_SOURCE_DIR}" "${xplradir}" "" all echo echo "Building successful"