diff options
author | Michał Górny <mgorny@gentoo.org> | 2018-04-01 23:48:30 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2018-04-02 00:27:16 +0200 |
commit | 52937c53de83b925db8a7b20cebf0e18284bc75e (patch) | |
tree | 6b2b9e6e3b7379b857fd4ad679f6d6fb4d14f27c /sys-devel | |
parent | sys-devel/llvm: Backport -Wl,-rpath FreeBSD fix to 5.0.1 (diff) | |
download | gentoo-52937c53de83b925db8a7b20cebf0e18284bc75e.tar.gz gentoo-52937c53de83b925db8a7b20cebf0e18284bc75e.tar.bz2 gentoo-52937c53de83b925db8a7b20cebf0e18284bc75e.zip |
sys-devel/clang: Backport FreeBSD test fixes to 5.0.1
Diffstat (limited to 'sys-devel')
3 files changed, 125 insertions, 7 deletions
diff --git a/sys-devel/clang/clang-5.0.1.ebuild b/sys-devel/clang/clang-5.0.1.ebuild index b16d9564915d..c79d4d26b48f 100644 --- a/sys-devel/clang/clang-5.0.1.ebuild +++ b/sys-devel/clang/clang-5.0.1.ebuild @@ -65,13 +65,6 @@ S=${WORKDIR}/x/y/${MY_P} # least intrusive of all CMAKE_BUILD_TYPE=RelWithDebInfo -PATCHES=( - # fix finding compiler-rt libs - "${FILESDIR}"/5.0.1/0001-Driver-Use-arch-type-to-find-compiler-rt-libraries-o.patch - # add Prefix include paths for Darwin - "${FILESDIR}"/5.0.1/darwin_prefix-include-paths.patch -) - # Multilib notes: # 1. ABI_* flags control ABIs libclang* is built for only. # 2. clang is always capable of compiling code for all ABIs for enabled @@ -113,6 +106,18 @@ src_unpack() { } src_prepare() { + # fix finding compiler-rt libs + eapply "${FILESDIR}"/5.0.1/0001-Driver-Use-arch-type-to-find-compiler-rt-libraries-o.patch + # fix setting LD_LIBRARY_PATH for tests on *BSD + eapply "${FILESDIR}"/5.0.1/0002-test-Fix-clang-test-for-FreeBSD-and-NetBSD.patch + # add Prefix include paths for Darwin + eapply "${FILESDIR}"/5.0.1/darwin_prefix-include-paths.patch + + cd tools/extra || die + # fix setting LD_LIBRARY_PATH for tests on *BSD (extra part) + eapply "${FILESDIR}"/5.0.1/extra/0001-Assume-the-shared-library-path-variable-is-LD_LIBRAR.patch + cd ../.. || die + cmake-utils_src_prepare eprefixify lib/Frontend/InitHeaderSearch.cpp } diff --git a/sys-devel/clang/files/5.0.1/0002-test-Fix-clang-test-for-FreeBSD-and-NetBSD.patch b/sys-devel/clang/files/5.0.1/0002-test-Fix-clang-test-for-FreeBSD-and-NetBSD.patch new file mode 100644 index 000000000000..1751a4f479f0 --- /dev/null +++ b/sys-devel/clang/files/5.0.1/0002-test-Fix-clang-test-for-FreeBSD-and-NetBSD.patch @@ -0,0 +1,76 @@ +From 4650c277d616e5d297baf28682eb792e2e0144b1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Sun, 1 Apr 2018 23:20:56 +0200 +Subject: [PATCH] [test] Fix clang-test for FreeBSD and NetBSD + +Lit tries to inject the shared library paths, but no action is taken +when platform.system() is not recognized, results in an environment +variable with an empty name, which is illegal. + +The patch fixes this mechanism for FreeBSD and NetBSD, and gives an +warning on other platforms, so that the latecomers don't have to spend +time on debugging lit. + +Thanks Zhihao Yuan for the patch! + +Differential Revision: https://reviews.llvm.org/D39162 + +git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316411 91177308-0d34-0410-b5e6-96231b3b80d8 + +(rebased for release_50 branch) +--- + test/Unit/lit.cfg | 41 ++++++++++++++++++++--------------------- + 1 file changed, 20 insertions(+), 21 deletions(-) + +diff --git a/test/Unit/lit.cfg b/test/Unit/lit.cfg +index 90eb2ac604..2cabf4bba1 100644 +--- a/test/Unit/lit.cfg ++++ b/test/Unit/lit.cfg +@@ -87,24 +87,23 @@ if config.test_exec_root is None: + lit_config.load_config(config, site_cfg) + raise SystemExit + +-shlibpath_var = '' +-if platform.system() == 'Linux': +- shlibpath_var = 'LD_LIBRARY_PATH' +-elif platform.system() == 'Darwin': +- shlibpath_var = 'DYLD_LIBRARY_PATH' +-elif platform.system() == 'Windows': +- shlibpath_var = 'PATH' +- +-# in stand-alone builds, shlibdir is clang's build tree +-# while llvm_libs_dir is installed LLVM (and possibly older clang) +-llvm_shlib_dir = getattr(config, 'shlibdir', None) +-if not llvm_shlib_dir: +- lit_config.fatal('No shlibdir set!') +-# Point the dynamic loader at dynamic libraries in 'lib'. +-llvm_libs_dir = getattr(config, 'llvm_libs_dir', None) +-if not llvm_libs_dir: +- lit_config.fatal('No LLVM libs dir set!') +-shlibpath = os.path.pathsep.join((llvm_shlib_dir, llvm_libs_dir, +- config.environment.get(shlibpath_var,''))) +- +-config.environment[shlibpath_var] = shlibpath ++def find_shlibpath_var(): ++ if platform.system() in ['Linux', 'FreeBSD', 'NetBSD']: ++ yield 'LD_LIBRARY_PATH' ++ elif platform.system() == 'Darwin': ++ yield 'DYLD_LIBRARY_PATH' ++ elif platform.system() == 'Windows': ++ yield 'PATH' ++ ++for shlibpath_var in find_shlibpath_var(): ++ # in stand-alone builds, shlibdir is clang's build tree ++ # while llvm_libs_dir is installed LLVM (and possibly older clang) ++ shlibpath = os.path.pathsep.join( ++ (config.shlibdir, ++ config.llvm_libs_dir, ++ config.environment.get(shlibpath_var, ''))) ++ config.environment[shlibpath_var] = shlibpath ++ break ++else: ++ lit_config.warning("unable to inject shared library path on '{}'" ++ .format(platform.system())) +-- +2.17.0.rc2 + diff --git a/sys-devel/clang/files/5.0.1/extra/0001-Assume-the-shared-library-path-variable-is-LD_LIBRAR.patch b/sys-devel/clang/files/5.0.1/extra/0001-Assume-the-shared-library-path-variable-is-LD_LIBRAR.patch new file mode 100644 index 000000000000..cbdb0b807aaf --- /dev/null +++ b/sys-devel/clang/files/5.0.1/extra/0001-Assume-the-shared-library-path-variable-is-LD_LIBRAR.patch @@ -0,0 +1,37 @@ +From 5c5bb3948697f2ca184a03dedd5666eb2de547ba Mon Sep 17 00:00:00 2001 +From: Dimitry Andric <dimitry@andric.com> +Date: Sat, 20 Jan 2018 14:34:33 +0000 +Subject: [PATCH] Assume the shared library path variable is LD_LIBRARY_PATH on + systems except Darwin and Windows. This prevents inserting an environment + variable with an empty name (which is illegal and leads to a Python + exception) on any of the BSDs. + +git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@323040 91177308-0d34-0410-b5e6-96231b3b80d8 +--- + test/Unit/lit.cfg | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/test/Unit/lit.cfg b/test/Unit/lit.cfg +index fc63afdb..b40e1cae 100644 +--- a/test/Unit/lit.cfg ++++ b/test/Unit/lit.cfg +@@ -19,13 +19,12 @@ config.test_exec_root = config.test_source_root + # ;-separated list of subdirectories). + config.test_format = lit.formats.GoogleTest('.', 'Tests') + +-shlibpath_var = '' +-if platform.system() == 'Linux': +- shlibpath_var = 'LD_LIBRARY_PATH' +-elif platform.system() == 'Darwin': ++if platform.system() == 'Darwin': + shlibpath_var = 'DYLD_LIBRARY_PATH' + elif platform.system() == 'Windows': + shlibpath_var = 'PATH' ++else: ++ shlibpath_var = 'LD_LIBRARY_PATH' + + # Point the dynamic loader at dynamic libraries in 'lib'. + shlibpath = os.path.pathsep.join((config.shlibdir, config.llvm_libs_dir, +-- +2.17.0.rc2 + |