Tue, 12 Sep 2023 18:08:11 +0200
update uwproj
configure | file | annotate | diff | comparison | revisions | |
make/configure.vm | file | annotate | diff | comparison | revisions | |
make/project.xml | file | annotate | diff | comparison | revisions |
--- a/configure Thu Sep 07 10:51:13 2023 +0200 +++ b/configure Tue Sep 12 18:08:11 2023 +0200 @@ -22,21 +22,21 @@ OS_VERSION=`uname -r` TEMP_DIR=".tmp-`uname -n`" -mkdir -p $TEMP_DIR +mkdir -p "$TEMP_DIR" if [ $? -ne 0 ]; then - echo "Cannot create tmp dir" - echo "Abort" + echo "Cannot create tmp dir" + echo "Abort" fi -touch $TEMP_DIR/options -touch $TEMP_DIR/features +touch "$TEMP_DIR/options" +touch "$TEMP_DIR/features" # features # help text printhelp() { - echo "Usage: $0 [OPTIONS]..." - cat << __EOF__ + echo "Usage: $0 [OPTIONS]..." + cat << __EOF__ Installation directories: --prefix=PREFIX path prefix for architecture-independent files [/usr] @@ -63,64 +63,64 @@ } # -# parse arguments +# parse arguments # -for ARG in $@ +for ARG in "$@" do case "$ARG" in - "--prefix="*) PREFIX=${ARG#--prefix=} ;; - "--exec-prefix="*) EPREFIX=${ARG#--exec-prefix=} ;; - "--bindir="*) BINDIR=${ARG#----bindir=} ;; - "--sbindir="*) SBINDIR=${ARG#--sbindir=} ;; - "--libdir="*) LIBDIR=${ARG#--libdir=} ;; - "--libexecdir="*) LIBEXECDIR=${ARG#--libexecdir=} ;; - "--datadir="*) DATADIR=${ARG#--datadir=} ;; - "--sysconfdir="*) SYSCONFDIR=${ARG#--sysconfdir=} ;; - "--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;; - "--localstatedir="*) LOCALSTATEDIR=${ARG#--localstatedir=} ;; - "--includedir="*) INCLUDEDIR=${ARG#--includedir=} ;; - "--infodir="*) INFODIR=${ARG#--infodir=} ;; - "--mandir"*) MANDIR=${ARG#--mandir} ;; - "--help"*) printhelp; exit 1 ;; - "--enable-postgresql") FEATURE_POSTGRESQL=on ;; - "--disable-postgresql") unset FEATURE_POSTGRESQL ;; - "-"*) echo "unknown option: $ARG"; exit 1 ;; - esac + "--prefix="*) PREFIX=${ARG#--prefix=} ;; + "--exec-prefix="*) EPREFIX=${ARG#--exec-prefix=} ;; + "--bindir="*) BINDIR=${ARG#----bindir=} ;; + "--sbindir="*) SBINDIR=${ARG#--sbindir=} ;; + "--libdir="*) LIBDIR=${ARG#--libdir=} ;; + "--libexecdir="*) LIBEXECDIR=${ARG#--libexecdir=} ;; + "--datadir="*) DATADIR=${ARG#--datadir=} ;; + "--sysconfdir="*) SYSCONFDIR=${ARG#--sysconfdir=} ;; + "--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;; + "--localstatedir="*) LOCALSTATEDIR=${ARG#--localstatedir=} ;; + "--includedir="*) INCLUDEDIR=${ARG#--includedir=} ;; + "--infodir="*) INFODIR=${ARG#--infodir=} ;; + "--mandir"*) MANDIR=${ARG#--mandir} ;; + "--help"*) printhelp; rm -Rf "$TEMP_DIR"; exit 1 ;; + "--enable-postgresql") FEATURE_POSTGRESQL=on ;; + "--disable-postgresql") unset FEATURE_POSTGRESQL ;; + "-"*) echo "unknown option: $ARG"; rm -Rf "$TEMP_DIR"; exit 1 ;; + esac done # set dir variables if [ -z "$BINDIR" ]; then - BINDIR=$EPREFIX/bin + BINDIR=$EPREFIX/bin fi if [ -z "$SBINDIR" ]; then - SBINDIR=$EPREFIX/sbin + SBINDIR=$EPREFIX/sbin fi if [ -z "$LIBDIR" ]; then - LIBDIR=$EPREFIX/lib + LIBDIR=$EPREFIX/lib fi if [ -z "$LIBEXEC" ]; then - LIBEXECDIR=$EPREFIX/libexec + LIBEXECDIR=$EPREFIX/libexec fi if [ -z "$DATADIR" ]; then - DATADIR=$PREFIX/share + DATADIR=$PREFIX/share fi if [ -z "$SYSCONFDIR" ]; then - SYSCONFDIR=$PREFIX/etc + SYSCONFDIR=$PREFIX/etc fi if [ -z "$SHAREDSTATEDIR" ]; then - SHAREDSTATEDIR=$PREFIX/com + SHAREDSTATEDIR=$PREFIX/com fi if [ -z "$LOCALSTATEDIR" ]; then - LOCALSTATEDIR=$PREFIX/var + LOCALSTATEDIR=$PREFIX/var fi if [ -z "$INCLUDEDIR" ]; then - INCLUDEDIR=$PREFIX/include + INCLUDEDIR=$PREFIX/include fi if [ -z "$INFODIR" ]; then - INFODIR=$PREFIX/info + INFODIR=$PREFIX/info fi if [ -z "$MANDIR" ]; then - MANDIR=$PREFIX/man + MANDIR=$PREFIX/man fi which pkg-config > /dev/null @@ -133,19 +133,19 @@ # Simple uname based platform detection # $PLATFORM is used for platform dependent dependency selection printf "detect platform... " -if [ $OS = SunOS ]; then +if [ "$OS" = "SunOS" ]; then PLATFORM="solaris sunos unix svr4" fi -if [ $OS = Linux ]; then +if [ "$OS" = "Linux" ]; then PLATFORM="linux unix" fi -if [ $OS = FreeBSD ]; then +if [ "$OS" = "FreeBSD" ]; then PLATFORM="freebsd bsd unix" fi -if [ $OS = Darwin ]; then +if [ "$OS" = "Darwin" ]; then PLATFORM="macos osx bsd unix" fi -echo $OS | grep "MINGW" > /dev/null +echo "$OS" | grep -i "MINGW" > /dev/null if [ $? -eq 0 ]; then PLATFORM="windows mingw" fi @@ -156,8 +156,8 @@ for p in $PLATFORM do - PLATFORM_NAME=$p - break + PLATFORM_NAME=$p + break done echo $PLATFORM_NAME @@ -165,7 +165,7 @@ { for p in $PLATFORM do - if [ $p = $1 ]; then + if [ "$p" = "$1" ]; then return 0 fi done @@ -175,7 +175,7 @@ { for p in $PLATFORM do - if [ $p = $1 ]; then + if [ "$p" = "$1" ]; then return 1 fi done @@ -183,7 +183,7 @@ } # generate config.mk and config.h -cat > $TEMP_DIR/config.mk << __EOF__ +cat > "$TEMP_DIR/config.mk" << __EOF__ # # config.mk generated by configure # @@ -209,7 +209,7 @@ __EOF__ -echo > $TEMP_DIR/make.mk +echo > "$TEMP_DIR/make.mk" ENV_CFLAGS=$CFLAGS ENV_LDFLAGS=$LDFLAGS @@ -220,15 +220,15 @@ . make/toolchain.sh # add user specified flags to config.mk -echo >> $TEMP_DIR/config.mk -if [ ! -z "${ENV_CFLAGS}" ]; then - echo "CFLAGS += $ENV_CFLAGS" >> $TEMP_DIR/config.mk +echo "# project specific flags" >> "$TEMP_DIR/config.mk" +if [ -n "${ENV_CFLAGS}" ]; then + echo "CFLAGS += $ENV_CFLAGS" >> "$TEMP_DIR/config.mk" fi -if [ ! -z "${ENV_CXXFLAGS}" ]; then - echo "CXXFLAGS += $ENV_CXXFLAGS" >> $TEMP_DIR/config.mk +if [ -n "${ENV_CXXFLAGS}" ]; then + echo "CXXFLAGS += $ENV_CXXFLAGS" >> "$TEMP_DIR/config.mk" fi -if [ ! -z "${ENV_LDFLAGS}" ]; then - echo "LDFLAGS += $ENV_LDFLAGS" >> $TEMP_DIR/config.mk +if [ -n "${ENV_LDFLAGS}" ]; then + echo "LDFLAGS += $ENV_LDFLAGS" >> "$TEMP_DIR/config.mk" fi # @@ -238,103 +238,103 @@ dependency_libpq() { printf "checking for libpq... " - # dependency libpq + # dependency libpq while true do if [ -z "$PKG_CONFIG" ]; then - break + break fi - $PKG_CONFIG libpq + $PKG_CONFIG libpq if [ $? -ne 0 ] ; then break fi - CFLAGS="$CFLAGS `$PKG_CONFIG --cflags libpq`" - LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs libpq`" - cat >> $TEMP_DIR/make.mk << __EOF__ -# Dependency: libpq + TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags libpq`" + TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs libpq`" + cat >> $TEMP_DIR/make.mk << __EOF__ +# Dependency: libpq CFLAGS += -DENABLE_POSTGRESQL PLUGINS += postgresql TEST_PLUGIN_LDFLAGS += -lwspgtest __EOF__ - echo yes + echo yes return 0 done - - echo no - return 1 + + echo no + return 1 } dependency_openssl() { printf "checking for openssl... " - # dependency openssl + # dependency openssl while true do if [ -z "$PKG_CONFIG" ]; then - break + break fi - $PKG_CONFIG openssl + $PKG_CONFIG openssl if [ $? -ne 0 ] ; then break fi - CFLAGS="$CFLAGS `$PKG_CONFIG --cflags openssl`" - LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs openssl`" - echo yes + TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags openssl`" + TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs openssl`" + echo yes return 0 done - - # dependency openssl + + # dependency openssl while true do - LDFLAGS="$LDFLAGS -lssl -lcrypto" - echo yes + TEMP_LDFLAGS="$TEMP_LDFLAGS -lssl -lcrypto" + echo yes return 0 done - - echo no - return 1 + + echo no + return 1 } dependency_libxml2() { printf "checking for libxml2... " - # dependency libxml2 + # dependency libxml2 while true do if [ -z "$PKG_CONFIG" ]; then - break + break fi - $PKG_CONFIG libxml-2.0 + $PKG_CONFIG libxml-2.0 if [ $? -ne 0 ] ; then break fi - CFLAGS="$CFLAGS `$PKG_CONFIG --cflags libxml-2.0`" - LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs libxml-2.0`" - echo yes + TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags libxml-2.0`" + TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs libxml-2.0`" + echo yes return 0 done - - # dependency libxml2 + + # dependency libxml2 while true do xml2-config --cflags > /dev/null if [ $? -eq 0 ]; then - CFLAGS="$CFLAGS `xml2-config --cflags`" + TEMP_CFLAGS="$TEMP_CFLAGS `xml2-config --cflags`" else break fi - echo yes + echo yes return 0 done - - echo no - return 1 + + echo no + return 1 } DEPENDENCIES_FAILED= ERROR=0 # general dependencies -CFLAGS= -LDFLAGS= +TEMP_CFLAGS= +TEMP_LDFLAGS= while true do if isnotplatform "linux"; then @@ -342,10 +342,10 @@ fi while true do - - CFLAGS="$CFLAGS -DLINUX" - LDFLAGS="$LDFLAGS -lpthread -ldl -lm -lldap -llber" - cat >> $TEMP_DIR/make.mk << __EOF__ + + TEMP_CFLAGS="$TEMP_CFLAGS -DLINUX" + TEMP_LDFLAGS="$TEMP_LDFLAGS -lpthread -ldl -lm -lldap -llber" + cat >> "$TEMP_DIR/make.mk" << __EOF__ # platform dependend source files PLATFORM_DAEMONOBJ = event_linux.o @@ -359,10 +359,10 @@ RPATH_WS_LIB_FLAG = -Wl,-rpath,'\$\$ORIGIN/../lib' __EOF__ - + break done - + break done while true @@ -375,10 +375,10 @@ fi while true do - - CFLAGS="$CFLAGS -DBSD -I/usr/local/include" - LDFLAGS="$LDFLAGS -lpthread -lm -lldap -llber" - cat >> $TEMP_DIR/make.mk << __EOF__ + + TEMP_CFLAGS="$TEMP_CFLAGS -DBSD -I/usr/local/include" + TEMP_LDFLAGS="$TEMP_LDFLAGS -lpthread -lm -lldap -llber" + cat >> "$TEMP_DIR/make.mk" << __EOF__ # platform dependend source files PLATFORM_DAEMONOBJ = event_bsd.o @@ -392,10 +392,10 @@ RPATH_WS_LIB_FLAG = -Wl,-rpath,'\$\$ORIGIN/../lib' __EOF__ - + break done - + break done while true @@ -405,10 +405,10 @@ fi while true do - - CFLAGS="$CFLAGS -DBSD -DOSX" - LDFLAGS="$LDFLAGS -lpthread -ldl -lm -lldap -llber" - cat >> $TEMP_DIR/make.mk << __EOF__ + + TEMP_CFLAGS="$TEMP_CFLAGS -DBSD -DOSX" + TEMP_LDFLAGS="$TEMP_LDFLAGS -lpthread -ldl -lm -lldap -llber" + cat >> "$TEMP_DIR/make.mk" << __EOF__ # platform dependend source files PLATFORM_DAEMONOBJ = event_bsd.o @@ -422,10 +422,10 @@ RPATH_WS_LIB_FLAG = -rpath @loader_path/../lib __EOF__ - + break done - + break done while true @@ -435,10 +435,10 @@ fi while true do - - CFLAGS="$CFLAGS -DSOLARIS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS" - LDFLAGS="$LDFLAGS -lsocket -lnsl -lsendfile -lposix4 -lpthread -ldl -lm -lmd -lldap" - cat >> $TEMP_DIR/make.mk << __EOF__ + + TEMP_CFLAGS="$TEMP_CFLAGS -DSOLARIS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS" + TEMP_LDFLAGS="$TEMP_LDFLAGS -lsocket -lnsl -lsendfile -lposix4 -lpthread -ldl -lm -lmd -lldap" + cat >> "$TEMP_DIR/make.mk" << __EOF__ # platform dependend source files PLATFORM_DAEMONOBJ = event_solaris.o @@ -448,23 +448,23 @@ APP_EXT = __EOF__ - + break done - + break done # add general dependency flags to config.mk -echo >> $TEMP_DIR/config.mk -if [ ! -z "${CFLAGS}" ]; then - echo "CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk +echo >> "$TEMP_DIR/config.mk" +if [ -n "${TEMP_CFLAGS}" ]; then + echo "CFLAGS += $TEMP_CFLAGS" >> $TEMP_DIR/config.mk fi -if [ ! -z "${CXXFLAGS}" ]; then - echo "CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk +if [ -n "${TEMP_CXXFLAGS}" ]; then + echo "CXXFLAGS += $TEMP_CXXFLAGS" >> $TEMP_DIR/config.mk fi -if [ ! -z "${LDFLAGS}" ]; then - echo "LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk +if [ -n "${TEMP_LDFLAGS}" ]; then + echo "LDFLAGS += $TEMP_LDFLAGS" >> $TEMP_DIR/config.mk fi # @@ -474,77 +474,77 @@ # # TARGETS # -CFLAGS= -CXXFLAGS= -LDFLAGS= +TEMP_CFLAGS= +TEMP_CXXFLAGS= +TEMP_LDFLAGS= # Target -CFLAGS= -LDFLAGS= -CXXFLAGS= +TEMP_CFLAGS= +TEMP_LDFLAGS= +TEMP_CXXFLAGS= dependency_libxml2 if [ $? -ne 0 ]; then - DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 " - ERROR=1 + DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 " + ERROR=1 fi dependency_openssl if [ $? -ne 0 ]; then - DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl " - ERROR=1 + DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl " + ERROR=1 fi # Features -echo >> $TEMP_DIR/config.mk -if [ ! -z "${CFLAGS}" ]; then - echo "CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk +echo >> "$TEMP_DIR/config.mk" +if [ -n "${TEMP_CFLAGS}" ]; then + echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk" fi -if [ ! -z "${CXXFLAGS}" ]; then - echo "CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk +if [ -n "${TEMP_CXXFLAGS}" ]; then + echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/config.mk" fi -if [ ! -z "${LDFLAGS}" ]; then - echo "LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk +if [ -n "${TEMP_LDFLAGS}" ]; then + echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" fi # Target: postgresql -CFLAGS= -LDFLAGS= -CXXFLAGS= +TEMP_CFLAGS= +TEMP_LDFLAGS= +TEMP_CXXFLAGS= # Features -if [ ! -z "$FEATURE_POSTGRESQL" ]; then - # check dependency - dependency_libpq - if [ $? -ne 0 ]; then - # "auto" features can fail and are just disabled in this case - if [ $FEATURE_POSTGRESQL != "auto" ]; then - DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libpq " - ERROR=1 - fi - fi +if [ -n "$FEATURE_POSTGRESQL" ]; then + # check dependency + dependency_libpq + if [ $? -ne 0 ]; then + # "auto" features can fail and are just disabled in this case + if [ "$FEATURE_POSTGRESQL" != "auto" ]; then + DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libpq " + ERROR=1 + fi + fi fi -echo >> $TEMP_DIR/config.mk -if [ ! -z "${CFLAGS}" ]; then - echo "POSTGRESQL_CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk +echo >> "$TEMP_DIR/config.mk" +if [ -n "${TEMP_CFLAGS}" ]; then + echo "POSTGRESQL_CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk" fi -if [ ! -z "${CXXFLAGS}" ]; then - echo "POSTGRESQL_CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk +if [ -n "${TEMP_CXXFLAGS}" ]; then + echo "POSTGRESQL_CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/config.mk" fi -if [ ! -z "${LDFLAGS}" ]; then - echo "POSTGRESQL_LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk +if [ -n "${TEMP_LDFLAGS}" ]; then + echo "POSTGRESQL_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" fi if [ $ERROR -ne 0 ]; then - echo - echo "Error: Unresolved dependencies" - echo $DEPENDENCIES_FAILED - rm -Rf $TEMP_DIR - exit 1 + echo + echo "Error: Unresolved dependencies" + echo "$DEPENDENCIES_FAILED" + rm -Rf "$TEMP_DIR" + exit 1 fi echo "configure finished" @@ -553,7 +553,7 @@ echo " PREFIX: $PREFIX" echo " TOOLCHAIN: $TOOLCHAIN_NAME" echo -cat $TEMP_DIR/config.mk $TEMP_DIR/make.mk > config.mk -rm -Rf $TEMP_DIR +cat "$TEMP_DIR/config.mk" "$TEMP_DIR/make.mk" > config.mk +rm -Rf "$TEMP_DIR"
--- a/make/configure.vm Thu Sep 07 10:51:13 2023 +0200 +++ b/make/configure.vm Tue Sep 12 18:08:11 2023 +0200 @@ -2,9 +2,9 @@ #foreach( $var in $vars ) #if( $var.exec ) -${var.name}=`${var.value}` +${var.varName}=`${var.value}` #else -${var.name}=${var.value} +${var.varName}=${var.value} #end #end @@ -53,13 +53,13 @@ OS_VERSION=`uname -r` TEMP_DIR=".tmp-`uname -n`" -mkdir -p $TEMP_DIR +mkdir -p "$TEMP_DIR" if [ $? -ne 0 ]; then - echo "Cannot create tmp dir" - echo "Abort" + echo "Cannot create tmp dir" + echo "Abort" fi -touch $TEMP_DIR/options -touch $TEMP_DIR/features +touch "$TEMP_DIR/options" +touch "$TEMP_DIR/features" # features #foreach( $feature in $features ) @@ -71,8 +71,8 @@ # help text printhelp() { - echo "Usage: $0 [OPTIONS]..." - cat << __EOF__ + echo "Usage: $0 [OPTIONS]..." + cat << __EOF__ Installation directories: --prefix=PREFIX path prefix for architecture-independent files [/usr] @@ -114,70 +114,70 @@ } # -# parse arguments +# parse arguments # #set( $D = '$' ) -for ARG in $@ +for ARG in "$@" do case "$ARG" in - "--prefix="*) PREFIX=${D}{ARG#--prefix=} ;; - "--exec-prefix="*) EPREFIX=${D}{ARG#--exec-prefix=} ;; - "--bindir="*) BINDIR=${D}{ARG#----bindir=} ;; - "--sbindir="*) SBINDIR=${D}{ARG#--sbindir=} ;; - "--libdir="*) LIBDIR=${D}{ARG#--libdir=} ;; - "--libexecdir="*) LIBEXECDIR=${D}{ARG#--libexecdir=} ;; - "--datadir="*) DATADIR=${D}{ARG#--datadir=} ;; - "--sysconfdir="*) SYSCONFDIR=${D}{ARG#--sysconfdir=} ;; - "--sharedstatedir="*) SHAREDSTATEDIR=${D}{ARG#--sharedstatedir=} ;; - "--localstatedir="*) LOCALSTATEDIR=${D}{ARG#--localstatedir=} ;; - "--includedir="*) INCLUDEDIR=${D}{ARG#--includedir=} ;; - "--infodir="*) INFODIR=${D}{ARG#--infodir=} ;; - "--mandir"*) MANDIR=${D}{ARG#--mandir} ;; - "--help"*) printhelp; exit 1 ;; - #foreach( $opt in $options ) - "--${opt.getArgument()}="*) ${opt.getVarName()}=${D}{ARG#--${opt.getArgument()}=} ;; + "--prefix="*) PREFIX=${D}{ARG#--prefix=} ;; + "--exec-prefix="*) EPREFIX=${D}{ARG#--exec-prefix=} ;; + "--bindir="*) BINDIR=${D}{ARG#----bindir=} ;; + "--sbindir="*) SBINDIR=${D}{ARG#--sbindir=} ;; + "--libdir="*) LIBDIR=${D}{ARG#--libdir=} ;; + "--libexecdir="*) LIBEXECDIR=${D}{ARG#--libexecdir=} ;; + "--datadir="*) DATADIR=${D}{ARG#--datadir=} ;; + "--sysconfdir="*) SYSCONFDIR=${D}{ARG#--sysconfdir=} ;; + "--sharedstatedir="*) SHAREDSTATEDIR=${D}{ARG#--sharedstatedir=} ;; + "--localstatedir="*) LOCALSTATEDIR=${D}{ARG#--localstatedir=} ;; + "--includedir="*) INCLUDEDIR=${D}{ARG#--includedir=} ;; + "--infodir="*) INFODIR=${D}{ARG#--infodir=} ;; + "--mandir"*) MANDIR=${D}{ARG#--mandir} ;; + "--help"*) printhelp; rm -Rf "$TEMP_DIR"; exit 1 ;; + #foreach( $opt in $options ) + "--${opt.getArgument()}="*) ${opt.getVarName()}=${D}{ARG#--${opt.getArgument()}=} ;; #end - #foreach( $feature in $features ) - "--enable-${feature.arg}") ${feature.getVarName()}=on ;; - "--disable-${feature.arg}") unset ${feature.getVarName()} ;; - #end - "-"*) echo "unknown option: $ARG"; exit 1 ;; - esac + #foreach( $feature in $features ) + "--enable-${feature.arg}") ${feature.getVarName()}=on ;; + "--disable-${feature.arg}") unset ${feature.getVarName()} ;; + #end + "-"*) echo "unknown option: $ARG"; rm -Rf "$TEMP_DIR"; exit 1 ;; + esac done # set dir variables if [ -z "$BINDIR" ]; then - BINDIR=$EPREFIX/bin + BINDIR=$EPREFIX/bin fi if [ -z "$SBINDIR" ]; then - SBINDIR=$EPREFIX/sbin + SBINDIR=$EPREFIX/sbin fi if [ -z "$LIBDIR" ]; then - LIBDIR=$EPREFIX/lib + LIBDIR=$EPREFIX/lib fi if [ -z "$LIBEXEC" ]; then - LIBEXECDIR=$EPREFIX/libexec + LIBEXECDIR=$EPREFIX/libexec fi if [ -z "$DATADIR" ]; then - DATADIR=$PREFIX/share + DATADIR=$PREFIX/share fi if [ -z "$SYSCONFDIR" ]; then - SYSCONFDIR=$PREFIX/etc + SYSCONFDIR=$PREFIX/etc fi if [ -z "$SHAREDSTATEDIR" ]; then - SHAREDSTATEDIR=$PREFIX/com + SHAREDSTATEDIR=$PREFIX/com fi if [ -z "$LOCALSTATEDIR" ]; then - LOCALSTATEDIR=$PREFIX/var + LOCALSTATEDIR=$PREFIX/var fi if [ -z "$INCLUDEDIR" ]; then - INCLUDEDIR=$PREFIX/include + INCLUDEDIR=$PREFIX/include fi if [ -z "$INFODIR" ]; then - INFODIR=$PREFIX/info + INFODIR=$PREFIX/info fi if [ -z "$MANDIR" ]; then - MANDIR=$PREFIX/man + MANDIR=$PREFIX/man fi which pkg-config > /dev/null @@ -190,19 +190,19 @@ # Simple uname based platform detection # $PLATFORM is used for platform dependent dependency selection printf "detect platform... " -if [ $OS = SunOS ]; then +if [ "$OS" = "SunOS" ]; then PLATFORM="solaris sunos unix svr4" fi -if [ $OS = Linux ]; then +if [ "$OS" = "Linux" ]; then PLATFORM="linux unix" fi -if [ $OS = FreeBSD ]; then +if [ "$OS" = "FreeBSD" ]; then PLATFORM="freebsd bsd unix" fi -if [ $OS = Darwin ]; then +if [ "$OS" = "Darwin" ]; then PLATFORM="macos osx bsd unix" fi -echo $OS | grep "MINGW" > /dev/null +echo "$OS" | grep -i "MINGW" > /dev/null if [ $? -eq 0 ]; then PLATFORM="windows mingw" fi @@ -213,8 +213,8 @@ for p in $PLATFORM do - PLATFORM_NAME=$p - break + PLATFORM_NAME=$p + break done echo $PLATFORM_NAME @@ -222,7 +222,7 @@ { for p in $PLATFORM do - if [ $p = $1 ]; then + if [ "$p" = "$1" ]; then return 0 fi done @@ -232,7 +232,7 @@ { for p in $PLATFORM do - if [ $p = $1 ]; then + if [ "$p" = "$1" ]; then return 1 fi done @@ -240,14 +240,14 @@ } # generate config.mk and config.h -cat > $TEMP_DIR/config.mk << __EOF__ +cat > "$TEMP_DIR/config.mk" << __EOF__ # # config.mk generated by configure # # general vars #foreach( $var in $vars ) -${var.name}=$${var.name} +${var.varName}=$${var.varName} #end #if ( ! $project.hasVar("PREFIX") ) @@ -293,7 +293,7 @@ __EOF__ -echo > $TEMP_DIR/make.mk +echo > "$TEMP_DIR/make.mk" ENV_CFLAGS=$CFLAGS ENV_LDFLAGS=$LDFLAGS @@ -304,15 +304,15 @@ . make/toolchain.sh # add user specified flags to config.mk -echo >> $TEMP_DIR/config.mk -if [ ! -z "${ENV_CFLAGS}" ]; then - echo "CFLAGS += $ENV_CFLAGS" >> $TEMP_DIR/config.mk +echo "# project specific flags" >> "$TEMP_DIR/config.mk" +if [ -n "${ENV_CFLAGS}" ]; then + echo "CFLAGS += $ENV_CFLAGS" >> "$TEMP_DIR/config.mk" fi -if [ ! -z "${ENV_CXXFLAGS}" ]; then - echo "CXXFLAGS += $ENV_CXXFLAGS" >> $TEMP_DIR/config.mk +if [ -n "${ENV_CXXFLAGS}" ]; then + echo "CXXFLAGS += $ENV_CXXFLAGS" >> "$TEMP_DIR/config.mk" fi -if [ ! -z "${ENV_LDFLAGS}" ]; then - echo "LDFLAGS += $ENV_LDFLAGS" >> $TEMP_DIR/config.mk +if [ -n "${ENV_LDFLAGS}" ]; then + echo "LDFLAGS += $ENV_LDFLAGS" >> "$TEMP_DIR/config.mk" fi # @@ -324,63 +324,63 @@ { printf "checking for ${dependency.name}... " #foreach( $sub in $dependency.getSubdependencies() ) - # dependency $sub.name $sub.getPlatformString() + # dependency $sub.getFullName() while true do - #if( $sub.platform ) - if isnotplatform "${sub.platform}"; then + #if( $sub.platform ) + if isnotplatform "${sub.platform}"; then break fi - #end - #foreach( $not in $sub.getNotList() ) - if isplatform "${not}"; then + #end + #foreach( $not in $sub.getNotList() ) + if isplatform "${not}"; then break fi - #end + #end #if( $sub.pkgconfig.size() > 0 ) if [ -z "$PKG_CONFIG" ]; then - break + break + fi + #end + #foreach( $test in $sub.tests ) + $test > /dev/null + if [ $? -ne 0 ]; then + break fi #end #foreach( $pkg in $sub.pkgconfig ) - $PKG_CONFIG $pkg.getPkgConfigParam() + $pkg.getPkgConfigTestQuery() if [ $? -ne 0 ] ; then break fi - CFLAGS="$CFLAGS `$PKG_CONFIG --cflags $pkg.getPkgConfigParam()`" - LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs $pkg.getPkgConfigParam()`" + TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags $pkg.name`" + TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs $pkg.name`" #end #foreach( $flags in $sub.flags ) #if( $flags.exec ) $flags.value > /dev/null if [ $? -eq 0 ]; then - $flags.varName="$$flags.varName `$flags.value`" + TEMP_$flags.varName="$TEMP_$flags.varName `$flags.value`" else break fi #else - $flags.varName="$$flags.varName $flags.value" + TEMP_$flags.varName="$TEMP_$flags.varName $flags.value" #end #end - #foreach( $test in $sub.tests ) - $test > /dev/null - if [ $? -ne 0 ]; then - break - fi - #end - #if ( $sub.make.length() > 0 ) - cat >> $TEMP_DIR/make.mk << __EOF__ -# Dependency: $dependency.name + #if ( $sub.make.length() > 0 ) + cat >> $TEMP_DIR/make.mk << __EOF__ +# Dependency: $dependency.name $sub.make __EOF__ #end - echo yes + echo yes return 0 done - - #end - echo no - return 1 + + #end + echo no + return 1 } #end @@ -388,21 +388,21 @@ ERROR=0 #if( $dependencies.size() > 0 ) # general dependencies -CFLAGS= -LDFLAGS= +TEMP_CFLAGS= +TEMP_LDFLAGS= #foreach( $dependency in $dependencies ) while true do - #if( $dependency.platform ) + #if( $dependency.platform ) if isnotplatform "${dependency.platform}"; then break fi #end - #foreach( $not in $dependency.getNotList() ) + #foreach( $not in $dependency.getNotList() ) if isplatform "${not}"; then break fi - #end + #end while true do #if( $dependency.pkgconfig.size() > 0 ) @@ -412,54 +412,54 @@ fi #end #foreach( $pkg in $dependency.pkgconfig ) - printf "checking for pkg-config package $pkg.getPkgConfigParam()... " - $PKG_CONFIG $pkg.getPkgConfigParam() + printf "checking for pkg-config package $pkg.name... " + $pkg.getPkgConfigTestQuery() if [ $? -ne 0 ]; then echo no ERROR=1 break fi echo yes - CFLAGS="$CFLAGS `$PKG_CONFIG --cflags $pkg.getPkgConfigParam()`" - LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs $pkg.getPkgConfigParam()`" + TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags $pkg.name`" + TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs $pkg.name`" #end - + #foreach( $flags in $dependency.flags ) #if( $flags.exec ) $flags.value > /dev/null if [ $? -ne 0 ]; then - $flags.varName="$$flags.varName `$flags.value`" + TEMP_$flags.varName="$TEMP_$flags.varName `$flags.value`" else ERROR=1 break fi #else - $flags.varName="$$flags.varName $flags.value" + TEMP_$flags.varName="$TEMP_$flags.varName $flags.value" #end #end - #if ( $dependency.make.length() > 0 ) - cat >> $TEMP_DIR/make.mk << __EOF__ + #if ( $dependency.make.length() > 0 ) + cat >> "$TEMP_DIR/make.mk" << __EOF__ $dependency.make __EOF__ #end - + break done - + break done #end # add general dependency flags to config.mk -echo >> $TEMP_DIR/config.mk -if [ ! -z "${CFLAGS}" ]; then - echo "CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk +echo >> "$TEMP_DIR/config.mk" +if [ -n "${TEMP_CFLAGS}" ]; then + echo "CFLAGS += $TEMP_CFLAGS" >> $TEMP_DIR/config.mk fi -if [ ! -z "${CXXFLAGS}" ]; then - echo "CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk +if [ -n "${TEMP_CXXFLAGS}" ]; then + echo "CXXFLAGS += $TEMP_CXXFLAGS" >> $TEMP_DIR/config.mk fi -if [ ! -z "${LDFLAGS}" ]; then - echo "LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk +if [ -n "${TEMP_LDFLAGS}" ]; then + echo "LDFLAGS += $TEMP_LDFLAGS" >> $TEMP_DIR/config.mk fi #end @@ -470,25 +470,25 @@ #foreach( $val in $opt.values ) ${val.func}() { - VERR=0 - #foreach( $dep in $val.dependencies ) - dependency_$dep - if [ $? -ne 0 ]; then - VERR=1 - fi - #end - if [ $VERR -ne 0 ]; then - return 1 - fi - #foreach( $def in $val.defines ) - CFLAGS="$CFLAGS ${def.toFlags()}" - #end - #if( $val.hasMake() ) - cat >> $TEMP_DIR/make.mk << __EOF__ + VERR=0 + #foreach( $dep in $val.dependencies ) + dependency_$dep + if [ $? -ne 0 ]; then + VERR=1 + fi + #end + if [ $VERR -ne 0 ]; then + return 1 + fi + #foreach( $def in $val.defines ) + TEMP_CFLAGS="$TEMP_CFLAGS ${def.toFlags()}" + #end + #if( $val.hasMake() ) + cat >> "$TEMP_DIR/make.mk" << __EOF__ $val.make __EOF__ - #end - return 0 + #end + return 0 } #end #end @@ -496,9 +496,9 @@ # # TARGETS # -CFLAGS= -CXXFLAGS= -LDFLAGS= +TEMP_CFLAGS= +TEMP_CXXFLAGS= +TEMP_LDFLAGS= #foreach( $target in $targets ) #if ( $target.name ) @@ -506,31 +506,31 @@ #else # Target #end -CFLAGS= -LDFLAGS= -CXXFLAGS= +TEMP_CFLAGS= +TEMP_LDFLAGS= +TEMP_CXXFLAGS= #foreach( $dependency in $target.dependencies ) dependency_$dependency if [ $? -ne 0 ]; then - DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " - ERROR=1 + DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " + ERROR=1 fi #end # Features #foreach( $feature in $target.features ) -if [ ! -z "$${feature.getVarName()}" ]; then +if [ -n "$${feature.getVarName()}" ]; then #foreach( $dependency in $feature.dependencies ) - # check dependency - dependency_$dependency - if [ $? -ne 0 ]; then - # "auto" features can fail and are just disabled in this case - if [ $${feature.getVarName()} != "auto" ]; then - DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " - ERROR=1 - fi - fi + # check dependency + dependency_$dependency + if [ $? -ne 0 ]; then + # "auto" features can fail and are just disabled in this case + if [ "$${feature.getVarName()}" != "auto" ]; then + DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " + ERROR=1 + fi + fi #end fi #end @@ -538,65 +538,65 @@ #foreach( $opt in $target.options ) # Option: --${opt.argument} if [ -z ${D}${opt.getVarName()} ]; then - SAVED_ERROR=$ERROR - SAVED_DEPENDENCIES_FAILED=$DEPENDENCIES_FAILED - ERROR=0 - while true - do - #foreach( $optdef in $opt.defaults ) - #if( $optdef.platform ) - if isplatform "$optdef.platform"; then - #end - $optdef.func - if [ $? -eq 0 ]; then - echo " ${opt.argument}: ${optdef.valueName}" >> $TEMP_DIR/options - ERROR=0 - break - fi - #if( $optdef.platform ) - fi - #end - #end - break - done - if [ $ERROR -ne 0 ]; then - SAVED_ERROR=1 - fi - ERROR=$SAVED_ERROR - DEPENDENCIES_FAILED=$SAVED_DEPENDENCIES_FAILED= + SAVED_ERROR="$ERROR" + SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED" + ERROR=0 + while true + do + #foreach( $optdef in $opt.defaults ) + #if( $optdef.platform ) + if isplatform "$optdef.platform"; then + #end + $optdef.func + if [ $? -eq 0 ]; then + echo " ${opt.argument}: ${optdef.valueName}" >> "$TEMP_DIR/options" + ERROR=0 + break + fi + #if( $optdef.platform ) + fi + #end + #end + break + done + if [ $ERROR -ne 0 ]; then + SAVED_ERROR=1 + fi + ERROR="$SAVED_ERROR" + DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED" else - if false; then - false - #foreach( $optval in $opt.values ) - elif [ ${D}${opt.getVarName()} = "${optval.value}" ]; then - echo " ${opt.argument}: ${D}${opt.getVarName()}" >> $TEMP_DIR/options - $optval.func - if [ $? -ne 0 ]; then - ERROR=1 - fi - #end - fi + if false; then + false + #foreach( $optval in $opt.values ) + elif [ "${D}${opt.getVarName()}" = "${optval.value}" ]; then + echo " ${opt.argument}: ${D}${opt.getVarName()}" >> $TEMP_DIR/options + $optval.func + if [ $? -ne 0 ]; then + ERROR=1 + fi + #end + fi fi #end -echo >> $TEMP_DIR/config.mk -if [ ! -z "${CFLAGS}" ]; then - echo "${target.getCFlags()} += $CFLAGS" >> $TEMP_DIR/config.mk +echo >> "$TEMP_DIR/config.mk" +if [ -n "${TEMP_CFLAGS}" ]; then + echo "${target.getCFlags()} += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk" fi -if [ ! -z "${CXXFLAGS}" ]; then - echo "${target.getCXXFlags()} += $CXXFLAGS" >> $TEMP_DIR/config.mk +if [ -n "${TEMP_CXXFLAGS}" ]; then + echo "${target.getCXXFlags()} += $TEMP_CXXFLAGS" >> "$TEMP_DIR/config.mk" fi -if [ ! -z "${LDFLAGS}" ]; then - echo "${target.getLDFlags()} += $LDFLAGS" >> $TEMP_DIR/config.mk +if [ -n "${TEMP_LDFLAGS}" ]; then + echo "${target.getLDFlags()} += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" fi #end if [ $ERROR -ne 0 ]; then - echo - echo "Error: Unresolved dependencies" - echo $DEPENDENCIES_FAILED - rm -Rf $TEMP_DIR - exit 1 + echo + echo "Error: Unresolved dependencies" + echo "$DEPENDENCIES_FAILED" + rm -Rf "$TEMP_DIR" + exit 1 fi echo "configure finished" @@ -606,10 +606,10 @@ echo " TOOLCHAIN: $TOOLCHAIN_NAME" #if ( $options.size() > 0 ) echo "Options:" -cat $TEMP_DIR/options +cat "$TEMP_DIR/options" #end echo -cat $TEMP_DIR/config.mk $TEMP_DIR/make.mk > config.mk -rm -Rf $TEMP_DIR +cat "$TEMP_DIR/config.mk" "$TEMP_DIR/make.mk" > config.mk +rm -Rf "$TEMP_DIR"
--- a/make/project.xml Thu Sep 07 10:51:13 2023 +0200 +++ b/make/project.xml Tue Sep 12 18:08:11 2023 +0200 @@ -2,7 +2,7 @@ <project> <!-- makefile config --> <config> - <var name="HOST" type="exec">uname -n</var> + <var name="HOST" exec="true">uname -n</var> <var name="PREFIX">`pwd`/work</var> <var name="INSTALL_DIR">$PREFIX</var> </config> @@ -81,8 +81,8 @@ <pkgconfig>libxml-2.0</pkgconfig> </dependency> <dependency name="libxml2"> - <cflags type="exec">xml2-config --cflags</cflags> - <lfglags type="exec">xml2-config --libs</lfglags> + <cflags exec="true">xml2-config --cflags</cflags> + <lfglags exec="true">xml2-config --libs</lfglags> </dependency> <dependency name="openssl">