git: 9b1f7bf184f8 - main - lang/ruby30: Optionize OPENSSL module builds

From: Muhammad Moinur Rahman <bofh_at_FreeBSD.org>
Date: Mon, 07 Aug 2023 23:40:38 UTC
The branch main has been updated by bofh:

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

commit 9b1f7bf184f8bf29ca0da06d5afb392af4eefe8e
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2023-08-07 18:41:45 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2023-08-07 22:00:18 +0000

    lang/ruby30: Optionize OPENSSL module builds
    
    - ruby 3.0 do not have official OpenSSL 3 support although some other
      vendors are merging patches from 3.1. Untill there is something solid
      optionize OPENSSL to build openssl modules only on 12 and 13 while
      turning off for 14.
    - Utilize USES=localbase
    - Considering no upstream support for OpenSSL on ruby 3.0 reduce the
      EXPIRATION_DATE to 2024-03-30(Last day of official support) as there
      is no point in carrying this over to the next quarterly.
    
    Approved by:    portmgr (blanket)
    Sponsored by:   The FreeBSD Foundation
---
 lang/ruby30/Makefile  | 21 +++++++++++++--------
 lang/ruby30/pkg-plist | 28 ++++++++++++++--------------
 2 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/lang/ruby30/Makefile b/lang/ruby30/Makefile
index b4910dd85f9e..0fdc6bfcc2e5 100644
--- a/lang/ruby30/Makefile
+++ b/lang/ruby30/Makefile
@@ -17,16 +17,14 @@ LICENSE_FILE_BSD2CLAUSE=${WRKSRC}/BSDL
 LICENSE_FILE_RUBY=	${WRKSRC}/COPYING
 
 DEPRECATED=	Please migrate to newer versions. Ruby 3.0 will reach its EoL on March 30, 2024
-EXPIRATION_DATE=2024-04-30
+EXPIRATION_DATE=2024-03-30
 
 # Using LIB_DEPENDS finds the libffi from gcc which causes problems
 BUILD_DEPENDS=	libffi>=0:devel/libffi
 LIB_DEPENDS=	libyaml.so:textproc/libyaml
 RUN_DEPENDS=	libffi>=0:devel/libffi
 
-USES=		autoreconf cpe ruby:none ssl tar:xz
-BROKEN_SSL=	openssl30 openssl31
-BROKEN_SSL_REASON=	Do not build openssl module
+USES=		autoreconf cpe localbase ruby:none tar:xz
 
 CONFIGURE_ARGS=	${RUBY_CONFIGURE_ARGS} \
 		--disable-rpath \
@@ -37,26 +35,28 @@ CONFIGURE_ARGS=	${RUBY_CONFIGURE_ARGS} \
 		--with-sitedir="${PREFIX}/lib/ruby/site_ruby" \
 		--with-vendordir="${PREFIX}/lib/ruby/vendor_ruby"
 CONFIGURE_ENV=	debugflags=
-CPPFLAGS+=	-I${LOCALBASE}/include
 GNU_CONFIGURE=	yes
 # Keep this, else ruby will fail to load libraries dependent of libpthread.
-LIBS+=		-lpthread -L${LOCALBASE}/lib
+LIBS+=		-lpthread
 USE_LDCONFIG=	yes
 WRKSRC=		${RUBY_WRKSRC}
 
 RUBY_VER=		3.0
 
-OPTIONS_DEFINE=		CAPIDOCS DEBUG DOCS EXAMPLES GMP RDOC
-OPTIONS_DEFAULT=	RDOC LIBEDIT
+OPTIONS_DEFINE=		CAPIDOCS DEBUG DOCS EXAMPLES GMP RDOC OPENSSL
+OPTIONS_DEFAULT=	RDOC LIBEDIT OPENSSL
 OPTIONS_SINGLE=		EDIT
 OPTIONS_SINGLE_EDIT=	LIBEDIT READLINE
 OPTIONS_SUB=		yes
+OPTIONS_EXCLUDE_FreeBSD_14=	OPENSSL
+
 CAPIDOCS_DESC=		Build and install C API documents
 GMP_DESC=		Use GMP to accelerate Bignum operations
 RDOC_DESC=		Build and install Rdoc indexes
 EDIT_DESC=		Which line editing lib to use
 LIBEDIT_DESC=		Use libedit
 READLINE_DESC=		Use libreadline
+
 CAPIDOCS_BUILD_DEPENDS=	doxygen>=1.8.13,2:devel/doxygen \
 			dot:graphics/graphviz
 CAPIDOCS_CONFIGURE_ENABLE=	install-capi
