diff --git a/debian/patches/no-z3.patch b/debian/patches/no-z3.patch new file mode 100644 index 00000000..8ebfd93a --- /dev/null +++ b/debian/patches/no-z3.patch @@ -0,0 +1,47 @@ +Description: + Disable z3 to avoid pulling ocaml into main. + For some reason the cmake option LLVM_ENABLE_Z3_SOLVER was not taken into account +Author: Gianfranco Costamagna + +Last-Update: 2019-11-26 + +Index: llvm-toolchain-9-9.0.0/llvm/CMakeLists.txt +=================================================================== +--- llvm-toolchain-9-9.0.0.orig/llvm/CMakeLists.txt ++++ llvm-toolchain-9-9.0.0/llvm/CMakeLists.txt +@@ -340,24 +340,22 @@ + + set(LLVM_Z3_INSTALL_DIR "" CACHE STRING "Install directory of the Z3 solver.") + +-find_package(Z3 4.7.1) +- +-if (LLVM_Z3_INSTALL_DIR) +- if (NOT Z3_FOUND) +- message(FATAL_ERROR "Z3 >= 4.7.1 has not been found in LLVM_Z3_INSTALL_DIR: ${LLVM_Z3_INSTALL_DIR}.") +- endif() +-endif() +- +-set(LLVM_ENABLE_Z3_SOLVER_DEFAULT "${Z3_FOUND}") +- + option(LLVM_ENABLE_Z3_SOLVER + "Enable Support for the Z3 constraint solver in LLVM." +- ${LLVM_ENABLE_Z3_SOLVER_DEFAULT} ++ ON + ) + + if (LLVM_ENABLE_Z3_SOLVER) +- if (NOT Z3_FOUND) +- message(FATAL_ERROR "LLVM_ENABLE_Z3_SOLVER cannot be enabled when Z3 is not available.") ++ find_package(Z3 4.7.1) ++ ++ if (LLVM_Z3_INSTALL_DIR) ++ if (NOT Z3_FOUND) ++ message(FATAL_ERROR "Z3 >= 4.7.1 has not been found in LLVM_Z3_INSTALL_DIR: ${LLVM_Z3_INSTALL_DIR}.") ++ endif() ++ else() ++ if (NOT Z3_FOUND) ++ message(FATAL_ERROR "LLVM_ENABLE_Z3_SOLVER cannot be enabled when Z3 is not available.") ++ endif() + endif() + + set(LLVM_WITH_Z3 1) diff --git a/debian/patches/series b/debian/patches/series index 14289090..8561d532 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -133,3 +133,4 @@ clang-riscv64-rv64gc.diff D67877.patch disable-lit-cpuid-install.diff disable-fuzzer-compiler-rt.diff +no-z3.patch diff --git a/debian/rules b/debian/rules index b648e54f..38aa563f 100755 --- a/debian/rules +++ b/debian/rules @@ -70,11 +70,13 @@ ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' g++ GCC_VERSION := 4.9 endif -Z3_FLAG= +Z3_FLAG = -DLLVM_ENABLE_Z3_SOLVER=OFF ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' libz3-dev) gt 4.7.0; echo $$?),0) -# Too old version of gcc. Force 4.9 +# no ocaml support in main for Ubuntu +ifneq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes) Z3_FLAG = -DLLVM_ENABLE_Z3_SOLVER=ON endif +endif FORCE_NOT_GCC_9_DISTRO := eoan focal bullseye sid ifneq (,$(filter $(DISTRO),$(FORCE_NOT_GCC_9_DISTRO)))