diff options
author | taca <taca@pkgsrc.org> | 2014-03-13 17:21:01 +0000 |
---|---|---|
committer | taca <taca@pkgsrc.org> | 2014-03-13 17:21:01 +0000 |
commit | 72e9c17d1f113fcee605cf07ae2db636b559d37a (patch) | |
tree | dc2755568ea0e199141dc4fae05b926d9aa9f8dd /lang | |
parent | 109bf3df96cec60111ffbc10c43f8d5b6d5b6900 (diff) | |
download | pkgsrc-72e9c17d1f113fcee605cf07ae2db636b559d37a.tar.gz |
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 (limited to 'lang')
-rw-r--r-- | lang/ruby/gem.mk | 61 |
1 files changed, 55 insertions, 6 deletions
diff --git a/lang/ruby/gem.mk b/lang/ruby/gem.mk index 4cf5980ad1d..b32a82c1ed5 100644 --- a/lang/ruby/gem.mk +++ b/lang/ruby/gem.mk @@ -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 @@ PRINT_PLIST_AWK+= /${GEM_NAME}\.(gem|gemspec)$$/ \ { 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 @@ PRINT_PLIST_AWK+= /^${RUBY_GEM_BASE:S|/|\\/|g}/ \ # 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 @@ DEPENDS+= ${RUBY_PKGPREFIX}-rubygems>=1.0.1:../../misc/rubygems _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_CACHEDIR= ${GEM_HOME}/cache 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_NAME=${GEM_NAME} 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 @@ gem-extract: fake-home ### 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 @@ _gem-build-install-root-check: ${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 @@ _gem-build-cleanbuild: 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 |