1 #!/bin/sh |
1 #!/bin/sh |
|
2 |
|
3 # runs a command and returns 0 if the command failed |
|
4 # same as ! cmd but compatible with svr4 sh |
|
5 failed() |
|
6 { |
|
7 $@ |
|
8 if [ $? -ne 0 ]; then |
|
9 return 0 |
|
10 else |
|
11 return 1 |
|
12 fi |
|
13 } |
2 |
14 |
3 # create temporary directory |
15 # create temporary directory |
4 TEMP_DIR=".tmp-`uname -n`" |
16 TEMP_DIR=".tmp-`uname -n`" |
5 rm -Rf "$TEMP_DIR" |
17 rm -Rf "$TEMP_DIR" |
6 if ! mkdir -p "$TEMP_DIR"; then |
18 if failed mkdir -p "$TEMP_DIR"; then |
7 echo "Cannot create tmp dir $TEMP_DIR" |
19 echo "Cannot create tmp dir $TEMP_DIR" |
8 echo "Abort" |
20 echo "Abort" |
9 exit 1 |
21 exit 1 |
10 fi |
22 fi |
11 touch "$TEMP_DIR/options" |
23 touch "$TEMP_DIR/options" |
238 #foreach( $sub in $dependency.getSubdependencies() ) |
250 #foreach( $sub in $dependency.getSubdependencies() ) |
239 # dependency $sub.getFullName() |
251 # dependency $sub.getFullName() |
240 while true |
252 while true |
241 do |
253 do |
242 #if( $sub.platform ) |
254 #if( $sub.platform ) |
243 if ! isplatform "${sub.platform}"; then |
255 if failed isplatform "${sub.platform}"; then |
244 break |
256 break |
245 fi |
257 fi |
246 #end |
258 #end |
247 #foreach( $np in $sub.getNotList() ) |
259 #foreach( $np in $sub.getNotList() ) |
248 if isplatform "${np}"; then |
260 if isplatform "${np}"; then |
253 if [ -z "$PKG_CONFIG" ]; then |
265 if [ -z "$PKG_CONFIG" ]; then |
254 break |
266 break |
255 fi |
267 fi |
256 #end |
268 #end |
257 #foreach( $test in $sub.tests ) |
269 #foreach( $test in $sub.tests ) |
258 if ! $test > /dev/null ; then |
270 if failed $test > /dev/null ; then |
259 break |
271 break |
260 fi |
272 fi |
261 #end |
273 #end |
262 #foreach( $pkg in $sub.pkgconfig ) |
274 #foreach( $pkg in $sub.pkgconfig ) |
263 if ! $pkg.getPkgConfigTestQuery() ; then |
275 if failed $pkg.getPkgConfigTestQuery() ; then |
264 break |
276 break |
265 fi |
277 fi |
266 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`" |
278 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`" |
267 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs $pkg.name`" |
279 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs $pkg.name`" |
268 #end |
280 #end |
301 TEMP_LDFLAGS= |
313 TEMP_LDFLAGS= |
302 #foreach( $dependency in $dependencies ) |
314 #foreach( $dependency in $dependencies ) |
303 while true |
315 while true |
304 do |
316 do |
305 #if( $dependency.platform ) |
317 #if( $dependency.platform ) |
306 if ! isplatform "${dependency.platform}"; then |
318 if failed isplatform "${dependency.platform}"; then |
307 break |
319 break |
308 fi |
320 fi |
309 #end |
321 #end |
310 #foreach( $np in $dependency.getNotList() ) |
322 #foreach( $np in $dependency.getNotList() ) |
311 if isplatform "${np}"; then |
323 if isplatform "${np}"; then |
407 #end |
419 #end |
408 TEMP_CFLAGS= |
420 TEMP_CFLAGS= |
409 TEMP_LDFLAGS= |
421 TEMP_LDFLAGS= |
410 |
422 |
411 #foreach( $dependency in $target.dependencies ) |
423 #foreach( $dependency in $target.dependencies ) |
412 if ! dependency_$dependency; then |
424 if failed dependency_$dependency; then |
413 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " |
425 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " |
414 ERROR=1 |
426 ERROR=1 |
415 fi |
427 fi |
416 #end |
428 #end |
417 |
429 |
418 # Features |
430 # Features |
419 #foreach( $feature in $target.features ) |
431 #foreach( $feature in $target.features ) |
420 if [ -n "$${feature.getVarName()}" ]; then |
432 if [ -n "$${feature.getVarName()}" ]; then |
421 #foreach( $dependency in $feature.dependencies ) |
433 #foreach( $dependency in $feature.dependencies ) |
422 # check dependency |
434 # check dependency |
423 if ! dependency_$dependency ; then |
435 if failed dependency_$dependency ; then |
424 # "auto" features can fail and are just disabled in this case |
436 # "auto" features can fail and are just disabled in this case |
425 if [ "$${feature.getVarName()}" = "auto" ]; then |
437 if [ "$${feature.getVarName()}" = "auto" ]; then |
426 unset ${feature.getVarName()} |
438 unset ${feature.getVarName()} |
427 else |
439 else |
428 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " |
440 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " |