test/make/configure.vm

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

mercurial