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.bak
|
||||
autom4te.cache
|
||||
buildinfo.txt
|
||||
compile
|
||||
config.cache
|
||||
config.guess
|
||||
|
||||
@ -2191,3 +2191,30 @@ if(NOT CURL_DISABLE_INSTALL)
|
||||
GROUP_READ GROUP_EXECUTE
|
||||
WORLD_READ WORLD_EXECUTE)
|
||||
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_30_LIBVCXPROJ) $(VC14_30_SRCVCXPROJ)
|
||||
|
||||
DISTCLEANFILES = buildinfo.txt
|
||||
|
||||
bin_SCRIPTS = curl-config
|
||||
|
||||
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 Save build info for test runner to pick up and log
|
||||
|
||||
AC_DEFUN([CURL_GENERATE_BUILDINFO_TXT], [
|
||||
AC_DEFUN([CURL_PREPARE_BUILDINFO], [
|
||||
curl_pflags=""
|
||||
case $host in
|
||||
*-apple-*) curl_pflags="${curl_pflags} APPLE";;
|
||||
@ -1592,22 +1592,19 @@ AC_DEFUN([CURL_GENERATE_BUILDINFO_TXT], [
|
||||
curl_pflags="${curl_pflags} CROSS"
|
||||
fi
|
||||
squeeze curl_pflags
|
||||
cat >./tests/buildinfo.txt <<_EOF
|
||||
[@%:@] This is a generated file. Do not edit.
|
||||
configure.tool: configure
|
||||
configure.args: $ac_configure_args
|
||||
host: $build
|
||||
host.os: $build_os
|
||||
host.cpu: $build_cpu
|
||||
host.vendor: $build_vendor
|
||||
target: $host
|
||||
target.os: $host_os
|
||||
target.cpu: $host_cpu
|
||||
target.vendor: $host_vendor
|
||||
target.flags: $curl_pflags
|
||||
compiler: $compiler_id
|
||||
compiler.version: $compiler_num
|
||||
_EOF
|
||||
curl_buildinfo="
|
||||
buildinfo.configure.tool: configure
|
||||
buildinfo.configure.args: $ac_configure_args
|
||||
buildinfo.host: $build
|
||||
buildinfo.host.cpu: $build_cpu
|
||||
buildinfo.host.os: $build_os
|
||||
buildinfo.target: $host
|
||||
buildinfo.target.cpu: $host_cpu
|
||||
buildinfo.target.os: $host_os
|
||||
buildinfo.target.flags: $curl_pflags
|
||||
buildinfo.compiler: $compiler_id
|
||||
buildinfo.compiler.version: $compiler_ver
|
||||
buildinfo.sysroot: $lt_sysroot"
|
||||
])
|
||||
|
||||
|
||||
|
||||
@ -533,7 +533,7 @@ if test X"$want_werror" = Xyes; then
|
||||
if test "$compiler_num" -ge "500"; then
|
||||
CURL_CFLAG_EXTRAS="$CURL_CFLAG_EXTRAS -pedantic-errors"
|
||||
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"
|
||||
fi
|
||||
fi
|
||||
@ -5250,7 +5250,6 @@ AC_CONFIG_FILES([\
|
||||
AC_OUTPUT
|
||||
|
||||
CURL_GENERATE_CONFIGUREHELP_PM
|
||||
CURL_GENERATE_BUILDINFO_TXT
|
||||
|
||||
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!])
|
||||
done
|
||||
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], [
|
||||
#
|
||||
compiler_id="unknown"
|
||||
compiler_ver=""
|
||||
compiler_num="0"
|
||||
#
|
||||
flags_dbg_yes="unknown"
|
||||
@ -95,13 +96,17 @@ AC_DEFUN([CURL_CHECK_COMPILER_CLANG], [
|
||||
AC_MSG_RESULT([no])
|
||||
compiler_id="CLANG"
|
||||
fi
|
||||
AC_MSG_CHECKING([compiler version])
|
||||
AC_MSG_CHECKING([if compiler is Apple clang])
|
||||
fullclangver=`$CC -v 2>&1 | grep version`
|
||||
if echo $fullclangver | grep 'Apple' >/dev/null; then
|
||||
AC_MSG_RESULT([yes])
|
||||
appleclang=1
|
||||
compiler_id="APPLECLANG"
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
appleclang=0
|
||||
fi
|
||||
AC_MSG_CHECKING([compiler version])
|
||||
clangver=`echo $fullclangver | grep "based on LLVM " | "$SED" 's/.*(based on LLVM \(@<:@0-9@:>@*\.@<:@0-9@:>@*\).*)/\1/'`
|
||||
if test -z "$clangver"; then
|
||||
clangver=`echo $fullclangver | "$SED" 's/.*version \(@<:@0-9@:>@*\.@<:@0-9@:>@*\).*/\1/'`
|
||||
@ -111,6 +116,7 @@ AC_DEFUN([CURL_CHECK_COMPILER_CLANG], [
|
||||
fi
|
||||
clangvhi=`echo $clangver | cut -d . -f1`
|
||||
clangvlo=`echo $clangver | cut -d . -f2`
|
||||
compiler_ver="$clangver"
|
||||
compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null`
|
||||
if test "$appleclang" = '1' && test "$oldapple" = '0'; then
|
||||
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
|
||||
gccvlo="0"
|
||||
fi
|
||||
compiler_ver="$gccver"
|
||||
compiler_num=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null`
|
||||
AC_MSG_RESULT([gcc '$compiler_num' (raw: '$gccver')])
|
||||
flags_dbg_yes="-g"
|
||||
@ -264,6 +271,7 @@ AC_DEFUN([CURL_CHECK_COMPILER_INTEL_C], [
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_MSG_CHECKING([compiler version])
|
||||
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'])
|
||||
CURL_CHECK_DEF([__unix__], [], [silent])
|
||||
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_MSG_CHECKING([convert -I options to -isystem])
|
||||
if test "$compiler_id" = "GNU_C" ||
|
||||
test "$compiler_id" = "CLANG"; then
|
||||
test "$compiler_id" = "CLANG" -o "$compiler_id" = "APPLECLANG"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
tmp_has_include="no"
|
||||
tmp_chg_FLAGS="$CFLAGS"
|
||||
@ -513,7 +521,7 @@ AC_DEFUN([CURL_SET_COMPILER_BASIC_OPTS], [
|
||||
#
|
||||
case "$compiler_id" in
|
||||
#
|
||||
CLANG)
|
||||
CLANG|APPLECLANG)
|
||||
#
|
||||
dnl Disable warnings for unused arguments, otherwise clang will
|
||||
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
|
||||
#
|
||||
CLANG)
|
||||
CLANG|APPLECLANG)
|
||||
#
|
||||
if test "$want_warnings" = "yes"; then
|
||||
tmp_CFLAGS="$tmp_CFLAGS -pedantic"
|
||||
@ -1370,7 +1378,7 @@ AC_DEFUN([CURL_CHECK_COMPILER_SYMBOL_HIDING], [
|
||||
tmp_CFLAGS=""
|
||||
tmp_EXTERN=""
|
||||
case "$compiler_id" in
|
||||
CLANG)
|
||||
CLANG|APPLECLANG)
|
||||
dnl All versions of clang support -fvisibility=
|
||||
tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))"
|
||||
tmp_CFLAGS="-fvisibility=hidden"
|
||||
|
||||
1
tests/.gitignore
vendored
1
tests/.gitignore
vendored
@ -4,7 +4,6 @@
|
||||
|
||||
*pid
|
||||
*.1.dist
|
||||
buildinfo.txt
|
||||
configurehelp.pm
|
||||
curl_client_key
|
||||
curl_client_key.pub
|
||||
|
||||
@ -94,25 +94,6 @@ use vars qw(
|
||||
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-am "-a -am")
|
||||
add_runtests(test-full "-a -p -r")
|
||||
|
||||
@ -2598,11 +2598,11 @@ if(!$listonly) {
|
||||
# Output information about the curl build
|
||||
#
|
||||
if(!$listonly) {
|
||||
if(open(my $fd, "<", "buildinfo.txt")) {
|
||||
if(open(my $fd, "<", "../buildinfo.txt")) {
|
||||
while(my $line = <$fd>) {
|
||||
chomp $line;
|
||||
if($line && $line !~ /^#/) {
|
||||
logmsg("* buildinfo.$line\n");
|
||||
logmsg("* $line\n");
|
||||
}
|
||||
}
|
||||
close($fd);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user