From: Olaf Wintermann Date: Sun, 25 May 2025 19:31:14 +0000 (+0200) Subject: update uwproj build system X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=5af3d4887b0c1d36c041b67d135660eccb705418;p=uwplayer.git update uwproj build system --- diff --git a/configure b/configure index 7fadcff..c839294 100755 --- a/configure +++ b/configure @@ -1,40 +1,47 @@ #!/bin/sh -# create temporary directory -TEMP_DIR=".tmp-`uname -n`" -rm -Rf "$TEMP_DIR" -if mkdir -p "$TEMP_DIR"; then - : -else - echo "Cannot create tmp dir $TEMP_DIR" - echo "Abort" - exit 1 -fi -touch "$TEMP_DIR/options" -touch "$TEMP_DIR/features" - -# define standard variables -# also define standard prefix (this is where we will search for config.site) -prefix=/usr -exec_prefix= -bindir= -sbindir= -libdir= -libexecdir= -datarootdir= -datadir= -sysconfdir= -sharedstatedir= -localstatedir= -runstatedir= -includedir= -infodir= -localedir= -mandir= -# custom variables - -# features +# some utility functions +isplatform() +{ + for p in $PLATFORM + do + if [ "$p" = "$1" ]; then + return 0 + fi + done + return 1 +} +notisplatform() +{ + for p in $PLATFORM + do + if [ "$p" = "$1" ]; then + return 1 + fi + done + return 0 +} +istoolchain() +{ + for t in $TOOLCHAIN + do + if [ "$t" = "$1" ]; then + return 0 + fi + done + return 1 +} +notistoolchain() +{ + for t in $TOOLCHAIN + do + if [ "$t" = "$1" ]; then + return 1 + fi + done + return 0 +} # clean abort abort_configure() @@ -43,6 +50,36 @@ abort_configure() exit 1 } +# Test for availability of pkg-config +PKG_CONFIG=`command -v pkg-config` +: ${PKG_CONFIG:="false"} + +# Simple uname based platform detection +# $PLATFORM is used for platform dependent dependency selection +OS=`uname -s` +OS_VERSION=`uname -r` +printf "detect platform... " +if [ "$OS" = "SunOS" ]; then + PLATFORM="solaris sunos unix svr4" +elif [ "$OS" = "Linux" ]; then + PLATFORM="linux unix" +elif [ "$OS" = "FreeBSD" ]; then + PLATFORM="freebsd bsd unix" +elif [ "$OS" = "OpenBSD" ]; then + PLATFORM="openbsd bsd unix" +elif [ "$OS" = "NetBSD" ]; then + PLATFORM="netbsd bsd unix" +elif [ "$OS" = "Darwin" ]; then + PLATFORM="macos osx bsd unix" +elif echo "$OS" | grep -i "MINGW" > /dev/null; then + PLATFORM="windows mingw" +fi +: ${PLATFORM:="unix"} + +PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -` +echo "$PLATFORM_NAME" + + # help text printhelp() { @@ -50,7 +87,7 @@ printhelp() cat << __EOF__ Installation directories: --prefix=PREFIX path prefix for architecture-independent files - [/usr] + [$prefix] --exec-prefix=EPREFIX path prefix for architecture-dependent files [PREFIX] @@ -69,9 +106,49 @@ Installation directories: --mandir=DIR man documentation [DATAROOTDIR/man] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] +Build Types: + --debug add extra compile flags for debug builds + --release add extra compile flags for release builds + __EOF__ } +# create temporary directory +TEMP_DIR=".tmp-`uname -n`" +rm -Rf "$TEMP_DIR" +if mkdir -p "$TEMP_DIR"; then + : +else + echo "Cannot create tmp dir $TEMP_DIR" + echo "Abort" + exit 1 +fi +touch "$TEMP_DIR/options" +touch "$TEMP_DIR/features" + +# define standard variables +# also define standard prefix (this is where we will search for config.site) +prefix=/usr +exec_prefix= +bindir= +sbindir= +libdir= +libexecdir= +datarootdir= +datadir= +sysconfdir= +sharedstatedir= +localstatedir= +runstatedir= +includedir= +infodir= +localedir= +mandir= + +# custom variables + +# features + # # parse arguments # @@ -94,9 +171,9 @@ do "--infodir="*) infodir=${ARG#--infodir=} ;; "--mandir"*) mandir=${ARG#--mandir} ;; "--localedir"*) localedir=${ARG#--localedir} ;; - "--help"*) printhelp; abort_configure ;; - "--debug") BUILD_TYPE="debug" ;; - "--release") BUILD_TYPE="release" ;; + "--help"*) printhelp; abort_configure ;; + "--debug") BUILD_TYPE="debug" ;; + "--release") BUILD_TYPE="release" ;; "-"*) echo "unknown option: $ARG"; abort_configure ;; esac done @@ -120,6 +197,22 @@ done : ${mandir:='${datarootdir}/man'} : ${localedir:='${datarootdir}/locale'} +# remember the above values and compare them later +orig_bindir="$bindir" +orig_sbindir="$sbindir" +orig_libdir="$libdir" +orig_libexecdir="$libexecdir" +orig_datarootdir="$datarootdir" +orig_datadir="$datadir" +orig_sysconfdir="$sysconfdir" +orig_sharedstatedir="$sharedstatedir" +orig_localstatedir="$localstatedir" +orig_runstatedir="$runstatedir" +orig_includedir="$includedir" +orig_infodir="$infodir" +orig_mandir="$mandir" +orig_localedir="$localedir" + # check if a config.site exists and load it if [ -n "$CONFIG_SITE" ]; then # CONFIG_SITE may contain space separated file names @@ -138,76 +231,6 @@ elif [ -f "$prefix/etc/config.site" ]; then echo ok fi -# Test for availability of pkg-config -PKG_CONFIG=`command -v pkg-config` -: ${PKG_CONFIG:="false"} - -# Simple uname based platform detection -# $PLATFORM is used for platform dependent dependency selection -OS=`uname -s` -OS_VERSION=`uname -r` -printf "detect platform... " -if [ "$OS" = "SunOS" ]; then - PLATFORM="solaris sunos unix svr4" -elif [ "$OS" = "Linux" ]; then - PLATFORM="linux unix" -elif [ "$OS" = "FreeBSD" ]; then - PLATFORM="freebsd bsd unix" -elif [ "$OS" = "OpenBSD" ]; then - PLATFORM="openbsd bsd unix" -elif [ "$OS" = "NetBSD" ]; then - PLATFORM="netbsd bsd unix" -elif [ "$OS" = "Darwin" ]; then - PLATFORM="macos osx bsd unix" -elif echo "$OS" | grep -i "MINGW" > /dev/null; then - PLATFORM="windows mingw" -fi -: ${PLATFORM:="unix"} - -PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -` -echo "$PLATFORM_NAME" - -isplatform() -{ - for p in $PLATFORM - do - if [ "$p" = "$1" ]; then - return 0 - fi - done - return 1 -} -notisplatform() -{ - for p in $PLATFORM - do - if [ "$p" = "$1" ]; then - return 1 - fi - done - return 0 -} -istoolchain() -{ - for t in $TOOLCHAIN - do - if [ "$t" = "$1" ]; then - return 0 - fi - done - return 1 -} -notistoolchain() -{ - for t in $TOOLCHAIN - do - if [ "$t" = "$1" ]; then - return 1 - fi - done - return 0 -} - # generate vars.mk cat > "$TEMP_DIR/vars.mk" << __EOF__ @@ -321,9 +344,9 @@ echo > "$TEMP_DIR/flags.mk" DEPENDENCIES_FAILED= ERROR=0 # unnamed dependencies -TEMP_CFLAGS= -TEMP_CXXFLAGS= -TEMP_LDFLAGS= +TEMP_CFLAGS="$CFLAGS" +TEMP_CXXFLAGS="$CXXFLAGS" +TEMP_LDFLAGS="$LDFLAGS" while true do while true @@ -370,6 +393,16 @@ do break done +# build type +if [ "$BUILD_TYPE" = "debug" ]; then + TEMP_CFLAGS="\${DEBUG_CC_FLAGS} $TEMP_CFLAGS" + TEMP_CXXFLAGS="\${DEBUG_CXX_FLAGS} $TEMP_CXXFLAGS" +fi +if [ "$BUILD_TYPE" = "release" ]; then + TEMP_CFLAGS="\${RELEASE_CC_FLAGS} $TEMP_CFLAGS" + TEMP_CXXFLAGS="\${RELEASE_CXX_FLAGS} $TEMP_CXXFLAGS" +fi + # add general dependency flags to flags.mk echo "# general flags" >> "$TEMP_DIR/flags.mk" if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then @@ -415,22 +448,6 @@ fi if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then echo "APP_CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" fi -if [ "$BUILD_TYPE" = "debug" ]; then - if [ -n "$lang_c" ]; then - echo 'APP_CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" - fi - if [ -n "$lang_cpp" ]; then - echo 'APP_CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" - fi -fi -if [ "$BUILD_TYPE" = "release" ]; then - if [ -n "$lang_c" ]; then - echo 'APP_CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" - fi - if [ -n "$lang_cpp" ]; then - echo 'APP_CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" - fi -fi if [ -n "${TEMP_LDFLAGS}" ]; then echo "APP_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" fi @@ -446,18 +463,78 @@ fi echo "configure finished" echo +echo "Toolchain" +echo " name: $TOOLCHAIN_NAME" +if [ -n "$TOOLCHAIN_CC" ]; then + echo " cc: $TOOLCHAIN_CC" +fi +if [ -n "$TOOLCHAIN_CXX" ]; then + echo " cxx: $TOOLCHAIN_CXX" +fi +if [ -n "$TOOLCHAIN_WSIZE" ]; then + echo " word size: $TOOLCHAIN_WSIZE bit" +fi +if [ -n "$TOOLCHAIN_CSTD" ]; then + echo " default C std: $TOOLCHAIN_CSTD" +fi +echo echo "Build Config:" -echo " PREFIX: $prefix" -echo " TOOLCHAIN: $TOOLCHAIN_NAME" +echo " prefix: $prefix" +echo " exec_prefix: $exec_prefix" +if [ "$orig_bindir" != "$bindir" ]; then + echo " bindir: $bindir" +fi +if [ "$orig_sbindir" != "$sbindir" ]; then + echo " sbindir: $sbindir" +fi +if [ "$orig_libdir" != "$libdir" ]; then + echo " libdir: $libdir" +fi +if [ "$orig_libexecdir" != "$libexecdir" ]; then + echo " libexecdir: $libexecdir" +fi +if [ "$orig_datarootdir" != "$datarootdir" ]; then + echo " datarootdir: $datarootdir" +fi +if [ "$orig_datadir" != "$datadir" ]; then + echo " datadir: $datadir" +fi +if [ "$orig_sysconfdir" != "$sysconfdir" ]; then + echo " sysconfdir: $sysconfdir" +fi +if [ "$orig_sharedstatedir" != "$sharedstatedir" ]; then + echo " sharedstatedir: $sharedstatedir" +fi +if [ "$orig_localstatedir" != "$localstatedir" ]; then + echo " localstatedir: $localstatedir" +fi +if [ "$orig_runstatedir" != "$runstatedir" ]; then + echo " runstatedir: $runstatedir" +fi +if [ "$orig_includedir" != "$includedir" ]; then + echo " includedir: $includedir" +fi +if [ "$orig_infodir" != "$infodir" ]; then + echo " infodir: $infodir" +fi +if [ "$orig_mandir" != "$mandir" ]; then + echo " mandir: $mandir" +fi +if [ "$orig_localedir" != "$localedir" ]; then + echo " localedir: $localedir" +fi echo # generate the config.mk file +pwd=`pwd` cat > "$TEMP_DIR/config.mk" << __EOF__ # -# config.mk generated by configure +# config.mk generated by: +# pwd: $pwd +# $0 $@ # __EOF__ write_toolchain_defaults "$TEMP_DIR/toolchain.mk" -cat "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk +cat "$TEMP_DIR/config.mk" "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk rm -Rf "$TEMP_DIR" diff --git a/make/cc.mk b/make/cc.mk index 149bde6..72e3155 100644 --- a/make/cc.mk +++ b/make/cc.mk @@ -4,11 +4,11 @@ CFLAGS = CXXFLAGS = -DEBUG_CC_FLAGS = -g -DEBUG_CXX_FLAGS = -g -RELEASE_CC_FLAGS = -O3 -DNDEBUG -RELEASE_CXX_FLAGS = -O3 -DNDEBUG +DEBUG_CFLAGS = -g +DEBUG_CXXFLAGS = -g +RELEASE_CFLAGS = -O3 -DNDEBUG +RELEASE_CXXFLAGS = -O3 -DNDEBUG LDFLAGS = SHLIB_CFLAGS = -fPIC -SHLIB_LDFLAGS = -shared \ No newline at end of file +SHLIB_LDFLAGS = -shared diff --git a/make/clang.mk b/make/clang.mk index 772ebb7..fb18443 100644 --- a/make/clang.mk +++ b/make/clang.mk @@ -4,10 +4,10 @@ CFLAGS = CXXFLAGS = -DEBUG_CC_FLAGS = -g -DEBUG_CXX_FLAGS = -g -RELEASE_CC_FLAGS = -O3 -DNDEBUG -RELEASE_CXX_FLAGS = -O3 -DNDEBUG +DEBUG_CFLAGS = -g +DEBUG_CXXFLAGS = -g +RELEASE_CFLAGS = -O3 -DNDEBUG +RELEASE_CXXFLAGS = -O3 -DNDEBUG LDFLAGS = SHLIB_CFLAGS = -fPIC diff --git a/make/configure.vm b/make/configure.vm index b8acad3..ffb00a6 100644 --- a/make/configure.vm +++ b/make/configure.vm @@ -1,52 +1,48 @@ #!/bin/sh -# create temporary directory -TEMP_DIR=".tmp-`uname -n`" -rm -Rf "$TEMP_DIR" -if mkdir -p "$TEMP_DIR"; then - : -else - echo "Cannot create tmp dir $TEMP_DIR" - echo "Abort" - exit 1 -fi -touch "$TEMP_DIR/options" -touch "$TEMP_DIR/features" - -# define standard variables -# also define standard prefix (this is where we will search for config.site) -prefix=/usr -exec_prefix= -bindir= -sbindir= -libdir= -libexecdir= -datarootdir= -datadir= -sysconfdir= -sharedstatedir= -localstatedir= -runstatedir= -includedir= -infodir= -localedir= -mandir= - -# custom variables -#foreach( $var in $vars ) -#if( $var.exec ) -${var.varName}=`${var.value}` -#else -${var.varName}="${var.value}" -#end -#end - -# features -#foreach( $feature in $features ) -#if( ${feature.auto} ) -${feature.varName}=auto -#end -#end +#set( $D = '$' ) +#[[ +# some utility functions +isplatform() +{ + for p in $PLATFORM + do + if [ "$p" = "$1" ]; then + return 0 + fi + done + return 1 +} +notisplatform() +{ + for p in $PLATFORM + do + if [ "$p" = "$1" ]; then + return 1 + fi + done + return 0 +} +istoolchain() +{ + for t in $TOOLCHAIN + do + if [ "$t" = "$1" ]; then + return 0 + fi + done + return 1 +} +notistoolchain() +{ + for t in $TOOLCHAIN + do + if [ "$t" = "$1" ]; then + return 1 + fi + done + return 0 +} # clean abort abort_configure() @@ -55,6 +51,36 @@ abort_configure() exit 1 } +# Test for availability of pkg-config +PKG_CONFIG=`command -v pkg-config` +: ${PKG_CONFIG:="false"} + +# Simple uname based platform detection +# $PLATFORM is used for platform dependent dependency selection +OS=`uname -s` +OS_VERSION=`uname -r` +printf "detect platform... " +if [ "$OS" = "SunOS" ]; then + PLATFORM="solaris sunos unix svr4" +elif [ "$OS" = "Linux" ]; then + PLATFORM="linux unix" +elif [ "$OS" = "FreeBSD" ]; then + PLATFORM="freebsd bsd unix" +elif [ "$OS" = "OpenBSD" ]; then + PLATFORM="openbsd bsd unix" +elif [ "$OS" = "NetBSD" ]; then + PLATFORM="netbsd bsd unix" +elif [ "$OS" = "Darwin" ]; then + PLATFORM="macos osx bsd unix" +elif echo "$OS" | grep -i "MINGW" > /dev/null; then + PLATFORM="windows mingw" +fi +: ${PLATFORM:="unix"} + +PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -` +echo "$PLATFORM_NAME" +]]# + # help text printhelp() { @@ -62,7 +88,7 @@ printhelp() cat << __EOF__ Installation directories: --prefix=PREFIX path prefix for architecture-independent files - [/usr] + [${D}prefix] --exec-prefix=EPREFIX path prefix for architecture-dependent files [PREFIX] @@ -81,30 +107,90 @@ Installation directories: --mandir=DIR man documentation [DATAROOTDIR/man] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] -#if( $options.size() > 0 ) -Options: +Build Types: --debug add extra compile flags for debug builds --release add extra compile flags for release builds +#if( $options.size() > 0 ) + +Options: #foreach( $opt in $options ) --${opt.argument}=${opt.valuesString} #end - #end #if( $features.size() > 0 ) + Optional Features: #foreach( $feature in $features ) ${feature.helpText} #end - #end + __EOF__ } +# create temporary directory +TEMP_DIR=".tmp-`uname -n`" +rm -Rf "$TEMP_DIR" +if mkdir -p "$TEMP_DIR"; then + : +else + echo "Cannot create tmp dir $TEMP_DIR" + echo "Abort" + exit 1 +fi +touch "$TEMP_DIR/options" +touch "$TEMP_DIR/features" + +# define standard variables +# also define standard prefix (this is where we will search for config.site) +prefix=/usr +exec_prefix= +bindir= +sbindir= +libdir= +libexecdir= +datarootdir= +datadir= +sysconfdir= +sharedstatedir= +localstatedir= +runstatedir= +includedir= +infodir= +localedir= +mandir= + +# custom variables +#foreach( $cfg in $config ) +if true \ +#if( $cfg.platform ) + && isplatform "${cfg.platform}" \ +#end +#foreach( $np in $cfg.notList ) + && notisplatform "${np}" \ +#end + ; then + #foreach( $var in $cfg.vars ) + #if( $var.exec ) + ${var.varName}=`${var.value}` + #else + ${var.varName}="${var.value}" + #end + #end +fi +#end + +# features +#foreach( $feature in $features ) +#if( ${feature.auto} ) +${feature.varName}=auto +#end +#end + # # parse arguments # BUILD_TYPE="default" -#set( $D = '$' ) for ARG in "$@" do case "$ARG" in @@ -123,11 +209,12 @@ do "--infodir="*) infodir=${D}{ARG#--infodir=} ;; "--mandir"*) mandir=${D}{ARG#--mandir} ;; "--localedir"*) localedir=${D}{ARG#--localedir} ;; - "--help"*) printhelp; abort_configure ;; - "--debug") BUILD_TYPE="debug" ;; - "--release") BUILD_TYPE="release" ;; + "--help"*) printhelp; abort_configure ;; + "--debug") BUILD_TYPE="debug" ;; + "--release") BUILD_TYPE="release" ;; #foreach( $opt in $options ) "--${opt.argument}="*) ${opt.varName}=${D}{ARG#--${opt.argument}=} ;; + "--${opt.argument}") echo "option '$ARG' needs a value:"; echo " $ARG=${opt.valuesString}"; abort_configure ;; #end #foreach( $feature in $features ) "--enable-${feature.arg}") ${feature.varName}=on ;; @@ -157,6 +244,22 @@ done : ${mandir:='${datarootdir}/man'} : ${localedir:='${datarootdir}/locale'} +# remember the above values and compare them later +orig_bindir="$bindir" +orig_sbindir="$sbindir" +orig_libdir="$libdir" +orig_libexecdir="$libexecdir" +orig_datarootdir="$datarootdir" +orig_datadir="$datadir" +orig_sysconfdir="$sysconfdir" +orig_sharedstatedir="$sharedstatedir" +orig_localstatedir="$localstatedir" +orig_runstatedir="$runstatedir" +orig_includedir="$includedir" +orig_infodir="$infodir" +orig_mandir="$mandir" +orig_localedir="$localedir" + # check if a config.site exists and load it if [ -n "$CONFIG_SITE" ]; then # CONFIG_SITE may contain space separated file names @@ -174,76 +277,6 @@ elif [ -f "$prefix/etc/config.site" ]; then . "$prefix/etc/config.site" echo ok fi - -# Test for availability of pkg-config -PKG_CONFIG=`command -v pkg-config` -: ${PKG_CONFIG:="false"} - -# Simple uname based platform detection -# $PLATFORM is used for platform dependent dependency selection -OS=`uname -s` -OS_VERSION=`uname -r` -printf "detect platform... " -if [ "$OS" = "SunOS" ]; then - PLATFORM="solaris sunos unix svr4" -elif [ "$OS" = "Linux" ]; then - PLATFORM="linux unix" -elif [ "$OS" = "FreeBSD" ]; then - PLATFORM="freebsd bsd unix" -elif [ "$OS" = "OpenBSD" ]; then - PLATFORM="openbsd bsd unix" -elif [ "$OS" = "NetBSD" ]; then - PLATFORM="netbsd bsd unix" -elif [ "$OS" = "Darwin" ]; then - PLATFORM="macos osx bsd unix" -elif echo "$OS" | grep -i "MINGW" > /dev/null; then - PLATFORM="windows mingw" -fi -: ${PLATFORM:="unix"} - -PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -` -echo "$PLATFORM_NAME" - -isplatform() -{ - for p in $PLATFORM - do - if [ "$p" = "$1" ]; then - return 0 - fi - done - return 1 -} -notisplatform() -{ - for p in $PLATFORM - do - if [ "$p" = "$1" ]; then - return 1 - fi - done - return 0 -} -istoolchain() -{ - for t in $TOOLCHAIN - do - if [ "$t" = "$1" ]; then - return 0 - fi - done - return 1 -} -notistoolchain() -{ - for t in $TOOLCHAIN - do - if [ "$t" = "$1" ]; then - return 1 - fi - done - return 0 -} ]]# ## End of unparsed content ** @@ -394,9 +427,9 @@ DEPENDENCIES_FAILED= ERROR=0 #if( $dependencies.size() > 0 ) # unnamed dependencies -TEMP_CFLAGS= -TEMP_CXXFLAGS= -TEMP_LDFLAGS= +TEMP_CFLAGS="$CFLAGS" +TEMP_CXXFLAGS="$CXXFLAGS" +TEMP_LDFLAGS="$LDFLAGS" #foreach( $dependency in $dependencies ) while true do @@ -468,6 +501,16 @@ __EOF__ done #end +# build type +if [ "$BUILD_TYPE" = "debug" ]; then + TEMP_CFLAGS="\${DEBUG_CC_FLAGS} $TEMP_CFLAGS" + TEMP_CXXFLAGS="\${DEBUG_CXX_FLAGS} $TEMP_CXXFLAGS" +fi +if [ "$BUILD_TYPE" = "release" ]; then + TEMP_CFLAGS="\${RELEASE_CC_FLAGS} $TEMP_CFLAGS" + TEMP_CXXFLAGS="\${RELEASE_CXX_FLAGS} $TEMP_CXXFLAGS" +fi + # add general dependency flags to flags.mk echo "# general flags" >> "$TEMP_DIR/flags.mk" if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then @@ -554,6 +597,35 @@ if [ -n "${D}${feature.varName}" ]; then unset ${feature.varName} fi fi +if [ -n "${D}${feature.varName}" ]; then + : +#foreach( $def in $feature.defines ) + TEMP_CFLAGS="$TEMP_CFLAGS ${def.toFlags()}" + TEMP_CXXFLAGS="$TEMP_CXXFLAGS ${def.toFlags()}" +#end +#if( $feature.hasMake() ) + cat >> "$TEMP_DIR/make.mk" << __EOF__ +$feature.make +__EOF__ +#end +else + : +#foreach( $def in $feature.disabled.defines ) + TEMP_CFLAGS="$TEMP_CFLAGS ${def.toFlags()}" + TEMP_CXXFLAGS="$TEMP_CXXFLAGS ${def.toFlags()}" +#end +#if( $feature.disabled.hasMake() ) + cat >> "$TEMP_DIR/make.mk" << __EOF__ +$feature.disabled.make +__EOF__ +#end +#foreach( $dependency in $feature.disabled.dependencies ) + if dependency_error_$dependency ; then + DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " + ERROR=1 + fi +#end +fi #end #foreach( $opt in $target.options ) @@ -600,6 +672,11 @@ else DEPENDENCIES_FAILED="option '${opt.argument}' $DEPENDENCIES_FAILED" fi #end + else + echo + echo "Invalid option value - usage:" + echo " --${opt.argument}=${opt.valuesString}" + abort_configure fi fi #end @@ -610,22 +687,6 @@ fi if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then echo "${target.cxxFlags} += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" fi -if [ "$BUILD_TYPE" = "debug" ]; then - if [ -n "$lang_c" ]; then - echo '${target.cFlags} += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" - fi - if [ -n "$lang_cpp" ]; then - echo '${target.cxxFlags} += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" - fi -fi -if [ "$BUILD_TYPE" = "release" ]; then - if [ -n "$lang_c" ]; then - echo '${target.cFlags} += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" - fi - if [ -n "$lang_cpp" ]; then - echo '${target.cxxFlags} += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" - fi -fi if [ -n "${TEMP_LDFLAGS}" ]; then echo "${target.ldFlags} += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" fi @@ -642,14 +703,73 @@ fi echo "configure finished" echo +echo "Toolchain" +echo " name: $TOOLCHAIN_NAME" +if [ -n "$TOOLCHAIN_CC" ]; then + echo " cc: $TOOLCHAIN_CC" +fi +if [ -n "$TOOLCHAIN_CXX" ]; then + echo " cxx: $TOOLCHAIN_CXX" +fi +if [ -n "$TOOLCHAIN_WSIZE" ]; then + echo " word size: $TOOLCHAIN_WSIZE bit" +fi +if [ -n "$TOOLCHAIN_CSTD" ]; then + echo " default C std: $TOOLCHAIN_CSTD" +fi +echo echo "Build Config:" -echo " PREFIX: $prefix" -echo " TOOLCHAIN: $TOOLCHAIN_NAME" +echo " prefix: $prefix" +echo " exec_prefix: $exec_prefix" +if [ "$orig_bindir" != "$bindir" ]; then + echo " bindir: $bindir" +fi +if [ "$orig_sbindir" != "$sbindir" ]; then + echo " sbindir: $sbindir" +fi +if [ "$orig_libdir" != "$libdir" ]; then + echo " libdir: $libdir" +fi +if [ "$orig_libexecdir" != "$libexecdir" ]; then + echo " libexecdir: $libexecdir" +fi +if [ "$orig_datarootdir" != "$datarootdir" ]; then + echo " datarootdir: $datarootdir" +fi +if [ "$orig_datadir" != "$datadir" ]; then + echo " datadir: $datadir" +fi +if [ "$orig_sysconfdir" != "$sysconfdir" ]; then + echo " sysconfdir: $sysconfdir" +fi +if [ "$orig_sharedstatedir" != "$sharedstatedir" ]; then + echo " sharedstatedir: $sharedstatedir" +fi +if [ "$orig_localstatedir" != "$localstatedir" ]; then + echo " localstatedir: $localstatedir" +fi +if [ "$orig_runstatedir" != "$runstatedir" ]; then + echo " runstatedir: $runstatedir" +fi +if [ "$orig_includedir" != "$includedir" ]; then + echo " includedir: $includedir" +fi +if [ "$orig_infodir" != "$infodir" ]; then + echo " infodir: $infodir" +fi +if [ "$orig_mandir" != "$mandir" ]; then + echo " mandir: $mandir" +fi +if [ "$orig_localedir" != "$localedir" ]; then + echo " localedir: $localedir" +fi #if ( $options.size() > 0 ) +echo echo "Options:" cat "$TEMP_DIR/options" #end #if ( $features.size() > 0 ) +echo echo "Features:" #foreach( $feature in $features ) if [ -n "${D}${feature.varName}" ]; then @@ -662,12 +782,15 @@ fi echo # generate the config.mk file +pwd=`pwd` cat > "$TEMP_DIR/config.mk" << __EOF__ # -# config.mk generated by configure +# config.mk generated by: +# pwd: $pwd +# $0 $@ # __EOF__ write_toolchain_defaults "$TEMP_DIR/toolchain.mk" -cat "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk +cat "$TEMP_DIR/config.mk" "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk rm -Rf "$TEMP_DIR" diff --git a/make/gcc.mk b/make/gcc.mk index 5eea8e1..e2f2940 100644 --- a/make/gcc.mk +++ b/make/gcc.mk @@ -4,10 +4,10 @@ CFLAGS = CXXFLAGS = -DEBUG_CC_FLAGS = -g -DEBUG_CXX_FLAGS = -g -RELEASE_CC_FLAGS = -O3 -DNDEBUG -RELEASE_CXX_FLAGS = -O3 -DNDEBUG +DEBUG_CFLAGS = -g +DEBUG_CXXFLAGS = -g +RELEASE_CFLAGS = -O3 -DNDEBUG +RELEASE_CXXFLAGS = -O3 -DNDEBUG LDFLAGS = SHLIB_CFLAGS = -fPIC diff --git a/make/project.xml b/make/project.xml index 178a724..dda4003 100644 --- a/make/project.xml +++ b/make/project.xml @@ -1,5 +1,5 @@ - + c -lpthread diff --git a/make/suncc.mk b/make/suncc.mk index 38cbb87..8b941d2 100644 --- a/make/suncc.mk +++ b/make/suncc.mk @@ -4,10 +4,10 @@ CFLAGS = CXXFLAGS = -DEBUG_CC_FLAGS = -g -DEBUG_CXX_FLAGS = -g -RELEASE_CC_FLAGS = -O3 -DNDEBUG -RELEASE_CXX_FLAGS = -O3 -DNDEBUG +DEBUG_CFLAGS = -g +DEBUG_CXXFLAGS = -g +RELEASE_CFLAGS = -O3 -DNDEBUG +RELEASE_CXXFLAGS = -O3 -DNDEBUG LDFLAGS = SHLIB_CFLAGS = -Kpic diff --git a/make/toolchain.sh b/make/toolchain.sh index ac5fb68..e68fcc7 100644 --- a/make/toolchain.sh +++ b/make/toolchain.sh @@ -17,20 +17,28 @@ unset TOOLCHAIN_CXX check_c_compiler() { + command -v $1 2>&1 >/dev/null + if [ $? -ne 0 ]; then + return 1 + fi cat > "$TEMP_DIR/test.c" << __EOF__ /* test file */ #include int main(int argc, char **argv) { #if defined(_MSC_VER) - printf("msc\n"); + printf("toolchain:msc\n"); #elif defined(__clang__) - printf("clang gnuc\n"); + printf("toolchain:clang gnuc\n"); #elif defined(__GNUC__) - printf("gcc gnuc\n"); + printf("toolchain:gcc gnuc\n"); #elif defined(__sun) - printf("suncc\n"); + printf("toolchain:suncc\n"); #else - printf("unknown\n"); + printf("toolchain:unknown\n"); +#endif + printf("wsize:%d\n", (int)sizeof(void*)*8); +#ifdef __STDC_VERSION__ + printf("stdcversion:%d\n", __STDC_VERSION__); #endif return 0; } @@ -41,21 +49,26 @@ __EOF__ check_cpp_compiler() { + command -v $1 2>&1 >/dev/null + if [ $? -ne 0 ]; then + return 1 + fi cat > "$TEMP_DIR/test.cpp" << __EOF__ /* test file */ #include int main(int argc, char **argv) { #if defined(_MSC_VER) - std::cout << "msc" << std::endl; + std::cout << "toolchain:msc" << std::endl; #elif defined(__clang__) - std::cout << "clang gnuc" << std::endl; + std::cout << "toolchain:clang gnuc" << std::endl; #elif defined(__GNUC__) - std::cout << "gcc gnuc" << std::endl; + std::cout << "toolchain:gcc gnuc" << std::endl; #elif defined(__sun) - std::cout << "suncc" << std::endl; + std::cout << "toolchain:suncc" << std::endl; #else - std::cout << "cc" << std::endl; + std::cout << "toolchain:unknown" << std::endl; #endif + std::cout << "wsize:" << sizeof(void*)*8 << std::endl; return 0; } __EOF__ @@ -113,6 +126,14 @@ check_lib() fi } +parse_toolchain_properties() +{ + info_file="$1" + TOOLCHAIN=`grep '^toolchain:' "$info_file" | tail -c +11` + TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` + TOOLCHAIN_WSIZE=`grep '^wsize:' "$info_file" | tail -c +7` +} + detect_c_compiler() { if [ -n "$TOOLCHAIN_CC" ]; then @@ -122,8 +143,9 @@ detect_c_compiler() if [ -n "$CC" ]; then if check_c_compiler "$CC"; then TOOLCHAIN_CC=$CC - TOOLCHAIN=`"$TEMP_DIR/checkcc"` - TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` + "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out" + parse_toolchain_properties "$TEMP_DIR/checkcc_out" + TOOLCHAIN_CSTD=`grep '^stdcversion:' "$TEMP_DIR/checkcc_out" | tail -c +13` echo "$CC" return 0 else @@ -135,8 +157,9 @@ detect_c_compiler() do if check_c_compiler "$COMP"; then TOOLCHAIN_CC=$COMP - TOOLCHAIN=`"$TEMP_DIR/checkcc"` - TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` + "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out" + parse_toolchain_properties "$TEMP_DIR/checkcc_out" + TOOLCHAIN_CSTD=`grep '^stdcversion:' "$TEMP_DIR/checkcc_out" | tail -c +13` echo "$COMP" return 0 fi @@ -156,8 +179,8 @@ detect_cpp_compiler() if [ -n "$CXX" ]; then if check_cpp_compiler "$CXX"; then TOOLCHAIN_CXX=$CXX - TOOLCHAIN=`"$TEMP_DIR/checkcc"` - TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` + "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out" + parse_toolchain_properties "$TEMP_DIR/checkcc_out" echo "$CXX" return 0 else @@ -169,8 +192,8 @@ detect_cpp_compiler() do if check_cpp_compiler "$COMP"; then TOOLCHAIN_CXX=$COMP - TOOLCHAIN=`"$TEMP_DIR/checkcc"` - TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` + "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out" + parse_toolchain_properties "$TEMP_DIR/checkcc_out" echo "$COMP" return 0 fi diff --git a/make/uwproj.xsd b/make/uwproj.xsd index f702701..a62ddb2 100644 --- a/make/uwproj.xsd +++ b/make/uwproj.xsd @@ -3,7 +3,7 @@ xmlns="http://unixwork.de/uwproj" targetNamespace="http://unixwork.de/uwproj" elementFormDefault="qualified" - version="0.2" + version="0.3" > @@ -17,22 +17,33 @@ - + + - The configuration section. - Consists of an arbitrary number of var elements. +

+ The configuration section. + Consists of an arbitrary number of var elements. +

+

+ The optional platform attribute may specify a single platform identifier and + the optional not attribute may specify a comma-separated list of platform identifiers. + The configure script shall skip this config declaration if the detected platform is not matching + the filter specification of these attributes. +

+ +
@@ -185,6 +196,9 @@ dependencies are satisfied. If a feature is enabled, all define and make definitions are supposed to be applied to the config file. + If a feature is disabled, an optional disabled element may specify which + define and make definitions are supposed to be applied. + There might also be dependencies when the feature is disabled (e.g. specifying a fallback). In case the optional default attribute is set to true, the feature is enabled by default and is supposed to be automatically disabled (without error) when the dependencies are not satisfied. The name that is supposed to be used for the --enable and --disable arguments can be optionally @@ -195,11 +209,18 @@ + + + + + + + + -