git: 9585000d0f85 - main - www/apt-cacher-ng: Fix build with openssl3

From: Muhammad Moinur Rahman <bofh_at_FreeBSD.org>
Date: Wed, 02 Aug 2023 21:18:29 UTC
The branch main has been updated by bofh:

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

commit 9585000d0f854a691063706209e521eb48c86d59
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2023-08-02 21:04:16 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2023-08-02 21:18:14 +0000

    www/apt-cacher-ng: Fix build with openssl3
    
    - Update version 3.2=>3.2.1 as upstream no longer hosts 3.2 version
    
    Approved by:    portmgr (blanket)
    Sponsored by:   The FreeBSD Foundation
---
 www/apt-cacher-ng/Makefile                         | 11 +++++---
 www/apt-cacher-ng/distinfo                         |  6 ++---
 www/apt-cacher-ng/files/patch-CMakeLists.txt       | 12 ++++-----
 www/apt-cacher-ng/files/patch-conf_acng.conf.in    |  6 ++---
 www/apt-cacher-ng/files/patch-source_acngtool.cc   | 29 ++++++++++++++--------
 www/apt-cacher-ng/files/patch-source_tcpconnect.cc | 14 +++++++++--
 6 files changed, 51 insertions(+), 27 deletions(-)

diff --git a/www/apt-cacher-ng/Makefile b/www/apt-cacher-ng/Makefile
index fbfe6c8f8dce..d1f3ba749d8a 100644
--- a/www/apt-cacher-ng/Makefile
+++ b/www/apt-cacher-ng/Makefile
@@ -1,6 +1,5 @@
 PORTNAME=	apt-cacher-ng
-PORTVERSION=	3.2
-PORTREVISION=	2
+PORTVERSION=	3.2.1
 CATEGORIES=	www
 MASTER_SITES=	DEBIAN_POOL/apt-cacher-ng
 DISTFILES=	${PORTNAME}_${PORTVERSION}.orig${EXTRACT_SUFX}
@@ -42,6 +41,12 @@ FUSE_DESC=	FUSE support for interfacing with the proxy via acngfs
 FUSE_CMAKE_BOOL=	USE_FUSE
 FUSE_USES=		fuse pkgconfig
 
+.include <bsd.port.pre.mk>
+
+#.if ( ${OPSYS} == FreeBSD && ${OSVERSION} >= 1400092 && ${SSL_DEFAULT} == base ) || ${SSL_DEFAULT:Mopenssl3*}
+#CXXFLAGS+=	-DOPENSSL_API_COMPAT=0x10100000L
+#.endif
+
 post-install:
 	${MV} ${STAGEDIR}${ETCDIR}/acng.conf ${STAGEDIR}${ETCDIR}/acng.conf.sample
 	${MV} ${STAGEDIR}${ETCDIR}/security.conf ${STAGEDIR}${ETCDIR}/security.conf.sample
@@ -53,4 +58,4 @@ post-install:
 	${MKDIR} ${STAGEDIR}/var/cache/apt-cacher-ng \
 		${STAGEDIR}/var/log/apt-cacher-ng
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff --git a/www/apt-cacher-ng/distinfo b/www/apt-cacher-ng/distinfo
index 33f6809385e1..a82c5046ddc0 100644
--- a/www/apt-cacher-ng/distinfo
+++ b/www/apt-cacher-ng/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1543055307
-SHA256 (apt-cacher-ng_3.2.orig.tar.xz) = 405de837becb9ce89e0fb068565bdf4a49d8742be067f8d91da36742702f5acd
-SIZE (apt-cacher-ng_3.2.orig.tar.xz) = 319036
+TIMESTAMP = 1691009781
+SHA256 (apt-cacher-ng_3.2.1.orig.tar.xz) = 9da88292d36e3f95918a96b5057b49f7e3057a4799ec64a890817e3cddb368b6
+SIZE (apt-cacher-ng_3.2.1.orig.tar.xz) = 320392
diff --git a/www/apt-cacher-ng/files/patch-CMakeLists.txt b/www/apt-cacher-ng/files/patch-CMakeLists.txt
index f7dd49d82da2..5ce9db663bb3 100644
--- a/www/apt-cacher-ng/files/patch-CMakeLists.txt
+++ b/www/apt-cacher-ng/files/patch-CMakeLists.txt
@@ -1,4 +1,4 @@
---- CMakeLists.txt.orig	2018-09-07 13:02:18 UTC
+--- CMakeLists.txt.orig	2020-02-03 18:54:57 UTC
 +++ CMakeLists.txt
 @@ -26,20 +26,20 @@ INCLUDE(CheckSymbolExists)
  INCLUDE(FindPkgConfig)
@@ -44,8 +44,8 @@
 +if(NOT DEFINED RUNDIR)
  	set(RUNDIR "/run")
  endif()
- 
-@@ -71,7 +71,7 @@ endmacro()
+ set(SOCKET_PATH "${RUNDIR}/${PACKAGE}/socket")
+@@ -73,7 +73,7 @@ endmacro()
  
  INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "include")
  
@@ -54,7 +54,7 @@
  FILE(READ "${CMAKE_SOURCE_DIR}/VERSION" ACVERSION)
  string(REPLACE "\n" "" ACVERSION ${ACVERSION})
  #MESSAGE(STATUS "Version: ${ACVERSION}")
-@@ -308,7 +308,9 @@ SET(CMAKE_REQUIRED_LIBRARIES "")
+@@ -310,7 +310,9 @@ SET(CMAKE_REQUIRED_LIBRARIES "")
  set(HAVE_CHECKSUM on)
  
  if(USE_SSL)
@@ -65,7 +65,7 @@
  	if(openssl_FOUND)
  		set(HAVE_SSL on)
      _append(ACNG_COMPFLAGS ${openssl_CFLAGS})
-@@ -388,18 +390,22 @@ add_subdirectory(systemd)
+@@ -390,18 +392,22 @@ add_subdirectory(systemd)
  ###
  ### Extra install rules for static files
  ###
@@ -92,7 +92,7 @@
     set(AVAHIDIR "${SYSCONFDIR}/avahi/services")
  endif()
  install(FILES contrib/apt-cacher-ng.service DESTINATION ${AVAHIDIR})
-@@ -414,4 +420,5 @@ DOCDIR: ${DOCDIR}
+@@ -416,4 +422,5 @@ DOCDIR: ${DOCDIR}
  SYSCONFDIR: ${SYSCONFDIR}
  CFGDIR: ${CFGDIR}
  SBINDIR: ${SBINDIR}
diff --git a/www/apt-cacher-ng/files/patch-conf_acng.conf.in b/www/apt-cacher-ng/files/patch-conf_acng.conf.in
index e9b488943761..5a3023e3b2b3 100644
--- a/www/apt-cacher-ng/files/patch-conf_acng.conf.in
+++ b/www/apt-cacher-ng/files/patch-conf_acng.conf.in
@@ -1,6 +1,6 @@
---- conf/acng.conf.in.orig	2018-09-07 13:02:18 UTC
+--- conf/acng.conf.in.orig	2020-02-03 18:54:57 UTC
 +++ conf/acng.conf.in
-@@ -69,6 +69,7 @@ Remap-epel:   file:epel_mirrors # Fedora
+@@ -69,6 +69,7 @@ Remap-epel:   file:epel_mirrors # Fedora EPEL
  Remap-slrep:  file:sl_mirrors # Scientific Linux
  Remap-gentoo: file:gentoo_mirrors.gz /gentoo ; file:backends_gentoo # Gentoo Archives
  Remap-secdeb: security.debian.org ; security.debian.org deb.debian.org/debian-security
@@ -8,7 +8,7 @@
  
  # Virtual page accessible in a web browser to see statistics and status
  # information, i.e. under http://localhost:3142/acng-report.html
-@@ -365,6 +366,7 @@ LocalDirs: acng-doc @DOCDIR@
+@@ -366,6 +367,7 @@ LocalDirs: acng-doc @DOCDIR@
  # in /etc/hosts.allow or /etc/hosts.deny files.
  #
  # UseWrap: 0
diff --git a/www/apt-cacher-ng/files/patch-source_acngtool.cc b/www/apt-cacher-ng/files/patch-source_acngtool.cc
index 2ddff95f00da..3eb86a2e617c 100644
--- a/www/apt-cacher-ng/files/patch-source_acngtool.cc
+++ b/www/apt-cacher-ng/files/patch-source_acngtool.cc
@@ -1,13 +1,22 @@
---- source/acngtool.cc.orig	2018-09-07 13:02:18 UTC
+--- source/acngtool.cc.orig	2020-02-03 18:54:57 UTC
 +++ source/acngtool.cc
-@@ -562,8 +562,10 @@ int maint_job()
- 						if (!ids.send(m_conFd))
- 							return;
- 
+@@ -579,8 +579,10 @@ struct TUdsFactory : public ::acng::IDlConFactory
+ 			udsconnection() : tcpconnect(nullptr)
+ 			{
+ 				// some static and dummy parameters, and invalidate SSL for sure
 +#ifdef HAVE_SSL
- 						m_ssl = nullptr;
- 						m_bio = nullptr;
+ 				m_ssl = nullptr;
+ 				m_bio = nullptr;
 +#endif
- 						// better match the TCP socket parameters
- 						m_sHostName = "localhost";
- 						m_sPort = sDefPortHTTP;
+ 				m_sHostName = FAKE_UDS_HOSTNAME;
+ 				m_sPort = cfg::port;
+ 
+@@ -1006,7 +1008,7 @@ std::unordered_map<string, parm> parms = {
+ 				}
+ 			}
+ 		},
+-		{ 
++		{
+ 			"patch",
+ 			{
+ 				3, 3, [](LPCSTR p)
diff --git a/www/apt-cacher-ng/files/patch-source_tcpconnect.cc b/www/apt-cacher-ng/files/patch-source_tcpconnect.cc
index e10141f199a3..a45065470499 100644
--- a/www/apt-cacher-ng/files/patch-source_tcpconnect.cc
+++ b/www/apt-cacher-ng/files/patch-source_tcpconnect.cc
@@ -1,6 +1,6 @@
---- source/tcpconnect.cc.orig	2018-09-07 13:02:18 UTC
+--- source/tcpconnect.cc.orig	2020-02-03 18:54:57 UTC
 +++ source/tcpconnect.cc
-@@ -41,13 +41,13 @@ atomic_int nConCount(0), nDisconCount(0)
+@@ -41,13 +41,13 @@ atomic_int nConCount(0), nDisconCount(0), nReuseCount(
  #include <openssl/crypto.h>
  #include <openssl/x509_vfy.h>
  #include <openssl/x509v3.h>
@@ -15,3 +15,13 @@
  
  namespace acng
  {
+@@ -626,7 +626,9 @@ void globalSslInit()
+ 		return;
+ 	inited = true;
+ 	SSL_load_error_strings();
++#if OPENSSL_VERSION_NUMBER < 0x30000000L
+ 	ERR_load_BIO_strings();
++#endif
+ 	ERR_load_crypto_strings();
+ 	ERR_load_SSL_strings();
+ 	OpenSSL_add_all_algorithms();