From 5cebefbc853387012a578161588fcb04d41c2807 Mon Sep 17 00:00:00 2001 From: Ethan Sommer Date: Wed, 4 Nov 2020 14:48:17 -0500 Subject: [PATCH] libudev.pc: add prefix and exec_prefix support --- Makefile | 14 ++++++++++++-- libudev.pc.in | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 8147ca2..ce8ac39 100644 --- a/Makefile +++ b/Makefile @@ -29,8 +29,18 @@ libudev.so: ${OBJ} ${CC} ${XCFLAGS} -o $@ ${OBJ} ${XLDFLAGS} libudev.pc: libudev.pc.in - sed -e 's|@libdir@|${LIBDIR}|g' \ - -e 's|@includedir@|${INCLUDEDIR}|g' \ + libdir="${LIBDIR}"; \ + if [ "$${libdir#${PREFIX}}" != "$$libdir" ]; then \ + libdir="\$${exec_prefix}$${libdir#${PREFIX}}"; \ + fi; \ + includedir="${INCLUDEDIR}"; \ + if [ "$${includedir#${PREFIX}}" != "$$includedir" ]; then \ + includedir="\$${prefix}$${includedir#${PREFIX}}"; \ + fi; \ + sed -e 's|@prefix@|${PREFIX}|g' \ + -e 's|@exec_prefix@|${PREFIX}|g' \ + -e "s|@libdir@|$$libdir|g" \ + -e "s|@includedir@|$$includedir|g" \ -e 's|@VERSION@|243|g' \ libudev.pc.in > libudev.pc diff --git a/libudev.pc.in b/libudev.pc.in index 4955b43..6a45c32 100644 --- a/libudev.pc.in +++ b/libudev.pc.in @@ -1,3 +1,5 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@