# HG changeset patch
# User Mike Becker
# Date 1705762924 -3600
# Node ID b0c4750cecd8dabcbe09039dbfaf7273e30771ea
# Parent 5f9e07d3dd6cf631eb45dedf947dfee363e64bde
update uwproj and check toolchain dependency for coverage flags - fixes #345
diff -r 5f9e07d3dd6c -r b0c4750cecd8 configure
--- a/configure Wed Jan 17 21:01:50 2024 +0100
+++ b/configure Sat Jan 20 16:02:04 2024 +0100
@@ -163,17 +163,17 @@
printf "detect platform... "
if [ "$OS" = "SunOS" ]; then
PLATFORM="solaris sunos unix svr4"
-fi
-if [ "$OS" = "Linux" ]; then
+elif [ "$OS" = "Linux" ]; then
PLATFORM="linux unix"
-fi
-if [ "$OS" = "FreeBSD" ]; then
+elif [ "$OS" = "FreeBSD" ]; then
PLATFORM="freebsd bsd unix"
-fi
-if [ "$OS" = "Darwin" ]; then
+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"
-fi
-if echo "$OS" | grep -i "MINGW" > /dev/null; then
+elif echo "$OS" | grep -i "MINGW" > /dev/null; then
PLATFORM="windows mingw"
fi
: ${PLATFORM:="unix"}
@@ -201,6 +201,26 @@
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
@@ -267,9 +287,12 @@
dependency_error_coverage()
{
print_check_msg "$dep_checked_coverage" "checking for coverage... "
- # dependency coverage
+ # dependency coverage toolchain="gnuc"
while true
do
+ if notistoolchain "gnuc"; then
+ break
+ fi
TEMP_CFLAGS="$TEMP_CFLAGS \${COVERAGE_CFLAGS}"
TEMP_LDFLAGS="$TEMP_LDFLAGS \${COVERAGE_LDFLAGS}"
print_check_msg "$dep_checked_coverage" "yes\n"
@@ -453,10 +476,10 @@
# add general dependency flags to flags.mk
echo "# general flags" >> "$TEMP_DIR/flags.mk"
-if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
+if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then
echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
fi
-if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
+if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then
echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
fi
if [ -n "${TEMP_LDFLAGS}" ]; then
@@ -639,10 +662,10 @@
fi
fi
-if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
+if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then
echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
fi
-if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
+if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then
echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
fi
if [ "$BUILD_TYPE" = "debug" ]; then
@@ -699,6 +722,3 @@
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
rm -Rf "$TEMP_DIR"
-
-
-
diff -r 5f9e07d3dd6c -r b0c4750cecd8 make/cc.mk
--- a/make/cc.mk Wed Jan 17 21:01:50 2024 +0100
+++ b/make/cc.mk Sat Jan 20 16:02:04 2024 +0100
@@ -9,6 +9,3 @@
SHLIB_CFLAGS = -fPIC
SHLIB_LDFLAGS = -shared
-
-COVERAGE_CFLAGS =
-COVERAGE_LDFLAGS =
diff -r 5f9e07d3dd6c -r b0c4750cecd8 make/configure.vm
--- a/make/configure.vm Wed Jan 17 21:01:50 2024 +0100
+++ b/make/configure.vm Sat Jan 20 16:02:04 2024 +0100
@@ -93,11 +93,7 @@
#if( $features.size() > 0 )
Optional Features:
#foreach( $feature in $features )
-#if( $feature.auto )
- --disable-${feature.arg}
-#else
- --enable-${feature.arg}
-#end
+${feature.helpText}
#end
#end
@@ -190,17 +186,17 @@
printf "detect platform... "
if [ "$OS" = "SunOS" ]; then
PLATFORM="solaris sunos unix svr4"
-fi
-if [ "$OS" = "Linux" ]; then
+elif [ "$OS" = "Linux" ]; then
PLATFORM="linux unix"
-fi
-if [ "$OS" = "FreeBSD" ]; then
+elif [ "$OS" = "FreeBSD" ]; then
PLATFORM="freebsd bsd unix"
-fi
-if [ "$OS" = "Darwin" ]; then
+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"
-fi
-if echo "$OS" | grep -i "MINGW" > /dev/null; then
+elif echo "$OS" | grep -i "MINGW" > /dev/null; then
PLATFORM="windows mingw"
fi
: ${PLATFORM:="unix"}
@@ -228,6 +224,26 @@
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 **
@@ -307,8 +323,13 @@
break
fi
#end
+ #if( $sub.toolchain )
+ if notistoolchain "${sub.toolchain}"; then
+ break
+ fi
+ #end
#foreach( $np in $sub.notList )
- if isplatform "${np}"; then
+ if isplatform "${np}" || istoolchain "${np}"; then
break
fi
#end
@@ -384,8 +405,13 @@
break
fi
#end
+ #if( $dependency.toolchain )
+ if notistoolchain "${dependency.toolchain}"; then
+ break
+ fi
+ #end
#foreach( $np in $dependency.notList )
- if isplatform "${np}"; then
+ if isplatform "${np}" || istoolchain "${np}"; then
break
fi
#end
@@ -444,10 +470,10 @@
# add general dependency flags to flags.mk
echo "# general flags" >> "$TEMP_DIR/flags.mk"
-if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
+if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then
echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
fi
-if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
+if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then
echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
fi
if [ -n "${TEMP_LDFLAGS}" ]; then
@@ -578,10 +604,10 @@
fi
#end
-if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
+if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then
echo "${target.cFlags} += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
fi
-if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
+if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then
echo "${target.cxxFlags} += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
fi
if [ "$BUILD_TYPE" = "debug" ]; then
@@ -645,6 +671,3 @@
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
rm -Rf "$TEMP_DIR"
-
-
-
diff -r 5f9e07d3dd6c -r b0c4750cecd8 make/project.xml
--- a/make/project.xml Wed Jan 17 21:01:50 2024 +0100
+++ b/make/project.xml Sat Jan 20 16:02:04 2024 +0100
@@ -69,7 +69,7 @@
test -n "$PANDOC"
-
+
\${COVERAGE_CFLAGS}
\${COVERAGE_LDFLAGS}
diff -r 5f9e07d3dd6c -r b0c4750cecd8 make/suncc.mk
--- a/make/suncc.mk Wed Jan 17 21:01:50 2024 +0100
+++ b/make/suncc.mk Sat Jan 20 16:02:04 2024 +0100
@@ -9,6 +9,3 @@
SHLIB_CFLAGS = -Kpic
SHLIB_LDFLAGS = -G
-
-COVERAGE_CFLAGS =
-COVERAGE_LDFLAGS =
diff -r 5f9e07d3dd6c -r b0c4750cecd8 make/toolchain.sh
--- a/make/toolchain.sh Wed Jan 17 21:01:50 2024 +0100
+++ b/make/toolchain.sh Sat Jan 20 16:02:04 2024 +0100
@@ -3,64 +3,74 @@
# toolchain detection
#
-C_COMPILERS="gcc clang suncc cc"
-CPP_COMPILERS="g++ clang++ sunCC CC"
+if isplatform "bsd" && notisplatform "openbsd"; then
+ C_COMPILERS="clang gcc cc"
+ CPP_COMPILERS="clang++ g++ CC"
+else
+ C_COMPILERS="gcc clang suncc cc"
+ CPP_COMPILERS="g++ clang++ sunCC CC"
+fi
+unset TOOLCHAIN
unset TOOLCHAIN_NAME
unset TOOLCHAIN_CC
unset TOOLCHAIN_CXX
check_c_compiler()
{
- cat > "$TEMP_DIR/test.c" << __EOF__
+ cat > "$TEMP_DIR/test.c" << __EOF__
/* test file */
#include
int main(int argc, char **argv) {
-#if defined(__clang__)
- printf("clang\n");
+#if defined(_MSC_VER)
+ printf("msc\n");
+#elif defined(__clang__)
+ printf("clang gnuc\n");
#elif defined(__GNUC__)
- printf("gcc\n");
+ printf("gcc gnuc\n");
#elif defined(__sun)
- printf("suncc\n");
+ printf("suncc\n");
#else
- printf("unknown\n");
+ printf("unknown\n");
#endif
- return 0;
+ return 0;
}
__EOF__
- rm -f "$TEMP_DIR/checkcc"
- $1 -o "$TEMP_DIR/checkcc" $CFLAGS $LDFLAGS "$TEMP_DIR/test.c" 2> /dev/null
+ rm -f "$TEMP_DIR/checkcc"
+ $1 -o "$TEMP_DIR/checkcc" $CFLAGS $LDFLAGS "$TEMP_DIR/test.c" 2> /dev/null
}
check_cpp_compiler()
{
- cat > "$TEMP_DIR/test.cpp" << __EOF__
+ cat > "$TEMP_DIR/test.cpp" << __EOF__
/* test file */
#include
int main(int argc, char **argv) {
-#if defined(__clang__)
- std::cout << "clang" << std::endl;
+#if defined(_MSC_VER)
+ std::cout << "msc" << std::endl;
+#elif defined(__clang__)
+ std::cout << "clang gnuc" << std::endl;
#elif defined(__GNUC__)
- std::cout << "gcc" << std::endl;
+ std::cout << "gcc gnuc" << std::endl;
#elif defined(__sun)
- std::cout << "suncc" << std::endl;
+ std::cout << "suncc" << std::endl;
#else
- std::cout << "cc" << std::endl;
+ std::cout << "cc" << std::endl;
#endif
- return 0;
+ return 0;
}
__EOF__
- rm -f "$TEMP_DIR/checkcc"
- $1 -o "$TEMP_DIR/checkcc" $CXXFLAGS $LDFLAGS "$TEMP_DIR/test.cpp" 2> /dev/null
+ rm -f "$TEMP_DIR/checkcc"
+ $1 -o "$TEMP_DIR/checkcc" $CXXFLAGS $LDFLAGS "$TEMP_DIR/test.cpp" 2> /dev/null
}
create_libtest_source()
{
# $1: filename
# $2: optional include
- cat > "$TEMP_DIR/$1" << __EOF__
+ cat > "$TEMP_DIR/$1" << __EOF__
/* libtest file */
int main(int argc, char **argv) {
- return 0;
+ return 0;
}
__EOF__
if [ -n "$2" ]; then
@@ -77,7 +87,7 @@
fi
create_libtest_source "test.c" "$2"
rm -f "$TEMP_DIR/checklib"
- $TOOLCHAIN_CC -o "$TEMP_DIR/checklib" $CFLAGS $LDFLAGS "-l$1" "$TEMP_DIR/test.c" 2> /dev/null
+ $TOOLCHAIN_CC -o "$TEMP_DIR/checklib" $CFLAGS $LDFLAGS "-l$1" "$TEMP_DIR/test.c" 2> /dev/null
}
check_cpp_lib()
@@ -87,20 +97,20 @@
if [ -z "$TOOLCHAIN_CXX" ]; then
return 1
fi
- create_libtest_source "test.cpp" "$2"
+ create_libtest_source "test.cpp" "$2"
rm -f "$TEMP_DIR/checklib"
- $TOOLCHAIN_CXX -o "$TEMP_DIR/checklib" $CXXFLAGS $LDFLAGS "-l$1" "$TEMP_DIR/test.cpp" 2> /dev/null
+ $TOOLCHAIN_CXX -o "$TEMP_DIR/checklib" $CXXFLAGS $LDFLAGS "-l$1" "$TEMP_DIR/test.cpp" 2> /dev/null
}
check_lib()
{
# $1: libname
# $2: optional include
- if [ -n "$TOOLCHAIN_CC" ]; then
- check_c_lib "$1" "$2"
- elif [ -n "$TOOLCHAIN_CXX" ]; then
- check_cpp_lib "$1" "$2"
- fi
+ if [ -n "$TOOLCHAIN_CC" ]; then
+ check_c_lib "$1" "$2"
+ elif [ -n "$TOOLCHAIN_CXX" ]; then
+ check_cpp_lib "$1" "$2"
+ fi
}
detect_c_compiler()
@@ -112,7 +122,8 @@
if [ -n "$CC" ]; then
if check_c_compiler "$CC"; then
TOOLCHAIN_CC=$CC
- TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"`
+ TOOLCHAIN=`"$TEMP_DIR/checkcc"`
+ TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -`
echo "$CC"
return 0
else
@@ -124,7 +135,8 @@
do
if check_c_compiler "$COMP"; then
TOOLCHAIN_CC=$COMP
- TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"`
+ TOOLCHAIN=`"$TEMP_DIR/checkcc"`
+ TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -`
echo "$COMP"
return 0
fi
@@ -144,7 +156,8 @@
if [ -n "$CXX" ]; then
if check_cpp_compiler "$CXX"; then
TOOLCHAIN_CXX=$CXX
- TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"`
+ TOOLCHAIN=`"$TEMP_DIR/checkcc"`
+ TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -`
echo "$CXX"
return 0
else
@@ -156,7 +169,8 @@
do
if check_cpp_compiler "$COMP"; then
TOOLCHAIN_CXX=$COMP
- TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"`
+ TOOLCHAIN=`"$TEMP_DIR/checkcc"`
+ TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -`
echo "$COMP"
return 0
fi
diff -r 5f9e07d3dd6c -r b0c4750cecd8 make/uwproj.xsd
--- a/make/uwproj.xsd Wed Jan 17 21:01:50 2024 +0100
+++ b/make/uwproj.xsd Sat Jan 20 16:02:04 2024 +0100
@@ -3,7 +3,7 @@
xmlns="http://unixwork.de/uwproj"
targetNamespace="http://unixwork.de/uwproj"
elementFormDefault="qualified"
- version="0.1"
+ version="0.2"
>
@@ -102,9 +102,11 @@
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 dependency declaration if the detected platform is not
- matching the filter specification of these attributes.
+ the optional toolchain
attribute may specify a single toolchain.
+ The optional not
attribute may specify a comma-separated list of platform and/or
+ toolchain identifiers.
+ The configure script shall skip this dependency declaration if the detected platform and toolchain
+ is not matching the filter specification of these attributes.
@@ -125,6 +127,7 @@
+
@@ -186,6 +189,8 @@
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
specified with the arg
attribute. Otherwise, the name
is used by default.
+ Optionally, a description for the help text of the resulting configure script can be specified by
+ adding a desc
element.
@@ -194,6 +199,7 @@
+
@@ -278,4 +284,4 @@
-
\ No newline at end of file
+