git: 84f001c6c642 - main - lang/ruby3[1-3]: Refine ports

From: Yasuhiro Kimura <yasu_at_FreeBSD.org>
Date: Tue, 14 May 2024 04:30:32 UTC
The branch main has been updated by yasu:

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

commit 84f001c6c642cf3c87f6fc4a0a1327dc5182cf1c
Author:     Daniel Engberg <diizzy@FreeBSD.org>
AuthorDate: 2024-05-14 04:26:43 +0000
Commit:     Yasuhiro Kimura <yasu@FreeBSD.org>
CommitDate: 2024-05-14 04:26:43 +0000

    lang/ruby3[1-3]: Refine ports
    
    * Skip extracting unnecessary files by setting EXTRACT_AFTER_ARGS
      instead of removing them with post-patch target after they are
      extracted.
    * Use 'USES=localbase' to set path of header and library files.
    
    PR:             278764
---
 lang/ruby31/Makefile | 22 ++++++++++++----------
 lang/ruby32/Makefile | 22 ++++++++++++----------
 lang/ruby33/Makefile | 22 ++++++++++++----------
 3 files changed, 36 insertions(+), 30 deletions(-)

diff --git a/lang/ruby31/Makefile b/lang/ruby31/Makefile
index dff40081c447..75a11f27f740 100644
--- a/lang/ruby31/Makefile
+++ b/lang/ruby31/Makefile
@@ -23,12 +23,22 @@ 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
+USES=		autoreconf cpe localbase ruby:none ssl tar:xz
 CPE_VENDOR=	ruby-lang
 CPE_VERSION=	${RUBY_RELVERSION}
 CPE_UPDATE=	p${RUBY_PATCHLEVEL}
 USE_LDCONFIG=	yes
 
+# We get these from other ports
+EXTRACT_AFTER_ARGS=	--exclude ${DISTNAME}/bin/gem \
+			--exclude ${DISTNAME}/ext/win32* \
+			--exclude ${DISTNAME}/lib/bundler* \
+			--exclude ${DISTNAME}/libexec/bundler \
+			--exclude ${DISTNAME}/man/erb.1 \
+			--exclude ${DISTNAME}/man/irb.1 \
+			--exclude ${DISTNAME}/man/ri.1 \
+			--no-same-owner --no-same-permissions
+
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	${RUBY_CONFIGURE_ARGS} \
 		--disable-rpath \
@@ -40,9 +50,8 @@ CONFIGURE_ARGS=	${RUBY_CONFIGURE_ARGS} \
 		--with-vendordir="${PREFIX}/lib/ruby/vendor_ruby"
 CONFIGURE_ENV=	debugflags=
 
-CPPFLAGS+=	-I${LOCALBASE}/include
 # Keep this, else ruby will fail to load libraries dependent of libpthread.
-LIBS+=		-lpthread -L${LOCALBASE}/lib
+LIBS+=		-lpthread
 WRKSRC=		${RUBY_WRKSRC}
 
 RUBY_VER=	3.1
@@ -124,13 +133,6 @@ RB_SET_CONF_VAR=	${SH} -c \
 			'${REINPLACE_CMD} -E -e "s,(CONFIG\[\"$$0\"\][[:space:]]*=[[:space:]]*)(\(?)(.*)(\)?),\1\2$$1\4," ${WRKSRC}/rbconfig.rb' \
 			--
 
