Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jan 2024 12:09:15 GMT
From:      Matthias Fechner <mfechner@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-branches@FreeBSD.org
Subject:   git: d4326d554ac1 - 2024Q1 - gem: make it possible to generate gems that require rust/cargo
Message-ID:  <202401151209.40FC9Fmu073566@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch 2024Q1 has been updated by mfechner:

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

commit d4326d554ac1da8b1847251800cebd4a0bfeb49b
Author:     Matthias Fechner <mfechner@FreeBSD.org>
AuthorDate: 2024-01-03 09:32:55 +0000
Commit:     Matthias Fechner <mfechner@FreeBSD.org>
CommitDate: 2024-01-15 12:06:59 +0000

    gem: make it possible to generate gems that require rust/cargo
    
    Make sure cargo.mk and gem.mk can work together.
    If you want to use rust for your gem, have a look on
    devel/rubygem-prometheus-client-mmap as an example.
    
    Differential Revision:  https://reviews.freebsd.org/D43292
    
    (cherry picked from commit 87916ecbfac7532b4d3de63efa36ed8f8e637e36)
---
 Mk/Uses/gem.mk | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/Mk/Uses/gem.mk b/Mk/Uses/gem.mk
index a1e77273932a..69924ae3d172 100644
--- a/Mk/Uses/gem.mk
+++ b/Mk/Uses/gem.mk
@@ -23,9 +23,10 @@ IGNORE= Incorrect 'USES+= gem:${gem_ARGS}' usage: argument [${arg}] is not recog
 .include "${USESDIR}/ruby.mk"
 
 PKGNAMEPREFIX?=	rubygem-
-EXTRACT_SUFX=	.gem
-EXTRACT_ONLY=
-DIST_SUBDIR=	rubygem
+GEM_EXT=	.gem
+# needs to be disabled that rust cargo directories are correctly extracted
+#EXTRACT_ONLY=
+GEM_DIST_SUBDIR?=	rubygem
 
 BUILD_DEPENDS+=	${RUBYGEMBIN}:devel/ruby-gems
 EXTRACT_DEPENDS+=	${RUBYGEMBIN}:devel/ruby-gems
@@ -63,15 +64,16 @@ PLIST_SUB+=	PORTVERSION="${PORTVERSION}" \
 		GEM_DOC_DIR="${GEM_DOC_DIR}" \
 		GEM_SPEC="${GEM_SPEC}" \
 		GEM_CACHE="${GEM_CACHE}" \
-		EXTRACT_SUFX="${EXTRACT_SUFX}"
+		GEM_EXT="${GEM_EXT}"
 
 RUBYGEMBIN=	${LOCALBASE}/bin/gem
 
 .  if defined(DISTFILES)
-GEMFILES=	${DISTFILES:C/:[^:]+$//}
+GEMFILES?=	${DISTFILES:C/:[^:]+$//}
 .  else
-GEMFILES=	${DISTNAME}${EXTRACT_SUFX}
+GEMFILES?=	${DISTNAME}${GEM_EXT}
 .  endif
+DISTFILES+=	${GEM_DIST_SUBDIR}/${GEMFILES}
 
 RUBYGEM_ARGS=-l --no-update-sources --install-dir ${STAGEDIR}${PREFIX}/lib/ruby/gems/${RUBY_VER} --ignore-dependencies --bindir=${STAGEDIR}${PREFIX}/bin
 
@@ -81,17 +83,16 @@ RUBYGEM_ARGS+=	--document rdoc,ri
 RUBYGEM_ARGS+=	--no-document
 .  endif
 
-.  if !target(do-extract)
-do-extract:
-	@${SETENV} ${GEM_ENV} ${RUBYGEMBIN} unpack --target=${WRKDIR} ${DISTDIR}/${DIST_SUBDIR}/${GEMFILES}
-	@(cd ${BUILD_WRKSRC}; if ! ${SETENV} ${GEM_ENV} ${RUBYGEMBIN} spec --ruby ${DISTDIR}/${DIST_SUBDIR}/${GEMFILES} > ${GEMSPEC} ; then \
+_USES_extract+=		590:gem-extract
+gem-extract:
+	@${SETENV} ${GEM_ENV} ${RUBYGEMBIN} unpack --target=${WRKDIR} ${DISTDIR}/${GEM_DIST_SUBDIR}/${GEMFILES}
+	@(cd ${BUILD_WRKSRC}; if ! ${SETENV} ${GEM_ENV} ${RUBYGEMBIN} spec --ruby ${DISTDIR}/${GEM_DIST_SUBDIR}/${GEMFILES} > ${GEMSPEC} ; then \
 		if [ -n "${BUILD_FAIL_MESSAGE}" ] ; then \
 			${ECHO_MSG} "===> Extraction failed unexpectedly."; \
 			(${ECHO_CMD} "${BUILD_FAIL_MESSAGE}") | ${FMT_80} ; \
 			fi; \
 		${FALSE}; \
 		fi)
-.  endif
 
 .  if !target(do-build)
 do-build:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401151209.40FC9Fmu073566>