pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang/ruby Add GEM_CLEANBUOLD_EXTENSIONS and GEM_EXTSDI...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/2914add1036e
branches:  trunk
changeset: 631775:2914add1036e
user:      taca <taca%pkgsrc.org@localhost>
date:      Thu Mar 13 17:21:01 2014 +0000

description:
Add GEM_CLEANBUOLD_EXTENSIONS and GEM_EXTSDIR macro and related rules
to support rubygems bundled with Ruby 2.1.1 (Rubygems 2.2 and later?).

diffstat:

 lang/ruby/gem.mk |  61 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 55 insertions(+), 6 deletions(-)

diffs (146 lines):

diff -r 64e735105279 -r 2914add1036e lang/ruby/gem.mk
--- a/lang/ruby/gem.mk  Thu Mar 13 17:06:42 2014 +0000
+++ b/lang/ruby/gem.mk  Thu Mar 13 17:21:01 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: gem.mk,v 1.26 2014/02/09 05:15:21 taca Exp $
+# $NetBSD: gem.mk,v 1.27 2014/03/13 17:21:01 taca Exp $
 #
 # This Makefile fragment is intended to be included by packages that build
 # and install Ruby gems.
@@ -92,6 +92,11 @@
 #
 #          GEM_CLEANBUILD=     *.o *.${RUBY_DLEXT} mkmf.log
 #
+# GEM_CLEANBUOLD_EXTENSIONS
+#      A list of shell globs representing files under ${RUBY_EXTSDIR}.
+#      These files will be additionaly removed from the gem installed in
+#      the installation root.
+#
 # GEM_NAME
 #      The name of the gem to install.  The default value is ${DISTNAME}.
 #
@@ -114,6 +119,12 @@
 #      The relative path from PREFIX to the directory in the local gem
 #      repository that holds the contents of the installed gem.
 #
+# GEM_EXTSDIR
+#      "extensions" directory under ${GEM_HOME}.  It is generated by
+#      rubygems 2.2 and later.
+#      In PLIST file, it will be replace to "${GEM_HOME}/extensions" or
+#      "@comment ..." depends on the version of rubygems.
+#
 # RUBYGEM
 #      The path to the rubygems ``gem'' script.
 #
@@ -147,6 +158,9 @@
                        { gsub(/${GEM_NAME}\.gem/, "$${GEM_NAME}.gem"); }
 PRINT_PLIST_AWK+=      /${GEM_NAME:S/./[.]/g}[.](gem|gemspec)$$/ \
        { gsub(/${PKGVERSION_NOREV:S|/|\\/|g}[.]gem/, "$${PKGVERSION}.gem"); }
+PRINT_PLIST_AWK+=      /^${GEM_EXTSDIR:S|/|\\/|g}/ \
+               { gsub(/${GEM_EXTSDIR:S|/|\\/|g}/, "$${GEM_EXTSDIR}"); \
+                       print; next; }
 PRINT_PLIST_AWK+=      /^${GEM_LIBDIR:S|/|\\/|g}/ \
        { gsub(/${GEM_LIBDIR:S|/|\\/|g}/, "$${GEM_LIBDIR}"); print; next; }
 PRINT_PLIST_AWK+=      /^${GEM_DOCDIR:S|/|\\/|g}/ \
@@ -170,6 +184,11 @@
 # build tool.
 #
 
