diff options
Diffstat (limited to 'sys-devel/clang/files/5.0.2/0002-test-Fix-clang-test-for-FreeBSD-and-NetBSD.patch')
-rw-r--r-- | sys-devel/clang/files/5.0.2/0002-test-Fix-clang-test-for-FreeBSD-and-NetBSD.patch | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/sys-devel/clang/files/5.0.2/0002-test-Fix-clang-test-for-FreeBSD-and-NetBSD.patch b/sys-devel/clang/files/5.0.2/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.2/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 + |