Package: llvm-3.7-dev
Version: 1:3.7~+rc2-2
Severity: normal
Tags: patch

Dear Maintainer,

The LLVM_INSTALL_PREFIX variable set by LLVMConfig.cmake wrongly
assumes that the installed CMake configuration files are in a
subdirectory of the actual LLVM installation. The Debian package moves
the CMake configuration files to /usr/share/llvm-VERSION/, so this
assumption is not correct.

The way that the LLVM_INSTALL_PREFIX variable is determined has
changed in LLVM 3.7, and this issue for Debian was pointed out (along
with a proposed fix) by Brad King, here:

http://thread.gmane.org/gmane.comp.compilers.llvm.cvs/255502/focus=25574

The attached patch resolves this by essentially using the same
mechanism to determine LLVM_INSTALL_PREFIX as was used in LLVM
3.6. The resulting changes to the generated LLVMConfig.cmake match the
changes proposed by Brad above.

Many thanks,

James

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.1.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages llvm-3.7-dev depends on:
ii  libc6          2.19-19
ii  libedit2       3.1-20150325-1
ii  libffi-dev     3.2.1-3
ii  libffi6        3.2.1-3
ii  libgcc1        1:5.2.1-14
ii  libjsoncpp0v5  0.10.5-1
ii  libllvm3.7     1:3.7~+rc2-2
ii  libstdc++6     5.2.1-14
ii  libtinfo-dev   5.9+20150516-2
ii  libtinfo5      5.9+20150516-2
ii  llvm-3.7       1:3.7~+rc2-2
ii  zlib1g         1:1.2.8.dfsg-2+b1

llvm-3.7-dev recommends no packages.

llvm-3.7-dev suggests no packages.

-- no debconf information
--- a/cmake/modules/Makefile
+++ b/cmake/modules/Makefile
@@ -62,17 +62,9 @@
 
 LLVM_CONFIG_CODE := \
 \# Compute the CMake directory from the LLVMConfig.cmake file location.\n\
-get_filename_component(_LLVM_CMAKE_DIR "$${CMAKE_CURRENT_LIST_FILE}" PATH)\n\
-\# Compute the installation prefix from the LLVMConfig.cmake file location.\n\
-get_filename_component(LLVM_INSTALL_PREFIX "$${CMAKE_CURRENT_LIST_FILE}" PATH)\n
+get_filename_component(_LLVM_CMAKE_DIR "$${CMAKE_CURRENT_LIST_FILE}" PATH)\n
 
-# Compute number of levels (typically 3 - ``share/llvm/cmake/``) to PROJ_prefix
-# from PROJ_cmake, then emit the appropriate number of calls to
-# get_filename_components(). Note this assumes there are no spaces in the
-# cmake_path_suffix variable.
-cmake_path_suffix := $(subst $(PROJ_prefix),,$(subst $(DESTDIR),,$(PROJ_cmake)))
-cmake_path_dirs := $(subst /, ,$(cmake_path_suffix))
-LLVM_CONFIG_CODE += $(foreach __not_used,$(cmake_path_dirs),get_filename_component(LLVM_INSTALL_PREFIX "$${LLVM_INSTALL_PREFIX}" PATH)\n)
+LLVM_CONFIG_CODE += set(LLVM_INSTALL_PREFIX "$(subst /,\/,$(PROJ_prefix))")\n
 
 LLVM_CONFIG_CODE += set(_LLVM_LIBRARY_DIR "$${LLVM_INSTALL_PREFIX}\/lib")
 

Reply via email to