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

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