Mon, 19 May 2025 13:11:23 +0200
add support for wsize in C++ compiler detection
| src/main/resources/make/toolchain.sh | file | annotate | diff | comparison | revisions | |
| test/make/toolchain.sh | file | annotate | diff | comparison | revisions |
--- a/src/main/resources/make/toolchain.sh Mon May 19 13:03:18 2025 +0200 +++ b/src/main/resources/make/toolchain.sh Mon May 19 13:11:23 2025 +0200 @@ -126,6 +126,14 @@ 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 @@ -136,9 +144,7 @@ if check_c_compiler "$CC"; then TOOLCHAIN_CC=$CC "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out" - TOOLCHAIN=`grep '^toolchain:' "$TEMP_DIR/checkcc_out" | tail -c +11` - TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` - TOOLCHAIN_WSIZE=`grep '^wsize:' "$TEMP_DIR/checkcc_out" | tail -c +7` + parse_toolchain_properties "$TEMP_DIR/checkcc_out" TOOLCHAIN_CSTD=`grep '^stdcversion:' "$TEMP_DIR/checkcc_out" | tail -c +13` echo "$CC" return 0 @@ -152,9 +158,7 @@ if check_c_compiler "$COMP"; then TOOLCHAIN_CC=$COMP "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out" - TOOLCHAIN=`grep '^toolchain:' "$TEMP_DIR/checkcc_out" | tail -c +11` - TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` - TOOLCHAIN_WSIZE=`grep '^wsize:' "$TEMP_DIR/checkcc_out" | tail -c +7` + parse_toolchain_properties "$TEMP_DIR/checkcc_out" TOOLCHAIN_CSTD=`grep '^stdcversion:' "$TEMP_DIR/checkcc_out" | tail -c +13` echo "$COMP" return 0 @@ -176,8 +180,7 @@ if check_cpp_compiler "$CXX"; then TOOLCHAIN_CXX=$CXX "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out" - TOOLCHAIN=`grep '^toolchain:' "$TEMP_DIR/checkcc_out" | tail -c +11` - TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` + parse_toolchain_properties "$TEMP_DIR/checkcc_out" echo "$CXX" return 0 else @@ -190,8 +193,7 @@ if check_cpp_compiler "$COMP"; then TOOLCHAIN_CXX=$COMP "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out" - TOOLCHAIN=`grep '^toolchain:' "$TEMP_DIR/checkcc_out" | tail -c +11` - TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` + parse_toolchain_properties "$TEMP_DIR/checkcc_out" echo "$COMP" return 0 fi
--- a/test/make/toolchain.sh Mon May 19 13:03:18 2025 +0200 +++ b/test/make/toolchain.sh Mon May 19 13:11:23 2025 +0200 @@ -126,6 +126,14 @@ 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 @@ -136,9 +144,7 @@ if check_c_compiler "$CC"; then TOOLCHAIN_CC=$CC "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out" - TOOLCHAIN=`grep '^toolchain:' "$TEMP_DIR/checkcc_out" | tail -c +11` - TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` - TOOLCHAIN_WSIZE=`grep '^wsize:' "$TEMP_DIR/checkcc_out" | tail -c +7` + parse_toolchain_properties "$TEMP_DIR/checkcc_out" TOOLCHAIN_CSTD=`grep '^stdcversion:' "$TEMP_DIR/checkcc_out" | tail -c +13` echo "$CC" return 0 @@ -152,9 +158,7 @@ if check_c_compiler "$COMP"; then TOOLCHAIN_CC=$COMP "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out" - TOOLCHAIN=`grep '^toolchain:' "$TEMP_DIR/checkcc_out" | tail -c +11` - TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` - TOOLCHAIN_WSIZE=`grep '^wsize:' "$TEMP_DIR/checkcc_out" | tail -c +7` + parse_toolchain_properties "$TEMP_DIR/checkcc_out" TOOLCHAIN_CSTD=`grep '^stdcversion:' "$TEMP_DIR/checkcc_out" | tail -c +13` echo "$COMP" return 0 @@ -176,8 +180,7 @@ if check_cpp_compiler "$CXX"; then TOOLCHAIN_CXX=$CXX "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out" - TOOLCHAIN=`grep '^toolchain:' "$TEMP_DIR/checkcc_out" | tail -c +11` - TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` + parse_toolchain_properties "$TEMP_DIR/checkcc_out" echo "$CXX" return 0 else @@ -190,8 +193,7 @@ if check_cpp_compiler "$COMP"; then TOOLCHAIN_CXX=$COMP "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out" - TOOLCHAIN=`grep '^toolchain:' "$TEMP_DIR/checkcc_out" | tail -c +11` - TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` + parse_toolchain_properties "$TEMP_DIR/checkcc_out" echo "$COMP" return 0 fi