Merge branch 'eschnett/rpath-comma' of git://github.com/eschnett/spack into eschnett-eschnett/rpath-comma
This commit is contained in:
commit
f2bcc6cc35
@ -1711,15 +1711,15 @@ Compile-time library search paths
|
|||||||
* ``-L$dep_prefix/lib``
|
* ``-L$dep_prefix/lib``
|
||||||
* ``-L$dep_prefix/lib64``
|
* ``-L$dep_prefix/lib64``
|
||||||
Runtime library search paths (RPATHs)
|
Runtime library search paths (RPATHs)
|
||||||
* ``-Wl,-rpath=$dep_prefix/lib``
|
* ``-Wl,-rpath,$dep_prefix/lib``
|
||||||
* ``-Wl,-rpath=$dep_prefix/lib64``
|
* ``-Wl,-rpath,$dep_prefix/lib64``
|
||||||
Include search paths
|
Include search paths
|
||||||
* ``-I$dep_prefix/include``
|
* ``-I$dep_prefix/include``
|
||||||
|
|
||||||
An example of this would be the ``libdwarf`` build, which has one
|
An example of this would be the ``libdwarf`` build, which has one
|
||||||
dependency: ``libelf``. Every call to ``cc`` in the ``libdwarf``
|
dependency: ``libelf``. Every call to ``cc`` in the ``libdwarf``
|
||||||
build will have ``-I$LIBELF_PREFIX/include``,
|
build will have ``-I$LIBELF_PREFIX/include``,
|
||||||
``-L$LIBELF_PREFIX/lib``, and ``-Wl,-rpath=$LIBELF_PREFIX/lib``
|
``-L$LIBELF_PREFIX/lib``, and ``-Wl,-rpath,$LIBELF_PREFIX/lib``
|
||||||
inserted on the command line. This is done transparently to the
|
inserted on the command line. This is done transparently to the
|
||||||
project's build system, which will just think it's using a system
|
project's build system, which will just think it's using a system
|
||||||
where ``libelf`` is readily available. Because of this, you **do
|
where ``libelf`` is readily available. Because of this, you **do
|
||||||
|
29
lib/spack/env/cc
vendored
29
lib/spack/env/cc
vendored
@ -175,15 +175,26 @@ while [ -n "$1" ]; do
|
|||||||
;;
|
;;
|
||||||
-Wl,*)
|
-Wl,*)
|
||||||
arg="${1#-Wl,}"
|
arg="${1#-Wl,}"
|
||||||
if [ -z "$arg" ]; then shift; arg="$1"; fi
|
# TODO: Handle multiple -Wl, continuations of -Wl,-rpath
|
||||||
if [[ "$arg" = -rpath=* ]]; then
|
if [[ $arg == -rpath=* ]]; then
|
||||||
rpaths+=("${arg#-rpath=}")
|
arg="${arg#-rpath=}"
|
||||||
elif [[ "$arg" = -rpath ]]; then
|
for rpath in ${arg//,/ }; do
|
||||||
|
rpaths+=("$rpath")
|
||||||
|
done
|
||||||
|
elif [[ $arg == -rpath,* ]]; then
|
||||||
|
arg="${arg#-rpath,}"
|
||||||
|
for rpath in ${arg//,/ }; do
|
||||||
|
rpaths+=("$rpath")
|
||||||
|
done
|
||||||
|
elif [[ $arg == -rpath ]]; then
|
||||||
shift; arg="$1"
|
shift; arg="$1"
|
||||||
if [[ "$arg" != -Wl,* ]]; then
|
if [[ $arg != '-Wl,'* ]]; then
|
||||||
die "-Wl,-rpath was not followed by -Wl,*"
|
die "-Wl,-rpath was not followed by -Wl,*"
|
||||||
fi
|
fi
|
||||||
rpaths+=("${arg#-Wl,}")
|
arg="${arg#-Wl,}"
|
||||||
|
for rpath in ${arg//,/ }; do
|
||||||
|
rpaths+=("$rpath")
|
||||||
|
done
|
||||||
else
|
else
|
||||||
other_args+=("-Wl,$arg")
|
other_args+=("-Wl,$arg")
|
||||||
fi
|
fi
|
||||||
@ -191,11 +202,11 @@ while [ -n "$1" ]; do
|
|||||||
-Xlinker,*)
|
-Xlinker,*)
|
||||||
arg="${1#-Xlinker,}"
|
arg="${1#-Xlinker,}"
|
||||||
if [ -z "$arg" ]; then shift; arg="$1"; fi
|
if [ -z "$arg" ]; then shift; arg="$1"; fi
|
||||||
if [[ "$arg" = -rpath=* ]]; then
|
if [[ $arg = -rpath=* ]]; then
|
||||||
rpaths+=("${arg#-rpath=}")
|
rpaths+=("${arg#-rpath=}")
|
||||||
elif [[ "$arg" = -rpath ]]; then
|
elif [[ $arg = -rpath ]]; then
|
||||||
shift; arg="$1"
|
shift; arg="$1"
|
||||||
if [[ "$arg" != -Xlinker,* ]]; then
|
if [[ $arg != -Xlinker,* ]]; then
|
||||||
die "-Xlinker,-rpath was not followed by -Xlinker,*"
|
die "-Xlinker,-rpath was not followed by -Xlinker,*"
|
||||||
fi
|
fi
|
||||||
rpaths+=("${arg#-Xlinker,}")
|
rpaths+=("${arg#-Xlinker,}")
|
||||||
|
@ -1216,8 +1216,8 @@ def rpath(self):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def rpath_args(self):
|
def rpath_args(self):
|
||||||
"""Get the rpath args as a string, with -Wl,-rpath= for each element."""
|
"""Get the rpath args as a string, with -Wl,-rpath, for each element."""
|
||||||
return " ".join("-Wl,-rpath=%s" % p for p in self.rpath)
|
return " ".join("-Wl,-rpath,%s" % p for p in self.rpath)
|
||||||
|
|
||||||
|
|
||||||
def validate_package_url(url_string):
|
def validate_package_url(url_string):
|
||||||
|
@ -39,11 +39,11 @@
|
|||||||
'arg1',
|
'arg1',
|
||||||
'-Wl,--start-group',
|
'-Wl,--start-group',
|
||||||
'arg2',
|
'arg2',
|
||||||
'-Wl,-rpath=/first/rpath', 'arg3', '-Wl,-rpath', '-Wl,/second/rpath',
|
'-Wl,-rpath,/first/rpath', 'arg3', '-Wl,-rpath', '-Wl,/second/rpath',
|
||||||
'-llib1', '-llib2',
|
'-llib1', '-llib2',
|
||||||
'arg4',
|
'arg4',
|
||||||
'-Wl,--end-group',
|
'-Wl,--end-group',
|
||||||
'-Xlinker,-rpath', '-Xlinker,/third/rpath', '-Xlinker,-rpath=/fourth/rpath',
|
'-Xlinker,-rpath', '-Xlinker,/third/rpath', '-Xlinker,-rpath', '-Xlinker,/fourth/rpath',
|
||||||
'-llib3', '-llib4',
|
'-llib3', '-llib4',
|
||||||
'arg5', 'arg6']
|
'arg5', 'arg6']
|
||||||
|
|
||||||
@ -95,13 +95,13 @@ def test_cpp_mode(self):
|
|||||||
def test_ccld_mode(self):
|
def test_ccld_mode(self):
|
||||||
self.check_cc('dump-mode', [], "ccld")
|
self.check_cc('dump-mode', [], "ccld")
|
||||||
self.check_cc('dump-mode', ['foo.c', '-o', 'foo'], "ccld")
|
self.check_cc('dump-mode', ['foo.c', '-o', 'foo'], "ccld")
|
||||||
self.check_cc('dump-mode', ['foo.c', '-o', 'foo', '-Wl,-rpath=foo'], "ccld")
|
self.check_cc('dump-mode', ['foo.c', '-o', 'foo', '-Wl,-rpath,foo'], "ccld")
|
||||||
self.check_cc('dump-mode', ['foo.o', 'bar.o', 'baz.o', '-o', 'foo', '-Wl,-rpath=foo'], "ccld")
|
self.check_cc('dump-mode', ['foo.o', 'bar.o', 'baz.o', '-o', 'foo', '-Wl,-rpath,foo'], "ccld")
|
||||||
|
|
||||||
|
|
||||||
def test_ld_mode(self):
|
def test_ld_mode(self):
|
||||||
self.check_ld('dump-mode', [], "ld")
|
self.check_ld('dump-mode', [], "ld")
|
||||||
self.check_ld('dump-mode', ['foo.o', 'bar.o', 'baz.o', '-o', 'foo', '-Wl,-rpath=foo'], "ld")
|
self.check_ld('dump-mode', ['foo.o', 'bar.o', 'baz.o', '-o', 'foo', '-Wl,-rpath,foo'], "ld")
|
||||||
|
|
||||||
|
|
||||||
def test_includes(self):
|
def test_includes(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user