diff options
author | Simon McVittie <smcv@debian.org> | 2021-08-21 12:00:15 +0100 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2021-08-21 12:10:57 +0100 |
commit | e94e9d6092fcf76efbdc6acf9b2a80826f739e79 (patch) | |
tree | c4e21de6443525f2675ef113b4c1722ee2c0185d /debian | |
parent | 9d9008295f1e6eaba161cd4226866df27fe39ee3 (diff) |
d/rules: Factor out computation of system library path into a script
Breaking it up one line per command makes it easier to add more code than
when it was inlined it into debian/rules, and avoids needing to double
the $ for shell variables.
Based on a patch sent to pkg-config for #992620, but taking the fix
for #792285 into account in this version.
Signed-off-by: Simon McVittie <smcv@debian.org>
Diffstat (limited to 'debian')
-rwxr-xr-x | debian/rules | 5 | ||||
-rwxr-xr-x | debian/system-libdirs.sh | 16 |
2 files changed, 17 insertions, 4 deletions
diff --git a/debian/rules b/debian/rules index 35fa4cb..3f58ea5 100755 --- a/debian/rules +++ b/debian/rules @@ -21,10 +21,7 @@ else GCC = gcc endif -SYSTEM_LIBDIRS := $(shell for opt in '' $$($${CC-$(GCC)} -print-multi-lib | sed -n -e's/.*;@/-/p'); do \ - $(GCC) $$opt -print-search-dirs | sed -n -e's/^libraries: =//p' \ - | sed -e's/:/\n/g' | xargs -n1 readlink -f | grep -v 'gcc\|/[0-9.]\+$$'; \ - done | LC_ALL=C sort -u | tr '\n' : | sed 's/:$$//') +SYSTEM_LIBDIRS := $(shell sh debian/system-libdirs.sh $(GCC)) %: dh $@ diff --git a/debian/system-libdirs.sh b/debian/system-libdirs.sh new file mode 100755 index 0000000..d011a31 --- /dev/null +++ b/debian/system-libdirs.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +set -eu + +gcc="$1" + +for opt in '' $(${CC-"$gcc"} -print-multi-lib | sed -n -e's/.*;@/-/p'); do + "$gcc" $opt -print-search-dirs | + sed -n -e 's/^libraries: =//p' | + sed -e 's/:/\n/g' | + xargs -n1 readlink -f | + grep -v 'gcc\|/[0-9.]\+$' +done | +LC_ALL=C sort -u | +tr '\n' : | +sed 's/:$//' |