git: c03c94943e1d - 2024Q1 - net/openldap26-server: fix build with lld 17 and DEBUG option off

From: Xin LI <delphij_at_FreeBSD.org>
Date: Sat, 09 Mar 2024 21:42:04 UTC
The branch 2024Q1 has been updated by delphij:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c03c94943e1de2751f21e6dd264538f0402df6b2

commit c03c94943e1de2751f21e6dd264538f0402df6b2
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-03-09 21:37:15 +0000
Commit:     Xin LI <delphij@FreeBSD.org>
CommitDate: 2024-03-09 21:41:37 +0000

    net/openldap26-server: fix build with lld 17 and DEBUG option off
    
    If the DEBUG option for the net/openldap26-server is turned off,
    building the port will result in:
    
      ld: error: version script assignment of 'OPENLDAP_2.200' to symbol 'ldap_dump_connection' failed: symbol not defined
      ld: error: version script assignment of 'OPENLDAP_2.200' to symbol 'ldap_dump_requests_and_responses' failed: symbol not defined
      cc: error: linker command failed with exit code 1 (use -v to see invocation)
    
    This is because the mentioned symbols are in a #ifdef LDAP_DEBUG block,
    and will indeed not be defined if DEBUG option is off.
    
    Adjust the port Makefile to delete the undefined symbols from the
    ldap.map file, if the DEBUG option is off.
    
    PR:             277585
    Reported by:    Matt Magoffin <bugs.freebsd.org@msqr.us>
    
    (cherry picked from commit 3d75c31b623969e665a9c83337efe34417cd4b78)
---
 net/openldap26-server/Makefile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/openldap26-server/Makefile b/net/openldap26-server/Makefile
index 7d8c447560a7..2ff1eb562ae1 100644
--- a/net/openldap26-server/Makefile
+++ b/net/openldap26-server/Makefile
@@ -390,6 +390,11 @@ post-patch:
 	@${REINPLACE_CMD} -E ${CONFIGURE_SED} \
 		${CONFIGURE_WRKSRC}/${CONFIGURE_SCRIPT}
 .endif
+.if !${PORT_OPTIONS:MDEBUG}
+	@${REINPLACE_CMD} -E \
+		-e '/ldap_dump_(connection|requests_and_responses);/d' \
+		${WRKSRC}/libraries/libldap/ldap.map
+.endif
 
 pre-configure:
 	@(cd ${WRKSRC} && ${LOCALBASE}/bin/autoconf)