118 # |
118 # |
119 #set( $D = '$' ) |
119 #set( $D = '$' ) |
120 for ARG in $@ |
120 for ARG in $@ |
121 do |
121 do |
122 case "$ARG" in |
122 case "$ARG" in |
123 "--prefix="*) PREFIX=${D}{ARG#--prefix=} ;; |
123 "--prefix="*) PREFIX=${D}{ARG#--prefix=} ;; |
124 "--exec-prefix="*) EPREFIX=${D}{ARG#--exec-prefix=} ;; |
124 "--exec-prefix="*) EPREFIX=${D}{ARG#--exec-prefix=} ;; |
125 "--bindir="*) BINDIR=${D}{ARG#----bindir=} ;; |
125 "--bindir="*) BINDIR=${D}{ARG#----bindir=} ;; |
126 "--sbindir="*) SBINDIR=${D}{ARG#--sbindir=} ;; |
126 "--sbindir="*) SBINDIR=${D}{ARG#--sbindir=} ;; |
127 "--libdir="*) LIBDIR=${D}{ARG#--libdir=} ;; |
127 "--libdir="*) LIBDIR=${D}{ARG#--libdir=} ;; |
128 "--libexecdir="*) LIBEXECDIR=${D}{ARG#--libexecdir=} ;; |
128 "--libexecdir="*) LIBEXECDIR=${D}{ARG#--libexecdir=} ;; |
129 "--datadir="*) DATADIR=${D}{ARG#--datadir=} ;; |
129 "--datadir="*) DATADIR=${D}{ARG#--datadir=} ;; |
130 "--sysconfdir="*) SYSCONFDIR=${D}{ARG#--sysconfdir=} ;; |
130 "--sysconfdir="*) SYSCONFDIR=${D}{ARG#--sysconfdir=} ;; |
131 "--sharedstatedir="*) SHAREDSTATEDIR=${D}{ARG#--sharedstatedir=} ;; |
131 "--sharedstatedir="*) SHAREDSTATEDIR=${D}{ARG#--sharedstatedir=} ;; |
132 "--localstatedir="*) LOCALSTATEDIR=${D}{ARG#--localstatedir=} ;; |
132 "--localstatedir="*) LOCALSTATEDIR=${D}{ARG#--localstatedir=} ;; |
133 "--includedir="*) INCLUDEDIR=${D}{ARG#--includedir=} ;; |
133 "--includedir="*) INCLUDEDIR=${D}{ARG#--includedir=} ;; |
134 "--infodir="*) INFODIR=${D}{ARG#--infodir=} ;; |
134 "--infodir="*) INFODIR=${D}{ARG#--infodir=} ;; |
135 "--mandir"*) MANDIR=${D}{ARG#--mandir} ;; |
135 "--mandir"*) MANDIR=${D}{ARG#--mandir} ;; |
136 "--help"*) printhelp; rm -Rf $TEMP_DIR; exit 1 ;; |
136 "--help"*) printhelp; rm -Rf $TEMP_DIR; exit 1 ;; |
137 #foreach( $opt in $options ) |
137 #foreach( $opt in $options ) |
138 "--${opt.getArgument()}="*) ${opt.getVarName()}=${D}{ARG#--${opt.getArgument()}=} ;; |
138 "--${opt.getArgument()}="*) ${opt.getVarName()}=${D}{ARG#--${opt.getArgument()}=} ;; |
139 #end |
139 #end |
140 #foreach( $feature in $features ) |
140 #foreach( $feature in $features ) |
141 "--enable-${feature.arg}") ${feature.getVarName()}=on ;; |
141 "--enable-${feature.arg}") ${feature.getVarName()}=on ;; |
142 "--disable-${feature.arg}") unset ${feature.getVarName()} ;; |
142 "--disable-${feature.arg}") unset ${feature.getVarName()} ;; |
143 #end |
143 #end |
144 "-"*) echo "unknown option: $ARG"; rm -Rf $TEMP_DIR; exit 1 ;; |
144 "-"*) echo "unknown option: $ARG"; rm -Rf $TEMP_DIR; exit 1 ;; |
145 esac |
145 esac |
146 done |
146 done |
147 |
147 |
148 # set dir variables |
148 # set dir variables |
149 if [ -z "$BINDIR" ]; then |
149 if [ -z "$BINDIR" ]; then |
150 BINDIR=$EPREFIX/bin |
150 BINDIR=$EPREFIX/bin |
151 fi |
151 fi |
152 if [ -z "$SBINDIR" ]; then |
152 if [ -z "$SBINDIR" ]; then |
153 SBINDIR=$EPREFIX/sbin |
153 SBINDIR=$EPREFIX/sbin |
154 fi |
154 fi |
155 if [ -z "$LIBDIR" ]; then |
155 if [ -z "$LIBDIR" ]; then |
156 LIBDIR=$EPREFIX/lib |
156 LIBDIR=$EPREFIX/lib |
157 fi |
157 fi |
158 if [ -z "$LIBEXEC" ]; then |
158 if [ -z "$LIBEXEC" ]; then |
159 LIBEXECDIR=$EPREFIX/libexec |
159 LIBEXECDIR=$EPREFIX/libexec |
160 fi |
160 fi |
161 if [ -z "$DATADIR" ]; then |
161 if [ -z "$DATADIR" ]; then |
162 DATADIR=$PREFIX/share |
162 DATADIR=$PREFIX/share |
163 fi |
163 fi |
164 if [ -z "$SYSCONFDIR" ]; then |
164 if [ -z "$SYSCONFDIR" ]; then |
165 SYSCONFDIR=$PREFIX/etc |
165 SYSCONFDIR=$PREFIX/etc |
166 fi |
166 fi |
167 if [ -z "$SHAREDSTATEDIR" ]; then |
167 if [ -z "$SHAREDSTATEDIR" ]; then |
168 SHAREDSTATEDIR=$PREFIX/com |
168 SHAREDSTATEDIR=$PREFIX/com |
169 fi |
169 fi |
170 if [ -z "$LOCALSTATEDIR" ]; then |
170 if [ -z "$LOCALSTATEDIR" ]; then |
171 LOCALSTATEDIR=$PREFIX/var |
171 LOCALSTATEDIR=$PREFIX/var |
172 fi |
172 fi |
173 if [ -z "$INCLUDEDIR" ]; then |
173 if [ -z "$INCLUDEDIR" ]; then |
174 INCLUDEDIR=$PREFIX/include |
174 INCLUDEDIR=$PREFIX/include |
175 fi |
175 fi |
176 if [ -z "$INFODIR" ]; then |
176 if [ -z "$INFODIR" ]; then |
177 INFODIR=$PREFIX/info |
177 INFODIR=$PREFIX/info |
178 fi |
178 fi |
179 if [ -z "$MANDIR" ]; then |
179 if [ -z "$MANDIR" ]; then |
180 MANDIR=$PREFIX/man |
180 MANDIR=$PREFIX/man |
181 fi |
181 fi |
182 |
182 |
183 which pkg-config > /dev/null |
183 which pkg-config > /dev/null |
184 if [ $? -eq 0 ]; then |
184 if [ $? -eq 0 ]; then |
185 PKG_CONFIG=pkg-config |
185 PKG_CONFIG=pkg-config |
325 printf "checking for ${dependency.name}... " |
325 printf "checking for ${dependency.name}... " |
326 #foreach( $sub in $dependency.getSubdependencies() ) |
326 #foreach( $sub in $dependency.getSubdependencies() ) |
327 # dependency $sub.name $sub.getPlatformString() |
327 # dependency $sub.name $sub.getPlatformString() |
328 while true |
328 while true |
329 do |
329 do |
330 #if( $sub.platform ) |
330 #if( $sub.platform ) |
331 if isnotplatform "${sub.platform}"; then |
331 if isnotplatform "${sub.platform}"; then |
332 break |
332 break |
333 fi |
333 fi |
334 #end |
334 #end |
335 #foreach( $not in $sub.getNotList() ) |
335 #foreach( $not in $sub.getNotList() ) |
336 if isplatform "${not}"; then |
336 if isplatform "${not}"; then |
337 break |
337 break |
338 fi |
338 fi |
339 #end |
339 #end |
340 #if( $sub.pkgconfig.size() > 0 ) |
340 #if( $sub.pkgconfig.size() > 0 ) |
341 if [ -z "$PKG_CONFIG" ]; then |
341 if [ -z "$PKG_CONFIG" ]; then |
342 break |
342 break |
343 fi |
343 fi |
344 #end |
344 #end |
345 #foreach( $pkg in $sub.pkgconfig ) |
345 #foreach( $pkg in $sub.pkgconfig ) |
346 $PKG_CONFIG $pkg.getPkgConfigParam() |
346 $PKG_CONFIG $pkg.getPkgConfigParam() |
347 if [ $? -ne 0 ] ; then |
347 if [ $? -ne 0 ] ; then |
348 break |
348 break |
349 fi |
349 fi |
350 TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags $pkg.getPkgConfigParam()`" |
350 TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags $pkg.getPkgConfigParam()`" |
351 TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs $pkg.getPkgConfigParam()`" |
351 TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs $pkg.getPkgConfigParam()`" |
391 TEMP_CFLAGS= |
391 TEMP_CFLAGS= |
392 TEMP_LDFLAGS= |
392 TEMP_LDFLAGS= |
393 #foreach( $dependency in $dependencies ) |
393 #foreach( $dependency in $dependencies ) |
394 while true |
394 while true |
395 do |
395 do |
396 #if( $dependency.platform ) |
396 #if( $dependency.platform ) |
397 if isnotplatform "${dependency.platform}"; then |
397 if isnotplatform "${dependency.platform}"; then |
398 break |
398 break |
399 fi |
399 fi |
400 #end |
400 #end |
401 #foreach( $not in $dependency.getNotList() ) |
401 #foreach( $not in $dependency.getNotList() ) |
402 if isplatform "${not}"; then |
402 if isplatform "${not}"; then |
403 break |
403 break |
404 fi |
404 fi |
405 #end |
405 #end |
406 while true |
406 while true |
407 do |
407 do |
408 #if( $dependency.pkgconfig.size() > 0 ) |
408 #if( $dependency.pkgconfig.size() > 0 ) |
409 if [ -z "$PKG_CONFIG" ]; then |
409 if [ -z "$PKG_CONFIG" ]; then |
410 ERROR=1 |
410 ERROR=1 |
411 break |
411 break |
412 fi |
412 fi |
413 #end |
413 #end |
414 #foreach( $pkg in $dependency.pkgconfig ) |
414 #foreach( $pkg in $dependency.pkgconfig ) |
415 printf "checking for pkg-config package $pkg.getPkgConfigParam()... " |
415 printf "checking for pkg-config package $pkg.getPkgConfigParam()... " |
416 $PKG_CONFIG $pkg.getPkgConfigParam() |
416 $PKG_CONFIG $pkg.getPkgConfigParam() |
417 if [ $? -ne 0 ]; then |
417 if [ $? -ne 0 ]; then |
418 echo no |
418 echo no |
419 ERROR=1 |
419 ERROR=1 |
420 break |
420 break |
421 fi |
421 fi |
511 TEMP_CXXFLAGS= |
511 TEMP_CXXFLAGS= |
512 |
512 |
513 #foreach( $dependency in $target.dependencies ) |
513 #foreach( $dependency in $target.dependencies ) |
514 dependency_$dependency |
514 dependency_$dependency |
515 if [ $? -ne 0 ]; then |
515 if [ $? -ne 0 ]; then |
516 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " |
516 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " |
517 ERROR=1 |
517 ERROR=1 |
518 fi |
518 fi |
519 #end |
519 #end |
520 |
520 |
521 # Features |
521 # Features |
522 #foreach( $feature in $target.features ) |
522 #foreach( $feature in $target.features ) |
523 if [ ! -z "$${feature.getVarName()}" ]; then |
523 if [ ! -z "$${feature.getVarName()}" ]; then |
524 #foreach( $dependency in $feature.dependencies ) |
524 #foreach( $dependency in $feature.dependencies ) |
525 # check dependency |
525 # check dependency |
526 dependency_$dependency |
526 dependency_$dependency |
527 if [ $? -ne 0 ]; then |
527 if [ $? -ne 0 ]; then |
528 # "auto" features can fail and are just disabled in this case |
528 # "auto" features can fail and are just disabled in this case |
529 if [ $${feature.getVarName()} != "auto" ]; then |
529 if [ $${feature.getVarName()} != "auto" ]; then |
530 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " |
530 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " |
531 ERROR=1 |
531 ERROR=1 |
532 fi |
532 fi |
533 fi |
533 fi |
534 #end |
534 #end |
535 fi |
535 fi |
536 #end |
536 #end |
537 |
537 |
538 #foreach( $opt in $target.options ) |
538 #foreach( $opt in $target.options ) |
539 # Option: --${opt.argument} |
539 # Option: --${opt.argument} |
540 if [ -z ${D}${opt.getVarName()} ]; then |
540 if [ -z ${D}${opt.getVarName()} ]; then |
541 SAVED_ERROR=$ERROR |
541 SAVED_ERROR=$ERROR |
542 SAVED_DEPENDENCIES_FAILED=$DEPENDENCIES_FAILED |
542 SAVED_DEPENDENCIES_FAILED=$DEPENDENCIES_FAILED |
543 ERROR=0 |
543 ERROR=0 |
544 while true |
544 while true |
545 do |
545 do |
546 #foreach( $optdef in $opt.defaults ) |
546 #foreach( $optdef in $opt.defaults ) |
547 #if( $optdef.platform ) |
547 #if( $optdef.platform ) |
548 if isplatform "$optdef.platform"; then |
548 if isplatform "$optdef.platform"; then |
549 #end |
549 #end |
550 $optdef.func |
550 $optdef.func |
551 if [ $? -eq 0 ]; then |
551 if [ $? -eq 0 ]; then |
552 echo " ${opt.argument}: ${optdef.valueName}" >> $TEMP_DIR/options |
552 echo " ${opt.argument}: ${optdef.valueName}" >> $TEMP_DIR/options |
553 ERROR=0 |
553 ERROR=0 |
554 break |
554 break |
555 fi |
555 fi |
556 #if( $optdef.platform ) |
556 #if( $optdef.platform ) |
557 fi |
557 fi |
558 #end |
558 #end |
559 #end |
559 #end |
560 break |
560 break |
561 done |
561 done |
562 if [ $ERROR -ne 0 ]; then |
562 if [ $ERROR -ne 0 ]; then |
563 SAVED_ERROR=1 |
563 SAVED_ERROR=1 |
564 fi |
564 fi |
565 ERROR=$SAVED_ERROR |
565 ERROR=$SAVED_ERROR |
566 DEPENDENCIES_FAILED=$SAVED_DEPENDENCIES_FAILED= |
566 DEPENDENCIES_FAILED=$SAVED_DEPENDENCIES_FAILED= |
567 else |
567 else |
568 if false; then |
568 if false; then |
569 false |
569 false |
570 #foreach( $optval in $opt.values ) |
570 #foreach( $optval in $opt.values ) |
571 elif [ ${D}${opt.getVarName()} = "${optval.value}" ]; then |
571 elif [ ${D}${opt.getVarName()} = "${optval.value}" ]; then |
572 echo " ${opt.argument}: ${D}${opt.getVarName()}" >> $TEMP_DIR/options |
572 echo " ${opt.argument}: ${D}${opt.getVarName()}" >> $TEMP_DIR/options |
573 $optval.func |
573 $optval.func |
574 if [ $? -ne 0 ]; then |
574 if [ $? -ne 0 ]; then |
575 ERROR=1 |
575 ERROR=1 |
576 fi |
576 fi |
577 #end |
577 #end |
578 fi |
578 fi |
579 fi |
579 fi |
580 #end |
580 #end |
581 |
581 |
582 echo >> $TEMP_DIR/config.mk |
582 echo >> $TEMP_DIR/config.mk |
583 if [ ! -z "${TEMP_CFLAGS}" ]; then |
583 if [ ! -z "${TEMP_CFLAGS}" ]; then |