-post-patch:
-# We get these from other ports
-.for d in bin/* ext/dbm ext/gdbm ext/win32* lib/bundler* libexec/bundler* \
-	man/bundle* man/erb.1 man/gemfile* man/irb.1 man/ri.1
-	@${RM} -r ${BUILD_WRKSRC}/${d}
-.endfor
-
 post-build:
 #
 # Hack to allow modules to be installed into separate PREFIX and/or under user
diff --git a/lang/ruby32/Makefile b/lang/ruby32/Makefile
index 846728ac4f45..45894febd124 100644
--- a/lang/ruby32/Makefile
+++ b/lang/ruby32/Makefile
@@ -19,12 +19,22 @@ 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
+USES=		autoreconf cpe localbase ruby:none ssl tar:xz
 CPE_VENDOR=	ruby-lang
 CPE_VERSION=	${RUBY_RELVERSION}
 CPE_UPDATE=	p${RUBY_PATCHLEVEL}
 USE_LDCONFIG=	yes
 
+# We get these from other ports
+EXTRACT_AFTER_ARGS=	--exclude ${DISTNAME}/bin/gem \
+			--exclude ${DISTNAME}/ext/win32* \
+			--exclude ${DISTNAME}/lib/bundler* \
+			--exclude ${DISTNAME}/libexec/bundler \
+			--exclude ${DISTNAME}/man/erb.1 \
+			--exclude ${DISTNAME}/man/irb.1 \
+			--exclude ${DISTNAME}/man/ri.1 \
+			--no-same-owner --no-same-permissions
+
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	${RUBY_CONFIGURE_ARGS} \
 		--disable-rpath \
@@ -36,9 +46,8 @@ CONFIGURE_ARGS=	${RUBY_CONFIGURE_ARGS} \
 		--with-vendordir="${PREFIX}/lib/ruby/vendor_ruby"
 CONFIGURE_ENV=	debugflags=
 
-CPPFLAGS+=	-I${LOCALBASE}/include
 # Keep this, else ruby will fail to load libraries dependent of libpthread.
-LIBS+=		-lpthread -L${LOCALBASE}/lib
+LIBS+=		-lpthread
 WRKSRC=		${RUBY_WRKSRC}
 
 RUBY_VER=	3.2
@@ -123,13 +132,6 @@ RB_SET_CONF_VAR=	${SH} -c \
 			'${REINPLACE_CMD} -E -e "s,(CONFIG\[\"$$0\"\][[:space:]]*=[[:space:]]*)(\(?)(.*)(\)?),\1\2$$1\4," ${WRKSRC}/rbconfig.rb' \
 			--
 
-post-patch:
-# We get these from other ports
-.for d in bin/* ext/dbm ext/gdbm ext/win32* lib/bundler* libexec/bundler* \
-	man/bundle* man/erb.1 man/gemfile* man/irb.1 man/ri.1
-	@${RM} -r ${BUILD_WRKSRC}/${d}
-.endfor
-
 post-build:
 #
 # Hack to allow modules to be installed into separate PREFIX and/or under user
diff --git a/lang/ruby33/Makefile b/lang/ruby33/Makefile
index b2d3e8bdb269..c861bdf7f083 100644
--- a/lang/ruby33/Makefile
+++ b/lang/ruby33/Makefile
@@ -20,12 +20,22 @@ 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
+USES=		autoreconf cpe localbase ruby:none ssl tar:xz
 CPE_VENDOR=	ruby-lang
 CPE_VERSION=	${RUBY_RELVERSION}
 CPE_UPDATE=	p${RUBY_PATCHLEVEL}
 USE_LDCONFIG=	yes
 
+# We get these from other ports
+EXTRACT_AFTER_ARGS=	--exclude ${DISTNAME}/bin/gem \
+			--exclude ${DISTNAME}/ext/win32* \
+			--exclude ${DISTNAME}/lib/bundler* \
+			--exclude ${DISTNAME}/libexec/bundler \
+			--exclude ${DISTNAME}/man/erb.1 \
+			--exclude ${DISTNAME}/man/irb.1 \
+			--exclude ${DISTNAME}/man/ri.1 \
+			--no-same-owner --no-same-permissions
+
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	${RUBY_CONFIGURE_ARGS} \
 		--disable-rpath \
@@ -37,9 +47,8 @@ CONFIGURE_ARGS=	${RUBY_CONFIGURE_ARGS} \
 		--with-vendordir="${PREFIX}/lib/ruby/vendor_ruby"
 CONFIGURE_ENV=	debugflags=
 
-CPPFLAGS+=	-I${LOCALBASE}/include
 # Keep this, else ruby will fail to load libraries dependent of libpthread.
-LIBS+=		-lpthread -L${LOCALBASE}/lib
+LIBS+=		-lpthread
 WRKSRC=		${RUBY_WRKSRC}
 
 RUBY_VER=	3.3
@@ -115,13 +124,6 @@ RB_SET_CONF_VAR=	${SH} -c \
 post-extract-DOCS-on:
 	${MV} ${WRKSRC}/ChangeLog ${WRKSRC}/doc/ChangeLog
 
-post-patch:
-# We get these from other ports
-.for d in bin/* ext/dbm ext/gdbm ext/win32* lib/bundler* libexec/bundler* \
-	man/bundle* man/erb.1 man/gemfile* man/irb.1 man/ri.1
-	@${RM} -r ${BUILD_WRKSRC}/${d}
-.endfor
-
 post-build:
 #
 # Hack to allow modules to be installed into separate PREFIX and/or under user