Ugly workaround to enable scan-build on runtimes debian/patches/use-scan-build-runtimes.diff

This commit is contained in:
Sylvestre Ledru 2022-01-12 13:46:36 +01:00
parent e1e7bfa8a1
commit c06e88525b
3 changed files with 30 additions and 3 deletions

6
debian/changelog vendored
View File

@ -1,8 +1,10 @@
llvm-toolchain-snapshot (1:14~++20220107114130+3a604fdbcd5f-1~exp2) UNRELEASED; urgency=medium
llvm-toolchain-snapshot (1:14~++20220112110040+612f5ed88231-1~exp1) UNRELEASED; urgency=medium
* Remove lldb-instr to match upstream change 4609e30f5001cfcba59d1f2f90ce72ebfda6e61f
* Ugly workaround to enable scan-build on runtimes
debian/patches/use-scan-build-runtimes.diff
-- Sylvestre Ledru <sylvestre@debian.org> Tue, 11 Jan 2022 10:17:57 +0100
-- Sylvestre Ledru <sylvestre@debian.org> Wed, 12 Jan 2022 11:00:59 +0100
llvm-toolchain-snapshot (1:14~++20220107114130+3a604fdbcd5f-1~exp1) experimental; urgency=medium

View File

@ -0,0 +1,17 @@
Index: llvm-toolchain-snapshot_14~++20220105111900+cdbad62c526c/clang/CMakeLists.txt
===================================================================
--- llvm-toolchain-snapshot_14~++20220105111900+cdbad62c526c.orig/clang/CMakeLists.txt
+++ llvm-toolchain-snapshot_14~++20220105111900+cdbad62c526c/clang/CMakeLists.txt
@@ -726,9 +726,9 @@ if (CLANG_ENABLE_BOOTSTRAP)
endif()
set(COMPILER_OPTIONS
- -DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/${CXX_COMPILER}
- -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/${C_COMPILER}
- -DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/${C_COMPILER}
+ -DCMAKE_CXX_COMPILER=/usr/share/clang/scan-build-${LLVM_PACKAGE_VERSION}/libexec/c++-analyzer
+ -DCMAKE_C_COMPILER=/usr/share/clang/scan-build-${LLVM_PACKAGE_VERSION}/libexec/ccc-analyzer
+ -DCMAKE_ASM_COMPILER=/usr/share/clang/scan-build-${LLVM_PACKAGE_VERSION}/libexec/ccc-analyzer
-DCMAKE_ASM_COMPILER_ID=Clang)
# cmake requires CMAKE_LINKER to be specified if the compiler is MSVC-like,

10
debian/rules vendored
View File

@ -285,11 +285,14 @@ ifeq (mipsel,$(DEB_HOST_ARCH))
RUN_TEST=no
endif
SCAN_BUILD=no
ifneq (,$(filter scan-build,$(DEB_BUILD_OPTIONS)))
# enable the build using scan-build
# The package are installed through the variable declarations:
# OTHERMIRROR="deb http://llvm.org/apt/unstable/ llvm-toolchain main"
# EXTRAPACKAGES="clang-X"
SCAN_BUILD=yes
patch -p1 < debian/patches/on-the-fly/use-scan-build-runtimes.diff
PRE_PROCESS=scan-build-$(LLVM_VERSION) --show-description -analyzer-config stable-report-filename=true
# -enable-checker optin.performance.Padding
PRE_PROCESS_CONF=scan-build-$(LLVM_VERSION)
@ -587,7 +590,9 @@ debian-full-build:
# Check the stage 2 build worked
if ! readelf --string-dump .comment $(TARGET_BUILD_STAGE2)/bin/clang 2>&1|grep -q "clang version"; then \
echo "clang hasn't been built using clang. Bye bye. Check that the stage2 build has been done."; \
exit 2; \
if test "$(SCAN_BUILD)" = "no"; then \
exit 2; \
fi; \
fi
if ldd $(TARGET_BUILD_STAGE2)/lib/libclang-$(LLVM_VERSION).so.1|grep -q libclang-cpp-$(LLVM_VERSION); then \
echo "libclang-$(LLVM_VERSION).so.1 depends on libclang-cpp. Should not be the case"; \
@ -1046,6 +1051,9 @@ override_dh_auto_clean:
f2=$$(echo $$f | sed 's/\.in$$//;s/X\.Y/$(LLVM_VERSION)/'); \
rm -f $$f2; \
done
if test "$(SCAN_BUILD)" = "yes"; then \
patch -R -p1 < debian/patches/on-the-fly/use-scan-build-runtimes.diff||true; \
fi
: # for some reason, the docs are written to debian/usr and debian/man ...
rm -rf debian/usr debian/man