Reproducible builds: fixed clang version display

This commit is contained in:
SChernykh
2025-09-22 17:59:30 +02:00
parent a4e1f00993
commit bae7c65126
3 changed files with 19 additions and 1 deletions

View File

@@ -1,3 +1,3 @@
FROM ubuntu:24.04
ADD prepare.sh /
ADD prepare.sh clang_version.patch /
RUN /prepare.sh

View File

@@ -0,0 +1,15 @@
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index cce839295..b87fe998e 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -873,9 +873,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
Builder.defineMacro("__clang_patchlevel__", TOSTR(CLANG_VERSION_PATCHLEVEL));
#undef TOSTR
#undef TOSTR2
- Builder.defineMacro("__clang_version__",
- "\"" CLANG_VERSION_STRING " "
- + getClangFullRepositoryVersion() + "\"");
+ Builder.defineMacro("__clang_version__", "\"" CLANG_VERSION_STRING "\"");
if (LangOpts.GNUCVersion != 0) {
// Major, minor, patch, are given two decimal places each, so 4.2.1 becomes

View File

@@ -145,6 +145,9 @@ cd /root
git clone --depth 1 --branch llvmorg-$CLANG_VERSION https://github.com/llvm/llvm-project.git
cd llvm-project
mv /clang_version.patch .
git apply --verbose --ignore-whitespace clang_version.patch
mkdir build && cd build
cmake -G Ninja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLLVM_ENABLE_PROJECTS="clang;lld;libc" -DCMAKE_BUILD_TYPE=Release -DLLVM_VERSION_SUFFIX="_p2pool" -DLIBC_WNO_ERROR=ON -DLLVM_APPEND_VC_REV=OFF ../llvm
ninja