Skip to contentSkip to conversation

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

PATCH New Steven Rostedt 1 participant 1 message Mar 9, 2021

lore
Share & tools
lore
#0 lore raw

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

From: "Steven Rostedt (VMware)" <[email protected]>

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 [email protected]

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=212149

---
 make-trace-cmd.sh | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
make-trace-cmd.sh +9 -1
index ddff1814..31f32594 100755
@@ -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 $@
Signature · 1 line
2.25.4