--- a/make/toolchain.sh Fri May 23 14:00:24 2025 +0200 +++ b/make/toolchain.sh Tue May 27 22:23:06 2025 +0200 @@ -68,7 +68,7 @@ #else std::cout << "toolchain:unknown" << std::endl; #endif - std:cout << "wsize:" << sizeof(void*)*8 << std::endl; + std::cout << "wsize:" << sizeof(void*)*8 << std::endl; return 0; } __EOF__ @@ -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