Line | |
---|
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 | cflags="${cflags} -fPIC"
|
---|
47 | ;;
|
---|
48 | i686-linux-gnu)
|
---|
49 | cflags="${cflags} -m32 -fno-stack-protector"
|
---|
50 | ;;
|
---|
51 | esac
|
---|
52 |
|
---|
53 | echo "Removing destination directory ${dest}"
|
---|
54 | rm -rf "${dest}"
|
---|
55 | echo
|
---|
56 |
|
---|
57 | build()
|
---|
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 |
|
---|
71 | echo "Building VSCPL"
|
---|
72 | build "${VSCPL_SOURCE_DIR}" "${vscpldir}" "${libconfigopts}" install
|
---|
73 | echo
|
---|
74 |
|
---|
75 | echo "Building XPLCOMMON"
|
---|
76 | build "${XPLCOMMON_SOURCE_DIR}" "${xplcommondir}" "${libconfigopts}" install
|
---|
77 | echo
|
---|
78 |
|
---|
79 | echo "Building XPLRA"
|
---|
80 | build "${XPLRA_SOURCE_DIR}" "${xplradir}" "" install
|
---|
81 | echo
|
---|
82 |
|
---|
83 | echo "Building successful"
|
---|
Note:
See
TracBrowser
for help on using the repository browser.