Thu Mar 13 22:20:04 2008 UTC ()
+ Modify gem-rake-build to find the generated .gem file in the event
  that the Rakefile creates it in a non-standard place.

+ Create a new variable GEM_CLEANBUILD which is a list of globs for
  files to remove from the gem installed in the buildroot in the
  _gem-install-cleanbuild target.  This allows for packages with a
  non-standard gem directory structure (one that has the .c files
  under ext/).


(jlam)
diff -r1.15 -r1.16 pkgsrc/misc/rubygems/rubygem.mk

cvs diff -r1.15 -r1.16 pkgsrc/misc/rubygems/Attic/rubygem.mk (expand / switch to context diff)
--- pkgsrc/misc/rubygems/Attic/rubygem.mk 2008/03/13 18:29:20 1.15
+++ pkgsrc/misc/rubygems/Attic/rubygem.mk 2008/03/13 22:20:04 1.16
@@ -1,4 +1,4 @@
-# $NetBSD: rubygem.mk,v 1.15 2008/03/13 18:29:20 jlam Exp $
+# $NetBSD: rubygem.mk,v 1.16 2008/03/13 22:20:04 jlam Exp $
 #
 # This Makefile fragment is intended to be included by packages that build
 # and install Ruby gems.
@@ -11,6 +11,10 @@
 #	Possible: gemspec, rake
 #	Default: rake
 #
+# GEM_CLEANBUILD
+#	A list of shell globs representing files to remove from the
+#	gem installed in the buildroot.
+#
 # GEM_NAME
 #	The name of the gem to install.  The default value is ${DISTNAME}.
 #
@@ -147,7 +151,12 @@
 
 gem-rake-build:
 	${RUN} cd ${WRKSRC} && ${RAKE} gem
-	${RUN} cd ${WRKSRC} && ln -fs pkg/${GEMFILE} .
+	${RUN} cd ${WRKSRC} && rm -f ${GEMFILE}
+	${RUN} cd ${WRKSRC} && find . -name ${GEMFILE} -print | \
+	while read file; do \
+		ln -fs "$$file" ${GEMFILE}; \
+		exit 0; \
+	done
 
 ###
 ### gem-install
@@ -189,8 +198,26 @@
 	${RUN} ${SETENV} ${INSTALL_ENV} ${MAKE_ENV} \
 		${RUBYGEM} install ${_RUBYGEM_OPTIONS}
 
+GEM_CLEANBUILD?=	# empty
+.if !empty(GEM_CLEANBUILD:M/*) || !empty(GEM_CLEANBUILD:M*../*)
+PKG_FAIL_REASON=	"GEM_CLEANBUILD must be relative to "${GEM_LIBDIR:Q}"."
+.endif
+
 _gem-install-cleanbuild:
 	@${STEP_MSG} "Cleaning intermediate gem build files"
+.if !empty(GEM_CLEANBUILD)
+	${RUN} cd ${_RUBYGEM_BUILDROOT}${GEM_LIBDIR} &&			\
+	ls ${GEM_CLEANBUILD} |						\
+	while read file; do						\
+		if [ -d "$$file" ]; then				\
+			echo "rmdir "${GEM_LIBDIR:T}"/$$file";		\
+			rmdir $$file;					\
+		else							\
+			echo "rm "${GEM_LIBDIR:T}"/$$file";		\
+			rm -f $$file;					\
+		fi;							\
+	done
+.endif
 	${RUN} if [ -d ${_RUBYGEM_BUILDROOT}${GEM_LIBDIR}/ext ]; then	\
 		cd ${_RUBYGEM_BUILDROOT}${GEM_LIBDIR} &&		\
 		find ext -print | sort -r |				\