From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/1] build.sh: PKG_CONFIG_LIBDIR auto-detection for x86_64
Date: Fri, 4 Dec 2020 14:09:23 +0100 [thread overview]
Message-ID: <20201204130923.14693-1-pvorel@suse.cz> (raw)
That allows not having to remove 64bit pkg-config
on distros which support both (or define PKG_CONFIG_LIBDIR itself).
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Tested:
https://travis-ci.org/github/pevik/ltp/builds/747398921
Kind regards,
Petr
build.sh | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/build.sh b/build.sh
index 45669bd91..452cc6f4c 100755
--- a/build.sh
+++ b/build.sh
@@ -22,7 +22,29 @@ MAKE_OPTS="-j$(getconf _NPROCESSORS_ONLN)"
build_32()
{
+ local dir
+ local arch="$(uname -m)"
+
echo "===== 32-bit ${1}-tree build into $PREFIX ====="
+
+ if [ -z "$PKG_CONFIG_LIBDIR" ]; then
+ if [ "$arch" != "x86_64" ]; then
+ echo "ERROR: auto-detection not supported platform $arch, export PKG_CONFIG_LIBDIR!"
+ exit 1
+ fi
+
+ for dir in /usr/lib/i386-linux-gnu/pkgconfig \
+ /usr/lib32/pkgconfig /usr/lib/pkgconfig; do
+ if [ -d "$dir" ]; then
+ PKG_CONFIG_LIBDIR="$dir"
+ break
+ fi
+ done
+ if [ -z "$PKG_CONFIG_LIBDIR" ]; then
+ echo "WARNING: PKG_CONFIG_LIBDIR not found, build might fail"
+ fi
+ fi
+
CFLAGS="-m32 $CFLAGS" LDFLAGS="-m32 $LDFLAGS"
build $1 $2
}
@@ -108,8 +130,8 @@ run_configure()
local configure=$1
shift
- export CC CFLAGS LDFLAGS
- echo "CC='$CC' CFLAGS='$CFLAGS' LDFLAGS='$LDFLAGS'"
+ export CC CFLAGS LDFLAGS PKG_CONFIG_LIBDIR
+ echo "CC='$CC' CFLAGS='$CFLAGS' LDFLAGS='$LDFLAGS' PKG_CONFIG_LIBDIR='$PKG_CONFIG_LIBDIR'"
echo "=== configure $configure $@ ==="
if ! $configure $@; then
@@ -147,7 +169,7 @@ in in-tree build
out out-of-tree build
BUILD TYPES:
-32 32-bit build
+32 32-bit build (PKG_CONFIG_LIBDIR auto-detection for x86_64)
cross cross-compile build (requires set compiler via -c switch)
native native build
EOF
--
2.29.2
next reply other threads:[~2020-12-04 13:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-04 13:09 Petr Vorel [this message]
2020-12-07 14:16 ` [LTP] [PATCH 1/1] build.sh: PKG_CONFIG_LIBDIR auto-detection for x86_64 Cyril Hrubis
2020-12-08 7:49 ` Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201204130923.14693-1-pvorel@suse.cz \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox