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

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