diff mbox series

trace-cmd: Update make-trace-cmd.sh to handle pkg-config without --with-path

Message ID 20210309122216.4ce353e4@gandalf.local.home (mailing list archive)
State Accepted
Commit 2191498dc35d629003591f727b604120fabbe02d
Headers show
Series trace-cmd: Update make-trace-cmd.sh to handle pkg-config without --with-path | expand

Commit Message

Steven Rostedt March 9, 2021, 5:22 p.m. UTC
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

Debian and Ubuntu's pkg-config does not support the "--with-path" option.
Check first if it is supported, and only use it when it is.

Set PKG_CONFIG_PATH to inform pkg-config where to search.

Note, this script may not be the best way to create packaging and there may
be better ways to do so.

Reported-by: pierre.gondois@arm.com
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=212149
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 make-trace-cmd.sh | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/make-trace-cmd.sh b/make-trace-cmd.sh
index ddff1814..31f32594 100755
--- a/make-trace-cmd.sh
+++ b/make-trace-cmd.sh
@@ -28,4 +28,12 @@  if [ -z "$PREFIX" ]; then
 	PREFIX="/usr"
 fi
 
-PKG_CONFIG="pkg-config --with-path $INSTALL_PATH/usr/lib64/pkgconfig --define-variable=prefix=$INSTALL_PATH/$PREFIX" CFLAGS="-g -Wall -I$INSTALL_PATH/$PREFIX/include" make DESTDIR=$INSTALL_PATH  $O_PATH prefix=$PREFIX $@
+PKG_PATH=`pkg-config --variable pc_path pkg-config | tr ":" " " | cut -d' ' -f1`
+
+WITH_PATH=""
+# If pkg-config supports --with-path, use that as well
+if pkg-config --with-path=/tmp --variable pc_path pkg-config &> /dev/null ; then
+	WITH_PATH="--with-path=$INSTALL_PATH$PKG_PATH"
+fi
+
+PKG_CONFIG_PATH="$INSTALL_PATH/$PKG_PATH" PKG_CONFIG="pkg-config $WITH_PATH --define-variable=prefix=$INSTALL_PATH/$PREFIX" CFLAGS="-g -Wall -I$INSTALL_PATH/$PREFIX/include" make DESTDIR=$INSTALL_PATH  $O_PATH prefix=$PREFIX $@