git: 9de718aaf747 - main - www/elinks: Fix build with ssl from ports

From: Felix Palmen <zirias_at_FreeBSD.org>
Date: Wed, 20 Sep 2023 07:44:36 UTC
The branch main has been updated by zirias:

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

commit 9de718aaf747cace995ffcf592edf64e3fdd9317
Author:     Felix Palmen <zirias@FreeBSD.org>
AuthorDate: 2023-09-20 06:53:53 +0000
Commit:     Felix Palmen <zirias@FreeBSD.org>
CommitDate: 2023-09-20 07:43:40 +0000

    www/elinks: Fix build with ssl from ports
    
    Building with ssl from ports used the headers from ports, but still
    linked the libs from base and therefore failed. Patch meson.build to
    look for OpenSSL libs in ${OPENSSLLIB} to fix this.
    
    Approved by:    portmgr (blanket, build fix)
---
 www/elinks/Makefile                |  1 +
 www/elinks/files/patch-meson.build | 17 ++++++++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/www/elinks/Makefile b/www/elinks/Makefile
index 89663e541e0a..82bf889d751f 100644
--- a/www/elinks/Makefile
+++ b/www/elinks/Makefile
@@ -117,6 +117,7 @@ ZSTD_USES=		localbase
 ZSTD_MESON_TRUE=	zstd
 
 post-patch:
+	@${REINPLACE_CMD} -e 's|%%OPENSSLLIB%%|${OPENSSLLIB}|g' ${WRKSRC}/meson.build
 	@${REINPLACE_CMD} -e 's|/usr/bin/perl|${PERL}|g' ${WRKSRC}/doc/tools/help2xml
 	@${REINPLACE_CMD} -e 's|/usr/bin/env python3|${PYTHON_CMD}|g' ${WRKSRC}/doc/tools/asciidoc/asciidoc.py
 
diff --git a/www/elinks/files/patch-meson.build b/www/elinks/files/patch-meson.build
index 6b13996f5ce9..8ca2f7d08468 100644
--- a/www/elinks/files/patch-meson.build
+++ b/www/elinks/files/patch-meson.build
@@ -1,6 +1,6 @@
 --- meson.build.orig	2023-05-01 08:45:22 UTC
 +++ meson.build
-@@ -178,6 +178,10 @@ endif
+@@ -178,6 +178,10 @@ if compiler.has_header('fcntl.h')
      conf_data.set('HAVE_FCNTL_H', 1)
  endif
  
@@ -11,7 +11,18 @@
  if compiler.has_header('libgen.h')
      conf_data.set('HAVE_LIBGEN_H', 1)
  endif
-@@ -845,7 +849,7 @@ endif
+@@ -344,8 +348,8 @@ gnutlsdeps = []
+ ssldeps = []
+ 
+ if conf_data.get('CONFIG_OPENSSL')
+-    ssldeps = dependency('openssl', static: st)
+-    deps += ssldeps
++    deps += compiler.find_library('crypto', dirs: '%%OPENSSLLIB%%')
++    deps += compiler.find_library('ssl', dirs: '%%OPENSSLLIB%%')
+     conf_data.set('USE_OPENSSL', true)
+     conf_data.set('CONFIG_GNUTLS', false)
+ elif conf_data.get('CONFIG_GNUTLS')
+@@ -845,7 +849,7 @@ if compiler.has_function('iconv', prefix: '#include <i
      conf_data.set('HAVE_ICONV', 1)
  endif
  
@@ -20,7 +31,7 @@
      conf_data.set('HAVE_ALLOCA', 1)
  endif
  
-@@ -861,7 +865,7 @@ endif
+@@ -861,7 +865,7 @@ if compiler.has_function('gnutls_certificate_set_x509_
      conf_data.set('HAVE_GNUTLS_CERTIFICATE_SET_X509_SYSTEM_TRUST', 1)
  endif