+.if !empty(RUBY_GEMS_VERSION)
+_RUBYGEMS_MAJOR=       ${RUBY_GEMS_VERSION:C/\.[0-9\.]+$//}
+_RUBYGEMS_MINORS=      ${RUBY_GEMS_VERSION:C/^([0-9]+)\.*//}
+.endif
+
 .if ${RUBY_VER} == "18"
 BUILD_DEPENDS+=        ${RUBY_PKGPREFIX}-rubygems>=1.1.0:../../misc/rubygems
 DEPENDS+=      ${RUBY_PKGPREFIX}-rubygems>=1.0.1:../../misc/rubygems
@@ -179,9 +198,6 @@
 _RUBYGEMS_REQD_MAJOR=  ${RUBYGEMS_REQD:C/\.[0-9\.]+$//}
 _RUBYGEMS_REQD_MINORS= ${RUBYGEMS_REQD:C/^([0-9]+)\.*//}
 
-_RUBYGEMS_MAJOR=       ${RUBY_GEMS_VERSION:C/\.[0-9\.]+$//}
-_RUBYGEMS_MINORS=      ${RUBY_GEMS_VERSION:C/^([0-9]+)\.*//}
-
 _RUBYGEMS_REQD=        NO
 
 .  if ${_RUBYGEMS_REQD_MAJOR} > ${_RUBYGEMS_MAJOR}
@@ -223,6 +239,14 @@
 GEM_DOCDIR=    ${GEM_HOME}/doc/${GEM_NAME}
 GEM_LIBDIR=    ${GEM_HOME}/gems/${GEM_NAME}
 
+GEM_BUILDINFO_DIR=     ${GEM_HOME}/build_info
+
+.if !empty(RUBY_GEMS_VERSION)
+.if ${_RUBYGEMS_MAJOR} >= 2 && ${_RUBYGEMS_MINORS} >= 2
+GEM_EXTSDIR=   ${GEM_HOME}/extensions/${RUBY_ARCH}/${RUBY_VERSION}/${GEM_NAME}
+.endif
+.endif
+
 # Installed gems have wrapper scripts that call the right interpreter,
 # regardless of the #! line at the head of a script, so we can skip
 # the interpreter path check for gems.  ANd it is also true for files'
@@ -240,6 +264,12 @@
 PLIST_SUBST+=          GEM_LIBDIR=${GEM_LIBDIR}
 PLIST_SUBST+=          GEM_DOCDIR=${GEM_DOCDIR}
 
+.if !empty(GEM_EXTSDIR)
+PLIST_SUBST+=          GEM_EXTSDIR=${GEM_EXTSDIR}
+.else
+PLIST_SUBST+=          GEM_EXTSDIR="@comment "
+.endif
+
 ###
 ### gem-extract
 ###
@@ -270,12 +300,17 @@
 ### The local gem is then installed into a special build root under
 ### ${WRKDIR} (${RUBYGEM_INSTALL_ROOT}), possibly compiling any extensions.
 ###
-GEM_CLEANBUILD?=       ext/*
+GEM_CLEANBUILD?=               ext/*
+GEM_CLEANBUOLD_EXTENSIONS+=    gem.build_complete *.out *.log
 
 .if !empty(GEM_CLEANBUILD:M/*) || !empty(GEM_CLEANBUILD:M*../*)
 PKG_FAIL_REASON=       "GEM_CLEANBUILD must be relative to "${PREFIX}/${GEM_LIBDIR:Q}"."
 .endif
 
+.if !empty(GEM_CLEANBUOLD_EXTENSIONS:M/*) || !empty(GEM_CLEANBUOLD_EXTENSIONS:M*../*)
+PKG_FAIL_REASON=       "GEM_CLEANBUOLD_EXTENSIONS must be relative to "${PREFIX}/${GEM_LIBDIR:Q}"."
+.endif
+
 .PHONY: gem-build
 do-build: _gem-pre-build gem-build
 
@@ -342,10 +377,11 @@
        ${RUN} ${TEST} -f ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_CACHEDIR}/${GEM_NAME}.gem || \
                ${FAIL_MSG} "Installing ${GEM_NAME}.gem into installation root failed."
 
-.if !empty(GEM_CLEANBUILD)
+.if !empty(GEM_CLEANBUILD) || !empty(GEM_CLEANBUOLD_EXTENSIONS)
 .PHONY: _gem-build-cleanbuild
 _gem-build-cleanbuild:
        @${STEP_MSG} "Cleaning intermediate gem build files"
+.if !empty(GEM_CLEANBUILD)
        ${RUN} cd ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_LIBDIR} &&     \
        find . -print | sort -r |                                       \
        while read file; do                                             \
@@ -366,6 +402,19 @@
                fi;                                                     \
        done
 .endif
+.if !empty(GEM_EXTSDIR) && !empty(GEM_CLEANBUOLD_EXTENSIONS)
+       ${RUN} \
+       if test ! -d ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_EXTSDIR}; then \
+               :; \
+       else \
+               cd ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_EXTSDIR} && \
+               for f in ${GEM_CLEANBUOLD_EXTENSIONS}; do \
+                       echo "rm -f $$f"; \
+                       rm -f $$f; \
+               done; \
+       fi
+.endif
+.endif
 
 ###
 ### gem-install



Home | Main Index | Thread Index | Old Index