Blame SOURCES/0012-Ticket-49177-rpm-would-not-create-valid-pkgconfig-fi.patch

b69e47
From fffbb3d39a2ea12a2b3a72c729e76c1e69a19d8f Mon Sep 17 00:00:00 2001
b69e47
From: Mark Reynolds <mreynolds@redhat.com>
b69e47
Date: Mon, 27 Mar 2017 14:33:17 -0400
b69e47
Subject: [PATCH] Ticket 49177 - rpm would not create valid pkgconfig files
b69e47
b69e47
    Bug Description:  pkgconfig from the rpm was not valid.
b69e47
b69e47
    Fix Description:  Resolve an issue in the way we handle the file
b69e47
    substiution to resolve this issue.
b69e47
b69e47
    https://pagure.io/389-ds-base/issue/49177
b69e47
---
b69e47
 Makefile.am                | 10 ++--------
b69e47
 configure.ac               |  3 +++
b69e47
 m4/mozldap.m4              |  4 ++++
b69e47
 m4/openldap.m4             |  4 ++++
b69e47
 src/pkgconfig/dirsrv.pc.in |  4 ++++
b69e47
 5 files changed, 17 insertions(+), 8 deletions(-)
b69e47
b69e47
diff --git a/Makefile.am b/Makefile.am
b69e47
index 4a4b2d3..982dd28 100644
b69e47
--- a/Makefile.am
b69e47
+++ b/Makefile.am
b69e47
@@ -110,14 +110,12 @@ if OPENLDAP
b69e47
 # shared lib _fini for one will stomp on the other, and the program will crash
b69e47
 LDAPSDK_LINK_NOTHR = @openldap_lib@ -lldap@ol_libver@ @ldap_lib_ldif@ -llber@ol_libver@
b69e47
 LDAPSDK_LINK = @openldap_lib@ -lldap_r@ol_libver@ @ldap_lib_ldif@ -llber@ol_libver@
b69e47
-ldaplib = openldap
b69e47
-ldaplib_defs = -DUSE_OPENLDAP
b69e47
 else
b69e47
 LDAPSDK_LINK = @ldapsdk_lib@ -lssldap60 -lprldap60 -lldap60 -lldif60
b69e47
 LDAPSDK_LINK_NOTHR = $(LDAPSDK_LINK)
b69e47
-ldaplib = mozldap
b69e47
-ldaplib_defs =
b69e47
 endif
b69e47
+ldaplib = @ldaplib@
b69e47
+ldaplib_defs = @ldaplib_defs@
b69e47
 
b69e47
 DB_LINK = @db_lib@ -ldb-@db_libver@
b69e47
 SASL_LINK = @sasl_lib@ -lsasl2
b69e47
@@ -2237,10 +2235,6 @@ else
b69e47
 	$(fixupcmd) $^ | sed -n -e 's/@preamble@//' -e '/^#/{p;d;}' -e '/^$$/{p;d;}' -e 's/^\([^=]*\)\(=.*\)$$/\1\2 ; export \1/ ; p' > $@
b69e47
 endif
b69e47
 
b69e47
-%/$(PACKAGE_NAME).pc: %/dirsrv.pc.in
b69e47
-	if [ ! -d $(dir $@) ] ; then mkdir -p $(dir $@) ; fi
b69e47
-	$(fixupcmd) $^ > $@
b69e47
-
b69e47
 %/$(PACKAGE_NAME)-snmp: %/ldap-agent-initscript.in
b69e47
 	if [ ! -d $(dir $@) ] ; then mkdir -p $(dir $@) ; fi
b69e47
 	$(fixupcmd) $^ > $@
b69e47
diff --git a/configure.ac b/configure.ac
b69e47
index 4e3e9fb..3f2aa75 100644
b69e47
--- a/configure.ac
b69e47
+++ b/configure.ac
b69e47
@@ -785,6 +785,8 @@ AC_SUBST(openldap_inc)
b69e47
 AC_SUBST(openldap_lib)
b69e47
 AC_SUBST(openldap_libdir)
b69e47
 AC_SUBST(openldap_bindir)
b69e47
+AC_SUBST(ldaplib)
b69e47
+AC_SUBST(ldaplib_defs)
b69e47
 AC_SUBST(ldaptool_bindir)
b69e47
 AC_SUBST(ldaptool_opts)