@@ -64,6 +64,7 @@ GMP_CONFIGURE_WITH=	gmp
 GMP_LIB_DEPENDS=	libgmp.so:math/gmp
 LIBEDIT_CONFIGURE_ON=	--enable-libedit --with-libedit-dir=${LOCALBASE}
 LIBEDIT_USES=		libedit
+OPENSSL_USES=	ssl
 RDOC_CONFIGURE_ENABLE=	install-rdoc
 READLINE_CONFIGURE_ON=	--disable-libedit --with-readline-dir=${LOCALBASE}
 READLINE_USES=		readline
@@ -113,6 +114,10 @@ PKGNAMESUFFIX=	${RUBY_SUFFIX}
 PLIST_SUB+=	IF_DEFAULT="@comment "
 .endif
 
+.if ( ${OPSYS} == FreeBSD && ${OSVERSION} >= 1400092 && ${SSL_DEFAULT} == base ) || ${SSL_DEFAULT:Mopenssl3*}
+OPTIONS_EXCLUDE=	OPENSSL
+.endif
+
 INSTALLED_SCRIPTS=	ruby
 INSTALLED_MANUALS=	ruby
 
diff --git a/lang/ruby30/pkg-plist b/lang/ruby30/pkg-plist
index a2d40ba6c097..6cc84a998900 100644
--- a/lang/ruby30/pkg-plist
+++ b/lang/ruby30/pkg-plist
@@ -271,7 +271,7 @@ lib/libruby%%RUBY_SHLIBVER%%.so.%%RUBY_SHLIBVER%%
 %%RUBY_ARCHLIBDIR%%/monitor.so
 %%RUBY_ARCHLIBDIR%%/nkf.so
 %%RUBY_ARCHLIBDIR%%/objspace.so
-%%RUBY_ARCHLIBDIR%%/openssl.so
+%%OPENSSL%%%%RUBY_ARCHLIBDIR%%/openssl.so
 %%RUBY_ARCHLIBDIR%%/pathname.so
 %%RUBY_ARCHLIBDIR%%/psych.so
 %%RUBY_ARCHLIBDIR%%/pty.so
@@ -472,19 +472,19 @@ lib/libruby%%RUBY_SHLIBVER%%.so.%%RUBY_SHLIBVER%%
 %%RUBY_LIBDIR%%/observer.rb
 %%RUBY_LIBDIR%%/open-uri.rb
 %%RUBY_LIBDIR%%/open3.rb
-%%RUBY_LIBDIR%%/openssl.rb
-%%RUBY_LIBDIR%%/openssl/bn.rb
-%%RUBY_LIBDIR%%/openssl/buffering.rb
-%%RUBY_LIBDIR%%/openssl/cipher.rb
-%%RUBY_LIBDIR%%/openssl/config.rb
-%%RUBY_LIBDIR%%/openssl/digest.rb
-%%RUBY_LIBDIR%%/openssl/hmac.rb
-%%RUBY_LIBDIR%%/openssl/marshal.rb
-%%RUBY_LIBDIR%%/openssl/pkcs5.rb
-%%RUBY_LIBDIR%%/openssl/pkey.rb
-%%RUBY_LIBDIR%%/openssl/ssl.rb
-%%RUBY_LIBDIR%%/openssl/version.rb
-%%RUBY_LIBDIR%%/openssl/x509.rb
+%%OPENSSL%%%%RUBY_LIBDIR%%/openssl.rb
+%%OPENSSL%%%%RUBY_LIBDIR%%/openssl/bn.rb
+%%OPENSSL%%%%RUBY_LIBDIR%%/openssl/buffering.rb
+%%OPENSSL%%%%RUBY_LIBDIR%%/openssl/cipher.rb
+%%OPENSSL%%%%RUBY_LIBDIR%%/openssl/config.rb
+%%OPENSSL%%%%RUBY_LIBDIR%%/openssl/digest.rb
+%%OPENSSL%%%%RUBY_LIBDIR%%/openssl/hmac.rb
+%%OPENSSL%%%%RUBY_LIBDIR%%/openssl/marshal.rb
+%%OPENSSL%%%%RUBY_LIBDIR%%/openssl/pkcs5.rb
+%%OPENSSL%%%%RUBY_LIBDIR%%/openssl/pkey.rb
+%%OPENSSL%%%%RUBY_LIBDIR%%/openssl/ssl.rb
+%%OPENSSL%%%%RUBY_LIBDIR%%/openssl/version.rb
+%%OPENSSL%%%%RUBY_LIBDIR%%/openssl/x509.rb
 %%RUBY_LIBDIR%%/optionparser.rb
 %%RUBY_LIBDIR%%/optparse.rb
 %%RUBY_LIBDIR%%/optparse/ac.rb