openwrt-packages/libs/postgresql/patches/300-fix-pc-file.patch

34 lines
1.2 KiB
Diff

--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -391,14 +391,27 @@ endif # PORTNAME == cygwin || PORTNAME =
%.pc: $(MAKEFILE_LIST)
- echo 'Name: lib$(NAME)' >$@
+ echo 'prefix=$(prefix)' >$@
+ echo 'exec_prefix=$(exec_prefix)' >>$@
+ifeq ($(patsubst $(prefix)/%,,$(includedir)),)
+ echo 'includedir=$${prefix}/$(patsubst $(prefix)/%,%,$(includedir))' >>$@
+else
+ echo 'includedir=$(includedir)' >>$@
+endif
+ifeq ($(patsubst $(exec_prefix)/%,,$(libdir)),)
+ echo 'libdir=$${exec_prefix}/$(patsubst $(exec_prefix)/%,%,$(libdir))' >>$@
+else
+ echo 'libdir=$(libdir)' >>$@
+endif
+ echo >>$@
+ echo 'Name: lib$(NAME)' >>$@
echo 'Description: PostgreSQL lib$(NAME) library' >>$@
echo 'Url: $(PACKAGE_URL)' >>$@
echo 'Version: $(VERSION)' >>$@
echo 'Requires: ' >>$@
echo 'Requires.private: $(PKG_CONFIG_REQUIRES_PRIVATE)' >>$@
- echo 'Cflags: -I$(includedir)' >>$@
- echo 'Libs: -L$(libdir) -l$(NAME)' >>$@
+ echo 'Cflags: -I$${includedir}' >>$@
+ echo 'Libs: -L$${libdir} -l$(NAME)' >>$@
# Record -L flags that the user might have passed in to the PostgreSQL
# build to locate third-party libraries (e.g., ldap, ssl). Filter out
# those that point inside the build or source tree. Use sort to