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:
Viktor Szakats 2024-09-07 02:43:35 +02:00
parent fdb8b40fed
commit 50e2cb5894
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
9 changed files with 67 additions and 47 deletions

1
tests/.gitignore vendored
View file

@ -4,7 +4,6 @@
*pid
*.1.dist
buildinfo.txt
configurehelp.pm
curl_client_key
curl_client_key.pub

View file

@ -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")

View file

@ -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);