source: xplra/buildall.sh@ 75:901b47f772b0

Last change on this file since 75:901b47f772b0 was 75:901b47f772b0, checked in by István Váradi <ivaradi@…>, 11 years ago

Made it possible to build the used libraries as shared ones too

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