b69e47
 AC_SUBST(plainldif_opts)
b69e47
@@ -853,6 +855,7 @@ if test "$GCC" != yes ; then
b69e47
 fi
b69e47
 
b69e47
 # Build our pkgconfig files
b69e47
+# This currently conflicts with %.in: rule in Makefile.am, which should be removed eventually.
b69e47
 AC_CONFIG_FILES([src/pkgconfig/dirsrv.pc src/pkgconfig/nunc-stans.pc src/pkgconfig/libsds.pc])
b69e47
 
b69e47
 AC_CONFIG_FILES([Makefile rpm/389-ds-base.spec  ])
b69e47
diff --git a/m4/mozldap.m4 b/m4/mozldap.m4
b69e47
index 4352151..8084ed8 100644
b69e47
--- a/m4/mozldap.m4
b69e47
+++ b/m4/mozldap.m4
b69e47
@@ -15,6 +15,8 @@ AC_ARG_WITH(ldapsdk, AS_HELP_STRING([--with-ldapsdk@<:@=PATH@:>@],[Mozilla LDAP
b69e47
   if test "$withval" = yes
b69e47
   then
b69e47
     AC_MSG_RESULT(yes)
b69e47
+    ldaplib="mozldap"
b69e47
+    ldaplib_defs=""
b69e47
   elif test "$withval" = no
b69e47
   then
b69e47
     AC_MSG_RESULT(no)
b69e47
@@ -22,6 +24,8 @@ AC_ARG_WITH(ldapsdk, AS_HELP_STRING([--with-ldapsdk@<:@=PATH@:>@],[Mozilla LDAP
b69e47
   then
b69e47
     AC_MSG_RESULT([using $withval])
b69e47
     LDAPSDKDIR=$withval
b69e47
+    ldaplib="mozldap"
b69e47
+    ldaplib_defs=""
b69e47
     ldapsdk_inc="-I$LDAPSDKDIR/include"
b69e47
     ldapsdk_lib="-L$LDAPSDKDIR/lib"
b69e47
     ldapsdk_libdir="$LDAPSDKDIR/lib"
b69e47
diff --git a/m4/openldap.m4 b/m4/openldap.m4
b69e47
index 417bf43..f45637c 100644
b69e47
--- a/m4/openldap.m4
b69e47
+++ b/m4/openldap.m4
b69e47
@@ -15,6 +15,8 @@ AC_ARG_WITH(openldap, AS_HELP_STRING([--with-openldap@<:@=PATH@:>@],[Use OpenLDA
b69e47
   if test "$withval" = yes
b69e47
   then
b69e47
     AC_MSG_RESULT([using system OpenLDAP])
b69e47
+    ldaplib="openldap"
b69e47
+    ldaplib_defs="-DUSE_OPENLDAP"
b69e47
   elif test "$withval" = no
b69e47
   then
b69e47
     AC_MSG_RESULT(no)
b69e47
@@ -22,6 +24,8 @@ AC_ARG_WITH(openldap, AS_HELP_STRING([--with-openldap@<:@=PATH@:>@],[Use OpenLDA
b69e47
   then
b69e47
     AC_MSG_RESULT([using $withval])
b69e47
     OPENLDAPDIR=$withval
b69e47
+    ldaplib="openldap"
b69e47
+    ldaplib_defs="-DUSE_OPENLDAP"
b69e47
     openldap_incdir="$OPENLDAPDIR/include"
b69e47
     openldap_inc="-I$openldap_incdir"
b69e47
     openldap_lib="-L$OPENLDAPDIR/lib"
b69e47
diff --git a/src/pkgconfig/dirsrv.pc.in b/src/pkgconfig/dirsrv.pc.in
b69e47
index 4140031..df433cf 100644
b69e47
--- a/src/pkgconfig/dirsrv.pc.in
b69e47
+++ b/src/pkgconfig/dirsrv.pc.in
b69e47
@@ -1,3 +1,7 @@
b69e47
+prefix=@prefix@
b69e47
+exec_prefix=@exec_prefix@
b69e47
+libdir=@libdir@
b69e47
+includedir=@includedir@
b69e47
 ldaplib=@ldaplib@
b69e47
 
b69e47
 Name: dirsrv
b69e47
-- 
b69e47
2.9.3
b69e47