summaryrefslogtreecommitdiff
path: root/misc/rubygems
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2008-03-13 22:20:04 +0000
committerjlam <jlam@pkgsrc.org>2008-03-13 22:20:04 +0000
commit5420ec3544e6b88183054e8b16af472fff571510 (patch)
tree942cda44641f2ec991f8716aef15c57893339d0a /misc/rubygems
parent5ccfe84922ae755e406482a691170d4695edf391 (diff)
downloadpkgsrc-5420ec3544e6b88183054e8b16af472fff571510.tar.gz
+ 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/).
Diffstat (limited to 'misc/rubygems')
-rw-r--r--misc/rubygems/rubygem.mk31
1 files changed, 29 insertions, 2 deletions
diff --git a/misc/rubygems/rubygem.mk b/misc/rubygems/rubygem.mk
index a1a816b4f81..73c488c0345 100644
--- a/misc/rubygems/rubygem.mk
+++ b/misc/rubygems/rubygem.mk
@@ -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-gemspec-build:
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 @@ _gem-install-buildroot:
${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 | \