742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1
|
#!/bin/sh
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3
|
#foreach( $var in $vars )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4
|
#if( $var.exec )
|
787
|
5
|
${var.varName}=`${var.value}`
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6
|
#else
|
787
|
7
|
${var.varName}=${var.value}
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11
|
#if ( ! $project.hasVar("PREFIX") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12
|
PREFIX=/usr
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14
|
#if ( ! $project.hasVar("EPREFIX") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15
|
EPREFIX=$PREFIX
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18
|
#if ( ! $project.hasVar("BINDIR") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19
|
BINDIR=
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21
|
#if ( ! $project.hasVar("SBINDIR") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22
|
SBINDIR=
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24
|
#if ( ! $project.hasVar("LIBDIR") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
25
|
LIBDIR=
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27
|
#if ( ! $project.hasVar("LIBEXECDIR") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28
|
LIBEXECDIR=
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30
|
#if ( ! $project.hasVar("DATADIR") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31
|
DATADIR=
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33
|
#if ( ! $project.hasVar("SYSCONFDIR") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34
|
SYSCONFDIR=
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36
|
#if ( ! $project.hasVar("SHAREDSTATEDIR") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37
|
SHAREDSTATEDIR=
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39
|
#if ( ! $project.hasVar("LOCALSTATEDIR") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40
|
LOCALSTATEDIR=
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
41
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
42
|
#if ( ! $project.hasVar("INCLUDEDIR") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
43
|
INCLUDEDIR=
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
44
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
45
|
#if ( ! $project.hasVar("INFODIR") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
46
|
INFODIR=
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
47
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
48
|
#if ( ! $project.hasVar("MANDIR") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49
|
MANDIR=
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
51
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
52
|
OS=`uname -s`
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
53
|
OS_VERSION=`uname -r`
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
54
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
55
|
TEMP_DIR=".tmp-`uname -n`"
|
787
|
56
|
mkdir -p "$TEMP_DIR"
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
57
|
if [ $? -ne 0 ]; then
|
787
|
58
|
echo "Cannot create tmp dir"
|
|
59
|
echo "Abort"
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
60
|
fi
|
787
|
61
|
touch "$TEMP_DIR/options"
|
|
62
|
touch "$TEMP_DIR/features"
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
63
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
64
|
# features
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
65
|
#foreach( $feature in $features )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66
|
#if( ${feature.isDefault()} )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67
|
${feature.getVarName()}=on
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
69
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
70
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
71
|
# help text
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
72
|
printhelp()
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
73
|
{
|
787
|
74
|
echo "Usage: $0 [OPTIONS]..."
|
|
75
|
cat << __EOF__
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
76
|
Installation directories:
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
77
|
--prefix=PREFIX path prefix for architecture-independent files
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
78
|
[/usr]
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
79
|
--exec-prefix=EPREFIX path prefix for architecture-dependent files
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
80
|
[PREFIX]
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
81
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
82
|
--bindir=DIR user executables [EPREFIX/bin]
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
83
|
--sbindir=DIR system admin executables [EPREFIX/sbin]
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
84
|
--libexecdir=DIR program executables [EPREFIX/libexec]
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
85
|
--sysconfdir=DIR system configuration files [PREFIX/etc]
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
86
|
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
87
|
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
88
|
--libdir=DIR object code libraries [EPREFIX/lib]
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
89
|
--includedir=DIR C header files [PREFIX/include]
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
90
|
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
91
|
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
92
|
--infodir=DIR info documentation [DATAROOTDIR/info]
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
93
|
--mandir=DIR man documentation [DATAROOTDIR/man]
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
94
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
95
|
#if( $options.size() > 0 )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
96
|
Options:
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
97
|
#foreach( $opt in $options )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
98
|
--${opt.getArgument()}=${opt.getValuesString()}
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
99
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
100
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
101
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
102
|
#if( $features.size() > 0 )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
103
|
Optional Features:
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
104
|
#foreach( $feature in $features )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
105
|
#if( $feature.default )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
106
|
--disable-${feature.arg}
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
107
|
#else
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
108
|
--enable-${feature.arg}
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
109
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
110
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
111
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
112
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
113
|
__EOF__
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
114
|
}
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
115
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
116
|
#
|
787
|
117
|
# parse arguments
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
118
|
#
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
119
|
#set( $D = '$' )
|
787
|
120
|
for ARG in "$@"
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
121
|
do
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
122
|
case "$ARG" in
|
787
|
123
|
"--prefix="*) PREFIX=${D}{ARG#--prefix=} ;;
|
|
124
|
"--exec-prefix="*) EPREFIX=${D}{ARG#--exec-prefix=} ;;
|
|
125
|
"--bindir="*) BINDIR=${D}{ARG#----bindir=} ;;
|
|
126
|
"--sbindir="*) SBINDIR=${D}{ARG#--sbindir=} ;;
|
|
127
|
"--libdir="*) LIBDIR=${D}{ARG#--libdir=} ;;
|
|
128
|
"--libexecdir="*) LIBEXECDIR=${D}{ARG#--libexecdir=} ;;
|
|
129
|
"--datadir="*) DATADIR=${D}{ARG#--datadir=} ;;
|
|
130
|
"--sysconfdir="*) SYSCONFDIR=${D}{ARG#--sysconfdir=} ;;
|
|
131
|
"--sharedstatedir="*) SHAREDSTATEDIR=${D}{ARG#--sharedstatedir=} ;;
|
|
132
|
"--localstatedir="*) LOCALSTATEDIR=${D}{ARG#--localstatedir=} ;;
|
|
133
|
"--includedir="*) INCLUDEDIR=${D}{ARG#--includedir=} ;;
|
|
134
|
"--infodir="*) INFODIR=${D}{ARG#--infodir=} ;;
|
|
135
|
"--mandir"*) MANDIR=${D}{ARG#--mandir} ;;
|
|
136
|
"--help"*) printhelp; rm -Rf "$TEMP_DIR"; exit 1 ;;
|
|
137
|
#foreach( $opt in $options )
|
|
138
|
"--${opt.getArgument()}="*) ${opt.getVarName()}=${D}{ARG#--${opt.getArgument()}=} ;;
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
139
|
#end
|
787
|
140
|
#foreach( $feature in $features )
|
|
141
|
"--enable-${feature.arg}") ${feature.getVarName()}=on ;;
|
|
142
|
"--disable-${feature.arg}") unset ${feature.getVarName()} ;;
|
|
143
|
#end
|
|
144
|
"-"*) echo "unknown option: $ARG"; rm -Rf "$TEMP_DIR"; exit 1 ;;
|
|
145
|
esac
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
146
|
done
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
147
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
148
|
# set dir variables
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
149
|
if [ -z "$BINDIR" ]; then
|
787
|
150
|
BINDIR=$EPREFIX/bin
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
151
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
152
|
if [ -z "$SBINDIR" ]; then
|
787
|
153
|
SBINDIR=$EPREFIX/sbin
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
154
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
155
|
if [ -z "$LIBDIR" ]; then
|
787
|
156
|
LIBDIR=$EPREFIX/lib
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
157
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
158
|
if [ -z "$LIBEXEC" ]; then
|
787
|
159
|
LIBEXECDIR=$EPREFIX/libexec
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
160
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
161
|
if [ -z "$DATADIR" ]; then
|
787
|
162
|
DATADIR=$PREFIX/share
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
163
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
164
|
if [ -z "$SYSCONFDIR" ]; then
|
787
|
165
|
SYSCONFDIR=$PREFIX/etc
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
166
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
167
|
if [ -z "$SHAREDSTATEDIR" ]; then
|
787
|
168
|
SHAREDSTATEDIR=$PREFIX/com
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
169
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
170
|
if [ -z "$LOCALSTATEDIR" ]; then
|
787
|
171
|
LOCALSTATEDIR=$PREFIX/var
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
172
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
173
|
if [ -z "$INCLUDEDIR" ]; then
|
787
|
174
|
INCLUDEDIR=$PREFIX/include
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
175
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
176
|
if [ -z "$INFODIR" ]; then
|
787
|
177
|
INFODIR=$PREFIX/info
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
178
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
179
|
if [ -z "$MANDIR" ]; then
|
787
|
180
|
MANDIR=$PREFIX/man
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
181
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
182
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
183
|
which pkg-config > /dev/null
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
184
|
if [ $? -eq 0 ]; then
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
185
|
PKG_CONFIG=pkg-config
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
186
|
else
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
187
|
PKG_CONFIG=false
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
188
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
189
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
190
|
# Simple uname based platform detection
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
191
|
# $PLATFORM is used for platform dependent dependency selection
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
192
|
printf "detect platform... "
|
787
|
193
|
if [ "$OS" = "SunOS" ]; then
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
194
|
PLATFORM="solaris sunos unix svr4"
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
195
|
fi
|
787
|
196
|
if [ "$OS" = "Linux" ]; then
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
197
|
PLATFORM="linux unix"
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
198
|
fi
|
787
|
199
|
if [ "$OS" = "FreeBSD" ]; then
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
200
|
PLATFORM="freebsd bsd unix"
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
201
|
fi
|
787
|
202
|
if [ "$OS" = "Darwin" ]; then
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
203
|
PLATFORM="macos osx bsd unix"
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
204
|
fi
|
787
|
205
|
echo "$OS" | grep -i "MINGW" > /dev/null
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
206
|
if [ $? -eq 0 ]; then
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
207
|
PLATFORM="windows mingw"
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
208
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
209
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
210
|
if [ -z "$PLATFORM" ]; then
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
211
|
PLATFORM="unix"
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
212
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
213
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
214
|
for p in $PLATFORM
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
215
|
do
|
787
|
216
|
PLATFORM_NAME=$p
|
|
217
|
break
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
218
|
done
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
219
|
echo $PLATFORM_NAME
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
220
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
221
|
isplatform()
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
222
|
{
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
223
|
for p in $PLATFORM
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
224
|
do
|
787
|
225
|
if [ "$p" = "$1" ]; then
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
226
|
return 0
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
227
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
228
|
done
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
229
|
return 1
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
230
|
}
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
231
|
isnotplatform()
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
232
|
{
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
233
|
for p in $PLATFORM
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
234
|
do
|
787
|
235
|
if [ "$p" = "$1" ]; then
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
236
|
return 1
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
237
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
238
|
done
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
239
|
return 0
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
240
|
}
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
241
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
242
|
# generate config.mk and config.h
|
787
|
243
|
cat > "$TEMP_DIR/config.mk" << __EOF__
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
244
|
#
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
245
|
# config.mk generated by configure
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
246
|
#
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
247
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
248
|
# general vars
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
249
|
#foreach( $var in $vars )
|
787
|
250
|
${var.varName}=$${var.varName}
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
251
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
252
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
253
|
#if ( ! $project.hasVar("PREFIX") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
254
|
PREFIX=$PREFIX
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
255
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
256
|
#if ( ! $project.hasVar("EPREFIX") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
257
|
EPREFIX=$EPREFIX
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
258
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
259
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
260
|
#if ( ! $project.hasVar("BINDIR") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
261
|
BINDIR=$BINDIR
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
262
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
263
|
#if ( ! $project.hasVar("SBINDIR") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
264
|
SBINDIR=$SBINDIR
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
265
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
266
|
#if ( ! $project.hasVar("LIBDIR") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
267
|
LIBDIR=$LIBDIR
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
268
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
269
|
#if ( ! $project.hasVar("LIBEXECDIR") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
270
|
LIBEXECDIR=$LIBEXECDIR
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
271
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
272
|
#if ( ! $project.hasVar("DATADIR") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
273
|
DATADIR=$DATADIR
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
274
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
275
|
#if ( ! $project.hasVar("SYSCONFDIR") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
276
|
SYSCONFDIR=$SYSCONFDIR
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
277
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
278
|
#if ( ! $project.hasVar("SHAREDSTATEDIR") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
279
|
SHAREDSTATEDIR=$SHAREDSTATEDIR
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
280
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
281
|
#if ( ! $project.hasVar("LOCALSTATEDIR") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
282
|
LOCALSTATEDIR=$LOCALSTATEDIR
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
283
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
284
|
#if ( ! $project.hasVar("INCLUDEDIR") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
285
|
INCLUDEDIR=$INCLUDEDIR
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
286
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
287
|
#if ( ! $project.hasVar("INFODIR") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
288
|
INFODIR=$INFODIR
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
289
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
290
|
#if ( ! $project.hasVar("MANDIR") )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
291
|
MANDIR=$MANDIR
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
292
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
293
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
294
|
__EOF__
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
295
|
|
787
|
296
|
echo > "$TEMP_DIR/make.mk"
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
297
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
298
|
ENV_CFLAGS=$CFLAGS
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
299
|
ENV_LDFLAGS=$LDFLAGS
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
300
|
ENV_CXXFLAGS=$CXXFLAGS
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
301
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
302
|
# Toolchain detection
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
303
|
# this will insert make vars to config.mk
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
304
|
. make/toolchain.sh
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
305
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
306
|
# add user specified flags to config.mk
|
787
|
307
|
echo "# project specific flags" >> "$TEMP_DIR/config.mk"
|
|
308
|
if [ -n "${ENV_CFLAGS}" ]; then
|
|
309
|
echo "CFLAGS += $ENV_CFLAGS" >> "$TEMP_DIR/config.mk"
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
310
|
fi
|
787
|
311
|
if [ -n "${ENV_CXXFLAGS}" ]; then
|
|
312
|
echo "CXXFLAGS += $ENV_CXXFLAGS" >> "$TEMP_DIR/config.mk"
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
313
|
fi
|
787
|
314
|
if [ -n "${ENV_LDFLAGS}" ]; then
|
|
315
|
echo "LDFLAGS += $ENV_LDFLAGS" >> "$TEMP_DIR/config.mk"
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
316
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
317
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
318
|
#
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
319
|
# DEPENDENCIES
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
320
|
#
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
321
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
322
|
#foreach( $dependency in $namedDependencies )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
323
|
dependency_${dependency.name}()
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
324
|
{
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
325
|
printf "checking for ${dependency.name}... "
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
326
|
#foreach( $sub in $dependency.getSubdependencies() )
|
787
|
327
|
# dependency $sub.getFullName()
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
328
|
while true
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
329
|
do
|
787
|
330
|
#if( $sub.platform )
|
|
331
|
if isnotplatform "${sub.platform}"; then
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
332
|
break
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
333
|
fi
|
787
|
334
|
#end
|
|
335
|
#foreach( $not in $sub.getNotList() )
|
|
336
|
if isplatform "${not}"; then
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
337
|
break
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
338
|
fi
|
787
|
339
|
#end
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
340
|
#if( $sub.pkgconfig.size() > 0 )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
341
|
if [ -z "$PKG_CONFIG" ]; then
|
787
|
342
|
break
|
|
343
|
fi
|
|
344
|
#end
|
|
345
|
#foreach( $test in $sub.tests )
|
|
346
|
$test > /dev/null
|
|
347
|
if [ $? -ne 0 ]; then
|
|
348
|
break
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
349
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
350
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
351
|
#foreach( $pkg in $sub.pkgconfig )
|
787
|
352
|
$pkg.getPkgConfigTestQuery()
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
353
|
if [ $? -ne 0 ] ; then
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
354
|
break
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
355
|
fi
|
787
|
356
|
TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags $pkg.name`"
|
|
357
|
TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs $pkg.name`"
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
358
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
359
|
#foreach( $flags in $sub.flags )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
360
|
#if( $flags.exec )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
361
|
$flags.value > /dev/null
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
362
|
if [ $? -eq 0 ]; then
|
787
|
363
|
TEMP_$flags.varName="$TEMP_$flags.varName `$flags.value`"
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
364
|
else
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
365
|
break
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
366
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
367
|
#else
|
787
|
368
|
TEMP_$flags.varName="$TEMP_$flags.varName $flags.value"
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
369
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
370
|
#end
|
787
|
371
|
#if ( $sub.make.length() > 0 )
|
|
372
|
cat >> $TEMP_DIR/make.mk << __EOF__
|
|
373
|
# Dependency: $dependency.name
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
374
|
$sub.make
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
375
|
__EOF__
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
376
|
#end
|
787
|
377
|
echo yes
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
378
|
return 0
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
379
|
done
|
787
|
380
|
|
|
381
|
#end
|
|
382
|
echo no
|
|
383
|
return 1
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
384
|
}
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
385
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
386
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
387
|
DEPENDENCIES_FAILED=
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
388
|
ERROR=0
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
389
|
#if( $dependencies.size() > 0 )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
390
|
# general dependencies
|
787
|
391
|
TEMP_CFLAGS=
|
|
392
|
TEMP_LDFLAGS=
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
393
|
#foreach( $dependency in $dependencies )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
394
|
while true
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
395
|
do
|
787
|
396
|
#if( $dependency.platform )
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
397
|
if isnotplatform "${dependency.platform}"; then
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
398
|
break
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
399
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
400
|
#end
|
787
|
401
|
#foreach( $not in $dependency.getNotList() )
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
402
|
if isplatform "${not}"; then
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
403
|
break
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
404
|
fi
|
787
|
405
|
#end
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
406
|
while true
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
407
|
do
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
408
|
#if( $dependency.pkgconfig.size() > 0 )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
409
|
if [ -z "$PKG_CONFIG" ]; then
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
410
|
ERROR=1
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
411
|
break
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
412
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
413
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
414
|
#foreach( $pkg in $dependency.pkgconfig )
|
787
|
415
|
printf "checking for pkg-config package $pkg.name... "
|
|
416
|
$pkg.getPkgConfigTestQuery()
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
417
|
if [ $? -ne 0 ]; then
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
418
|
echo no
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
419
|
ERROR=1
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
420
|
break
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
421
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
422
|
echo yes
|
787
|
423
|
TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags $pkg.name`"
|
|
424
|
TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs $pkg.name`"
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
425
|
#end
|
787
|
426
|
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
427
|
#foreach( $flags in $dependency.flags )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
428
|
#if( $flags.exec )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
429
|
$flags.value > /dev/null
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
430
|
if [ $? -ne 0 ]; then
|
787
|
431
|
TEMP_$flags.varName="$TEMP_$flags.varName `$flags.value`"
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
432
|
else
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
433
|
ERROR=1
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
434
|
break
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
435
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
436
|
#else
|
787
|
437
|
TEMP_$flags.varName="$TEMP_$flags.varName $flags.value"
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
438
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
439
|
#end
|
787
|
440
|
#if ( $dependency.make.length() > 0 )
|
|
441
|
cat >> "$TEMP_DIR/make.mk" << __EOF__
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
442
|
$dependency.make
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
443
|
__EOF__
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
444
|
#end
|
787
|
445
|
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
446
|
break
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
447
|
done
|
787
|
448
|
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
449
|
break
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
450
|
done
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
451
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
452
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
453
|
# add general dependency flags to config.mk
|
787
|
454
|
echo >> "$TEMP_DIR/config.mk"
|
|
455
|
if [ -n "${TEMP_CFLAGS}" ]; then
|
|
456
|
echo "CFLAGS += $TEMP_CFLAGS" >> $TEMP_DIR/config.mk
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
457
|
fi
|
787
|
458
|
if [ -n "${TEMP_CXXFLAGS}" ]; then
|
|
459
|
echo "CXXFLAGS += $TEMP_CXXFLAGS" >> $TEMP_DIR/config.mk
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
460
|
fi
|
787
|
461
|
if [ -n "${TEMP_LDFLAGS}" ]; then
|
|
462
|
echo "LDFLAGS += $TEMP_LDFLAGS" >> $TEMP_DIR/config.mk
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
463
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
464
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
465
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
466
|
#
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
467
|
# OPTION VALUES
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
468
|
#
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
469
|
#foreach( $opt in $options )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
470
|
#foreach( $val in $opt.values )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
471
|
${val.func}()
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
472
|
{
|
787
|
473
|
VERR=0
|
|
474
|
#foreach( $dep in $val.dependencies )
|
|
475
|
dependency_$dep
|
|
476
|
if [ $? -ne 0 ]; then
|
|
477
|
VERR=1
|
|
478
|
fi
|
|
479
|
#end
|
|
480
|
if [ $VERR -ne 0 ]; then
|
|
481
|
return 1
|
|
482
|
fi
|
|
483
|
#foreach( $def in $val.defines )
|
|
484
|
TEMP_CFLAGS="$TEMP_CFLAGS ${def.toFlags()}"
|
|
485
|
#end
|
|
486
|
#if( $val.hasMake() )
|
|
487
|
cat >> "$TEMP_DIR/make.mk" << __EOF__
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
488
|
$val.make
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
489
|
__EOF__
|
787
|
490
|
#end
|
|
491
|
return 0
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
492
|
}
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
493
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
494
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
495
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
496
|
#
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
497
|
# TARGETS
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
498
|
#
|
787
|
499
|
TEMP_CFLAGS=
|
|
500
|
TEMP_CXXFLAGS=
|
|
501
|
TEMP_LDFLAGS=
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
502
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
503
|
#foreach( $target in $targets )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
504
|
#if ( $target.name )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
505
|
# Target: $target.name
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
506
|
#else
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
507
|
# Target
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
508
|
#end
|
787
|
509
|
TEMP_CFLAGS=
|
|
510
|
TEMP_LDFLAGS=
|
|
511
|
TEMP_CXXFLAGS=
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
512
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
513
|
#foreach( $dependency in $target.dependencies )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
514
|
dependency_$dependency
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
515
|
if [ $? -ne 0 ]; then
|
787
|
516
|
DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} "
|
|
517
|
ERROR=1
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
518
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
519
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
520
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
521
|
# Features
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
522
|
#foreach( $feature in $target.features )
|
787
|
523
|
if [ -n "$${feature.getVarName()}" ]; then
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
524
|
#foreach( $dependency in $feature.dependencies )
|
787
|
525
|
# check dependency
|
|
526
|
dependency_$dependency
|
|
527
|
if [ $? -ne 0 ]; then
|
|
528
|
# "auto" features can fail and are just disabled in this case
|
|
529
|
if [ "$${feature.getVarName()}" != "auto" ]; then
|
|
530
|
DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} "
|
|
531
|
ERROR=1
|
|
532
|
fi
|
|
533
|
fi
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
534
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
535
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
536
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
537
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
538
|
#foreach( $opt in $target.options )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
539
|
# Option: --${opt.argument}
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
540
|
if [ -z ${D}${opt.getVarName()} ]; then
|
787
|
541
|
SAVED_ERROR="$ERROR"
|
|
542
|
SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED"
|
|
543
|
ERROR=0
|
|
544
|
while true
|
|
545
|
do
|
|
546
|
#foreach( $optdef in $opt.defaults )
|
|
547
|
#if( $optdef.platform )
|
|
548
|
if isplatform "$optdef.platform"; then
|
|
549
|
#end
|
|
550
|
$optdef.func
|
|
551
|
if [ $? -eq 0 ]; then
|
|
552
|
echo " ${opt.argument}: ${optdef.valueName}" >> "$TEMP_DIR/options"
|
|
553
|
ERROR=0
|
|
554
|
break
|
|
555
|
fi
|
|
556
|
#if( $optdef.platform )
|
|
557
|
fi
|
|
558
|
#end
|
|
559
|
#end
|
|
560
|
break
|
|
561
|
done
|
|
562
|
if [ $ERROR -ne 0 ]; then
|
|
563
|
SAVED_ERROR=1
|
|
564
|
fi
|
|
565
|
ERROR="$SAVED_ERROR"
|
|
566
|
DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED"
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
567
|
else
|
787
|
568
|
if false; then
|
|
569
|
false
|
|
570
|
#foreach( $optval in $opt.values )
|
|
571
|
elif [ "${D}${opt.getVarName()}" = "${optval.value}" ]; then
|
|
572
|
echo " ${opt.argument}: ${D}${opt.getVarName()}" >> $TEMP_DIR/options
|
|
573
|
$optval.func
|
|
574
|
if [ $? -ne 0 ]; then
|
|
575
|
ERROR=1
|
|
576
|
fi
|
|
577
|
#end
|
|
578
|
fi
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
579
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
580
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
581
|
|
787
|
582
|
echo >> "$TEMP_DIR/config.mk"
|
|
583
|
if [ -n "${TEMP_CFLAGS}" ]; then
|
|
584
|
echo "${target.getCFlags()} += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk"
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
585
|
fi
|
787
|
586
|
if [ -n "${TEMP_CXXFLAGS}" ]; then
|
|
587
|
echo "${target.getCXXFlags()} += $TEMP_CXXFLAGS" >> "$TEMP_DIR/config.mk"
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
588
|
fi
|
787
|
589
|
if [ -n "${TEMP_LDFLAGS}" ]; then
|
|
590
|
echo "${target.getLDFlags()} += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk"
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
591
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
592
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
593
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
594
|
if [ $ERROR -ne 0 ]; then
|
787
|
595
|
echo
|
|
596
|
echo "Error: Unresolved dependencies"
|
|
597
|
echo "$DEPENDENCIES_FAILED"
|
|
598
|
rm -Rf "$TEMP_DIR"
|
|
599
|
exit 1
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
600
|
fi
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
601
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
602
|
echo "configure finished"
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
603
|
echo
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
604
|
echo "Build Config:"
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
605
|
echo " PREFIX: $PREFIX"
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
606
|
echo " TOOLCHAIN: $TOOLCHAIN_NAME"
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
607
|
#if ( $options.size() > 0 )
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
608
|
echo "Options:"
|
787
|
609
|
cat "$TEMP_DIR/options"
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
610
|
#end
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
611
|
echo
|
787
|
612
|
cat "$TEMP_DIR/config.mk" "$TEMP_DIR/make.mk" > config.mk
|
|
613
|
rm -Rf "$TEMP_DIR"
|
742
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
614
|
|
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
615
|
|