build: buildinfo.txt improvements
- cmake: drop `configure.os`.
This also includes OS version, but thus far it's not important enough
to include it.
- autotools: drop redundant, autotools-only `{target|host}.vendor`.
(it's part of the triplet in `{target|host}`.)
- swap order to `*.cpu` -> `*.os` to match triplet-order.
- cmake: drop redundant `target`.
It's manually filled and only in a (so far) few CI jobs. Let's revisit
when this becomes useful.
- move `buildinfo.txt` to build root.
- dist: add `buildinfo.txt` to `DISTCLEANFILES`.
- autotools: detect human readable compiler version.
- autotools: replace `XXYY` `compiler.version` with "X.Y"-style.
(also to match cmake.)
- autotools: use distinct `compiler_id` for Apple clang: `APPLECLANG`.
To match cmake and also because the the "X.Y"-style version number
is the Apple version, while `XXYY` was a value roughly translated to
mainline llvm/clang version.
- show buildinfo at the end of the configure stage, when run in CI, or
when `CURL_BUILDINFO` or `CURL_CI` env is set.
Follow-up to 1fdea16846 #14802
Assisted-by: Dan Fandrich
Ref: https://github.com/curl/curl/pull/14802#issuecomment-2334942991
Closes #14822
This commit is contained in:
parent
fdb8b40fed
commit
50e2cb5894
1
.gitignore
vendored
1
.gitignore
vendored
@ -36,6 +36,7 @@ TAGS
|
|||||||
aclocal.m4
|
aclocal.m4
|
||||||
aclocal.m4.bak
|
aclocal.m4.bak
|
||||||
autom4te.cache
|
autom4te.cache
|
||||||
|
buildinfo.txt
|
||||||
compile
|
compile
|
||||||
config.cache
|
config.cache
|
||||||
config.guess
|
config.guess
|
||||||
|
|||||||
@ -2191,3 +2191,30 @@ if(NOT CURL_DISABLE_INSTALL)
|
|||||||
GROUP_READ GROUP_EXECUTE
|
GROUP_READ GROUP_EXECUTE
|
||||||
WORLD_READ WORLD_EXECUTE)
|
WORLD_READ WORLD_EXECUTE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Save build info for test runner to pick up and log
|
||||||
|
if(CMAKE_OSX_SYSROOT)
|
||||||
|
set(_cmake_sysroot ${CMAKE_OSX_SYSROOT})
|
||||||
|
elseif(CMAKE_SYSROOT)
|
||||||
|
set(_cmake_sysroot ${CMAKE_SYSROOT})
|
||||||
|
endif()
|
||||||
|
set(_buildinfo "\
|
||||||
|
buildinfo.configure.tool: cmake
|
||||||
|
buildinfo.configure.command: ${CMAKE_COMMAND}
|
||||||
|
buildinfo.configure.version: ${CMAKE_VERSION}
|
||||||
|
buildinfo.configure.args:${_cmake_args}
|
||||||
|
buildinfo.configure.generator: ${CMAKE_GENERATOR}
|
||||||
|
buildinfo.configure.make: ${CMAKE_MAKE_PROGRAM}
|
||||||
|
buildinfo.host.cpu: ${CMAKE_HOST_SYSTEM_PROCESSOR}
|
||||||
|
buildinfo.host.os: ${CMAKE_HOST_SYSTEM_NAME}
|
||||||
|
buildinfo.target.cpu: ${CMAKE_SYSTEM_PROCESSOR}
|
||||||
|
buildinfo.target.os: ${CMAKE_SYSTEM_NAME}
|
||||||
|
buildinfo.target.flags:${_target_flags}
|
||||||
|
buildinfo.compiler: ${CMAKE_C_COMPILER_ID}
|
||||||
|
buildinfo.compiler.version: ${CMAKE_C_COMPILER_VERSION}
|
||||||
|
buildinfo.sysroot: ${_cmake_sysroot}
|
||||||
|
")
|
||||||
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/buildinfo.txt" "# This is a generated file. Do not edit.\n${_buildinfo}")
|
||||||
|
if(NOT "$ENV{CURL_BUILDINFO}$ENV{CURL_CI}$ENV{CI}" STREQUAL "")
|
||||||
|
message(STATUS "\n${_buildinfo}")
|
||||||
|
endif()
|
||||||
|
|||||||
@ -91,6 +91,8 @@ CLEANFILES = $(VC14_LIBVCXPROJ) $(VC14_SRCVCXPROJ) \
|
|||||||
$(VC14_20_LIBVCXPROJ) $(VC14_20_SRCVCXPROJ) \
|
$(VC14_20_LIBVCXPROJ) $(VC14_20_SRCVCXPROJ) \
|
||||||
$(VC14_30_LIBVCXPROJ) $(VC14_30_SRCVCXPROJ)
|
$(VC14_30_LIBVCXPROJ) $(VC14_30_SRCVCXPROJ)
|
||||||
|
|
||||||
|
DISTCLEANFILES = buildinfo.txt
|
||||||
|
|
||||||
bin_SCRIPTS = curl-config
|
bin_SCRIPTS = curl-config
|
||||||
|
|
||||||
SUBDIRS = lib docs src scripts
|
SUBDIRS = lib docs src scripts
|
||||||
|
|||||||
33
acinclude.m4
33
acinclude.m4
@ -1559,11 +1559,11 @@ _EOF
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
dnl CURL_GENERATE_BUILDINFO_TXT
|
dnl CURL_PREPARE_BUILDINFO
|
||||||
dnl -------------------------------------------------
|
dnl -------------------------------------------------
|
||||||
dnl Save build info for test runner to pick up and log
|
dnl Save build info for test runner to pick up and log
|
||||||
|
|
||||||
AC_DEFUN([CURL_GENERATE_BUILDINFO_TXT], [
|
AC_DEFUN([CURL_PREPARE_BUILDINFO], [
|
||||||
curl_pflags=""
|
curl_pflags=""
|
||||||
case $host in
|
case $host in
|
||||||
*-apple-*) curl_pflags="${curl_pflags} APPLE";;
|
*-apple-*) curl_pflags="${curl_pflags} APPLE";;
|
||||||
@ -1592,22 +1592,19 @@ AC_DEFUN([CURL_GENERATE_BUILDINFO_TXT], [
|
|||||||
curl_pflags="${curl_pflags} CROSS"
|
curl_pflags="${curl_pflags} CROSS"
|
||||||
fi
|
fi
|
||||||
squeeze curl_pflags
|
squeeze curl_pflags
|
||||||
cat >./tests/buildinfo.txt <<_EOF
|
curl_buildinfo="
|
||||||
[@%:@] This is a generated file. Do not edit.
|
buildinfo.configure.tool: configure
|
||||||
configure.tool: configure
|
buildinfo.configure.args: $ac_configure_args
|
||||||
configure.args: $ac_configure_args
|
buildinfo.host: $build
|
||||||
host: $build
|
buildinfo.host.cpu: $build_cpu
|
||||||
host.os: $build_os
|
buildinfo.host.os: $build_os
|
||||||
host.cpu: $build_cpu
|
buildinfo.target: $host
|
||||||
host.vendor: $build_vendor
|
buildinfo.target.cpu: $host_cpu
|
||||||
target: $host
|
buildinfo.target.os: $host_os
|
||||||
target.os: $host_os
|
buildinfo.target.flags: $curl_pflags
|
||||||
target.cpu: $host_cpu
|
buildinfo.compiler: $compiler_id
|
||||||
target.vendor: $host_vendor
|
buildinfo.compiler.version: $compiler_ver
|
||||||
target.flags: $curl_pflags
|
buildinfo.sysroot: $lt_sysroot"
|
||||||
compiler: $compiler_id
|
|
||||||
compiler.version: $compiler_num
|
|
||||||
_EOF
|
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -533,7 +533,7 @@ if test X"$want_werror" = Xyes; then
|
|||||||
if test "$compiler_num" -ge "500"; then
|
if test "$compiler_num" -ge "500"; then
|
||||||
CURL_CFLAG_EXTRAS="$CURL_CFLAG_EXTRAS -pedantic-errors"
|
CURL_CFLAG_EXTRAS="$CURL_CFLAG_EXTRAS -pedantic-errors"
|
||||||
fi
|
fi
|
||||||
elif test "$compiler_id" = "CLANG"; then
|
elif test "$compiler_id" = "CLANG" -o "$compiler_id" = "APPLECLANG"; then
|
||||||
CURL_CFLAG_EXTRAS="$CURL_CFLAG_EXTRAS -pedantic-errors"
|
CURL_CFLAG_EXTRAS="$CURL_CFLAG_EXTRAS -pedantic-errors"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -5250,7 +5250,6 @@ AC_CONFIG_FILES([\
|
|||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
||||||
CURL_GENERATE_CONFIGUREHELP_PM
|
CURL_GENERATE_CONFIGUREHELP_PM
|
||||||
CURL_GENERATE_BUILDINFO_TXT
|
|
||||||
|
|
||||||
SUPPORT_PROTOCOLS_LOWER=`echo "$SUPPORT_PROTOCOLS" | tr A-Z a-z`
|
SUPPORT_PROTOCOLS_LOWER=`echo "$SUPPORT_PROTOCOLS" | tr A-Z a-z`
|
||||||
|
|
||||||
@ -5318,3 +5317,9 @@ if test -n "$experimental"; then
|
|||||||
AC_MSG_WARN([$a is enabled but marked EXPERIMENTAL. Use with caution!])
|
AC_MSG_WARN([$a is enabled but marked EXPERIMENTAL. Use with caution!])
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CURL_PREPARE_BUILDINFO
|
||||||
|
echo "[@%:@] This is a generated file. Do not edit.${curl_buildinfo}" > ./buildinfo.txt
|
||||||
|
if test -n "$CURL_BUILDINFO$CURL_CI$CI"; then
|
||||||
|
AC_MSG_NOTICE([${curl_buildinfo}])
|
||||||
|
fi
|
||||||
|
|||||||
@ -33,6 +33,7 @@ dnl Verify if the C compiler being used is known.
|
|||||||
AC_DEFUN([CURL_CHECK_COMPILER], [
|
AC_DEFUN([CURL_CHECK_COMPILER], [
|
||||||
#
|
#
|
||||||
compiler_id="unknown"
|
compiler_id="unknown"
|
||||||
|
compiler_ver=""
|
||||||
compiler_num="0"
|
compiler_num="0"
|
||||||
#
|
#
|
||||||
flags_dbg_yes="unknown"
|
flags_dbg_yes="unknown"
|
||||||
@ -95,13 +96,17 @@ AC_DEFUN([CURL_CHECK_COMPILER_CLANG], [
|
|||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
compiler_id="CLANG"
|
compiler_id="CLANG"
|
||||||
fi
|
fi
|
||||||
AC_MSG_CHECKING([compiler version])
|
AC_MSG_CHECKING([if compiler is Apple clang])
|
||||||
fullclangver=`$CC -v 2>&1 | grep version`
|
fullclangver=`$CC -v 2>&1 | grep version`
|
||||||
if echo $fullclangver | grep 'Apple' >/dev/null; then
|
if echo $fullclangver | grep 'Apple' >/dev/null; then
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
appleclang=1
|
appleclang=1
|
||||||
|
compiler_id="APPLECLANG"
|
||||||
else
|
else
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
appleclang=0
|
appleclang=0
|
||||||
fi
|
fi
|
||||||
|
AC_MSG_CHECKING([compiler version])
|
||||||
clangver=`echo $fullclangver | grep "based on LLVM " | "$SED" 's/.*(based on LLVM \(@<:@0-9@:>@*\.@<:@0-9@:>@*\).*)/\1/'`
|
clangver=`echo $fullclangver | grep "based on LLVM " | "$SED" 's/.*(based on LLVM \(@<:@0-9@:>@*\.@<:@0-9@:>@*\).*)/\1/'`
|
||||||
if test -z "$clangver"; then
|
if test -z "$clangver"; then
|
||||||
clangver=`echo $fullclangver | "$SED" 's/.*version \(@<:@0-9@:>@*\.@<:@0-9@:>@*\).*/\1/'`
|
clangver=`echo $fullclangver | "$SED" 's/.*version \(@<:@0-9@:>@*\.@<:@0-9@:>@*\).*/\1/'`
|
||||||
@ -111,6 +116,7 @@ AC_DEFUN([CURL_CHECK_COMPILER_CLANG], [
|
|||||||
fi
|
fi
|
||||||
clangvhi=`echo $clangver | cut -d . -f1`
|
clangvhi=`echo $clangver | cut -d . -f1`
|
||||||
clangvlo=`echo $clangver | cut -d . -f2`
|
clangvlo=`echo $clangver | cut -d . -f2`
|
||||||
|
compiler_ver="$clangver"
|
||||||
compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null`
|
compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null`
|
||||||
if test "$appleclang" = '1' && test "$oldapple" = '0'; then
|
if test "$appleclang" = '1' && test "$oldapple" = '0'; then
|
||||||
dnl Starting with Xcode 7 / clang 3.7, Apple clang won't tell its upstream version
|
dnl Starting with Xcode 7 / clang 3.7, Apple clang won't tell its upstream version
|
||||||
@ -192,6 +198,7 @@ AC_DEFUN([CURL_CHECK_COMPILER_GNU_C], [
|
|||||||
else
|
else
|
||||||
gccvlo="0"
|
gccvlo="0"
|
||||||
fi
|
fi
|
||||||
|
compiler_ver="$gccver"
|
||||||
compiler_num=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null`
|
compiler_num=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null`
|
||||||
AC_MSG_RESULT([gcc '$compiler_num' (raw: '$gccver')])
|
AC_MSG_RESULT([gcc '$compiler_num' (raw: '$gccver')])
|
||||||
flags_dbg_yes="-g"
|
flags_dbg_yes="-g"
|
||||||
@ -264,6 +271,7 @@ AC_DEFUN([CURL_CHECK_COMPILER_INTEL_C], [
|
|||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
AC_MSG_CHECKING([compiler version])
|
AC_MSG_CHECKING([compiler version])
|
||||||
compiler_num="$curl_cv_def___INTEL_COMPILER"
|
compiler_num="$curl_cv_def___INTEL_COMPILER"
|
||||||
|
compiler_ver=`echo "$compiler_num" | cut -c -2 | $SED 's/^0//'`.`echo "$compiler_num" | cut -c 3-4 | $SED 's/^0//'`
|
||||||
AC_MSG_RESULT([Intel C '$compiler_num'])
|
AC_MSG_RESULT([Intel C '$compiler_num'])
|
||||||
CURL_CHECK_DEF([__unix__], [], [silent])
|
CURL_CHECK_DEF([__unix__], [], [silent])
|
||||||
if test "$curl_cv_have_def___unix__" = "yes"; then
|
if test "$curl_cv_have_def___unix__" = "yes"; then
|
||||||
@ -386,7 +394,7 @@ AC_DEFUN([CURL_CONVERT_INCLUDE_TO_ISYSTEM], [
|
|||||||
AC_REQUIRE([CURL_CHECK_COMPILER])dnl
|
AC_REQUIRE([CURL_CHECK_COMPILER])dnl
|
||||||
AC_MSG_CHECKING([convert -I options to -isystem])
|
AC_MSG_CHECKING([convert -I options to -isystem])
|
||||||
if test "$compiler_id" = "GNU_C" ||
|
if test "$compiler_id" = "GNU_C" ||
|
||||||
test "$compiler_id" = "CLANG"; then
|
test "$compiler_id" = "CLANG" -o "$compiler_id" = "APPLECLANG"; then
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
tmp_has_include="no"
|
tmp_has_include="no"
|
||||||
tmp_chg_FLAGS="$CFLAGS"
|
tmp_chg_FLAGS="$CFLAGS"
|
||||||
@ -513,7 +521,7 @@ AC_DEFUN([CURL_SET_COMPILER_BASIC_OPTS], [
|
|||||||
#
|
#
|
||||||
case "$compiler_id" in
|
case "$compiler_id" in
|
||||||
#
|
#
|
||||||
CLANG)
|
CLANG|APPLECLANG)
|
||||||
#
|
#
|
||||||
dnl Disable warnings for unused arguments, otherwise clang will
|
dnl Disable warnings for unused arguments, otherwise clang will
|
||||||
dnl warn about compile-time arguments used during link-time, like
|
dnl warn about compile-time arguments used during link-time, like
|
||||||
@ -782,7 +790,7 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
|
|||||||
#
|
#
|
||||||
case "$compiler_id" in
|
case "$compiler_id" in
|
||||||
#
|
#
|
||||||
CLANG)
|
CLANG|APPLECLANG)
|
||||||
#
|
#
|
||||||
if test "$want_warnings" = "yes"; then
|
if test "$want_warnings" = "yes"; then
|
||||||
tmp_CFLAGS="$tmp_CFLAGS -pedantic"
|
tmp_CFLAGS="$tmp_CFLAGS -pedantic"
|
||||||
@ -1370,7 +1378,7 @@ AC_DEFUN([CURL_CHECK_COMPILER_SYMBOL_HIDING], [
|
|||||||
tmp_CFLAGS=""
|
tmp_CFLAGS=""
|
||||||
tmp_EXTERN=""
|
tmp_EXTERN=""
|
||||||
case "$compiler_id" in
|
case "$compiler_id" in
|
||||||
CLANG)
|
CLANG|APPLECLANG)
|
||||||
dnl All versions of clang support -fvisibility=
|
dnl All versions of clang support -fvisibility=
|
||||||
tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))"
|
tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))"
|
||||||
tmp_CFLAGS="-fvisibility=hidden"
|
tmp_CFLAGS="-fvisibility=hidden"
|
||||||
|
|||||||
1
tests/.gitignore
vendored
1
tests/.gitignore
vendored
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
*pid
|
*pid
|
||||||
*.1.dist
|
*.1.dist
|
||||||
buildinfo.txt
|
|
||||||
configurehelp.pm
|
configurehelp.pm
|
||||||
curl_client_key
|
curl_client_key
|
||||||
curl_client_key.pub
|
curl_client_key.pub
|
||||||
|
|||||||
@ -94,25 +94,6 @@ use vars qw(
|
|||||||
1;
|
1;
|
||||||
")
|
")
|
||||||
|
|
||||||
# Save build info for test runner to pick up and log
|
|
||||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/buildinfo.txt" "# This is a generated file. Do not edit.
|
|
||||||
configure.tool: cmake
|
|
||||||
configure.command: ${CMAKE_COMMAND}
|
|
||||||
configure.version: ${CMAKE_VERSION}
|
|
||||||
configure.os: ${CMAKE_SYSTEM}
|
|
||||||
configure.args:${_cmake_args}
|
|
||||||
configure.generator: ${CMAKE_GENERATOR}
|
|
||||||
configure.make: ${CMAKE_MAKE_PROGRAM}
|
|
||||||
host.os: ${CMAKE_HOST_SYSTEM_NAME}
|
|
||||||
host.cpu: ${CMAKE_HOST_SYSTEM_PROCESSOR}
|
|
||||||
target: ${CMAKE_C_COMPILER_TARGET}
|
|
||||||
target.os: ${CMAKE_SYSTEM_NAME}
|
|
||||||
target.cpu: ${CMAKE_SYSTEM_PROCESSOR}
|
|
||||||
target.flags:${_target_flags}
|
|
||||||
compiler: ${CMAKE_C_COMPILER_ID}
|
|
||||||
compiler.version: ${CMAKE_C_COMPILER_VERSION}
|
|
||||||
")
|
|
||||||
|
|
||||||
add_runtests(test-quiet "-a -s")
|
add_runtests(test-quiet "-a -s")
|
||||||
add_runtests(test-am "-a -am")
|
add_runtests(test-am "-a -am")
|
||||||
add_runtests(test-full "-a -p -r")
|
add_runtests(test-full "-a -p -r")
|
||||||
|
|||||||
@ -2598,11 +2598,11 @@ if(!$listonly) {
|
|||||||
# Output information about the curl build
|
# Output information about the curl build
|
||||||
#
|
#
|
||||||
if(!$listonly) {
|
if(!$listonly) {
|
||||||
if(open(my $fd, "<", "buildinfo.txt")) {
|
if(open(my $fd, "<", "../buildinfo.txt")) {
|
||||||
while(my $line = <$fd>) {
|
while(my $line = <$fd>) {
|
||||||
chomp $line;
|
chomp $line;
|
||||||
if($line && $line !~ /^#/) {
|
if($line && $line !~ /^#/) {
|
||||||
logmsg("* buildinfo.$line\n");
|
logmsg("* $line\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close($fd);
|
close($fd);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user