2021-01-11 12:21:31 +01:00
|
|
|
# $NetBSD: gem.mk,v 1.45 2021/01/11 11:21:31 taca Exp $
|
2010-09-10 05:12:02 +02:00
|
|
|
#
|
|
|
|
# This Makefile fragment is intended to be included by packages that build
|
|
|
|
# and install Ruby gems.
|
|
|
|
#
|
2021-01-11 07:51:27 +01:00
|
|
|
# === User-settable variables ===
|
|
|
|
#
|
|
|
|
# RUBYGEM_VERBOSE
|
|
|
|
# Execute gem with verbose option.
|
|
|
|
# Possible values: Yes No
|
|
|
|
# Default: No
|
|
|
|
#
|
2010-09-10 05:12:02 +02:00
|
|
|
# Package-settable variables:
|
|
|
|
#
|
2011-08-12 16:35:34 +02:00
|
|
|
# OVERRIDE_GEMSPEC
|
2012-03-02 04:46:09 +01:00
|
|
|
# Fix version of depending gem or modify files in gemspec.
|
2011-08-12 16:35:34 +02:00
|
|
|
#
|
2012-03-02 04:46:09 +01:00
|
|
|
# (1) Specify as gem and dependency pattern as usual pkgsrc's one.
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
# When gemspec contains "json~>1.4.7" as runtime dependency
|
|
|
|
# (i.e. json>=1.4.7<1.5) and if you want to relax it to
|
|
|
|
# "json>=1.4.6" then use:
|
2013-04-08 13:17:08 +02:00
|
|
|
#
|
2012-03-02 04:46:09 +01:00
|
|
|
# OVERRIDE_GEMSPEC+= json>=1.4.6
|
2013-04-08 13:17:08 +02:00
|
|
|
#
|
2012-03-02 04:46:09 +01:00
|
|
|
# If you want to change depending gem to "json_pure>=1.4.6"
|
|
|
|
# then use:
|
2013-04-08 13:17:08 +02:00
|
|
|
#
|
2012-03-02 04:46:09 +01:00
|
|
|
# OVERRIDE_GEMSPEC+= json:json_pure>=1.4.6
|
2013-04-08 13:17:08 +02:00
|
|
|
#
|
2012-03-02 04:46:09 +01:00
|
|
|
# You can also remove dependency:
|
2013-04-08 13:17:08 +02:00
|
|
|
#
|
2012-03-02 04:46:09 +01:00
|
|
|
# OVERRIDE_GEMSPEC+= json:
|
|
|
|
#
|
2013-03-07 17:42:53 +01:00
|
|
|
# (2) Modify instance of gemspec.
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
# Rename gem's name to "foo" (setting instance @name):
|
|
|
|
#
|
|
|
|
# OVERRIDE_GEMSPEC+= :name=foo
|
2012-03-02 04:46:09 +01:00
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
# Remove files (a.rb and b.rb) from 'files':
|
2011-08-12 16:35:34 +02:00
|
|
|
#
|
2012-03-02 04:46:09 +01:00
|
|
|
# OVERRIDE_GEMSPEC+= :files a.rb= b.rb=
|
2011-08-12 16:35:34 +02:00
|
|
|
#
|
2012-03-02 04:46:09 +01:00
|
|
|
# Example:
|
|
|
|
# Add a file (exec.rb) to 'executables':
|
2011-08-12 16:35:34 +02:00
|
|
|
#
|
2012-03-02 04:46:09 +01:00
|
|
|
# OVERRIDE_GEMSPEC+= :executables exec.rb
|
2011-08-12 16:35:34 +02:00
|
|
|
#
|
2012-03-02 04:46:09 +01:00
|
|
|
# Example:
|
|
|
|
# Rename a file (from 'ruby' to 'ruby193') in 'files':
|
2011-09-13 05:23:04 +02:00
|
|
|
#
|
2012-03-02 04:46:09 +01:00
|
|
|
# OVERRIDE_GEMSPEC+= :files ruby=ruby193
|
|
|
|
#
|
|
|
|
# Note: Because of limited parser, argumetns for (1) must preceed to (2).
|
2011-08-12 16:35:34 +02:00
|
|
|
#
|
|
|
|
# Default: (empty)
|
|
|
|
#
|
2013-04-02 17:22:39 +02:00
|
|
|
# GEM_PATH
|
|
|
|
# Set GEM_PATH; search path for rubygems
|
|
|
|
#
|
|
|
|
# Default: ${PREFIX}/${GEM_HOME}
|
|
|
|
#
|
2010-09-10 05:12:02 +02:00
|
|
|
# BUILD_TARGET
|
|
|
|
# The Rakefile target that creates a local gem if using the
|
|
|
|
# ``rake'' GEM_BUILD method.
|
|
|
|
#
|
|
|
|
# Default: gem
|
|
|
|
#
|
|
|
|
# GEM_BUILD
|
|
|
|
# The method used to build the local gem.
|
|
|
|
#
|
|
|
|
# Possible: gemspec, rake
|
|
|
|
# Default: gemspec
|
|
|
|
#
|
|
|
|
# GEM_CLEANBUILD
|
|
|
|
# A list of shell globs representing files to remove from the
|
|
|
|
# gem installed in the installation root. The file is removed
|
|
|
|
# if the path matches the glob and is not in ${WRKSRC}. The
|
|
|
|
# default is "ext/*"
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
#
|
2013-04-08 13:17:08 +02:00
|
|
|
# GEM_CLEANBUILD= *.o *.${RUBY_DLEXT} mkmf.log
|
2010-09-10 05:12:02 +02:00
|
|
|
#
|
2015-01-16 10:18:47 +01:00
|
|
|
# GEM_CLEANBUILD_EXTENSIONS
|
2014-03-13 18:21:01 +01:00
|
|
|
# A list of shell globs representing files under ${RUBY_EXTSDIR}.
|
|
|
|
# These files will be additionaly removed from the gem installed in
|
|
|
|
# the installation root.
|
|
|
|
#
|
2020-05-02 19:03:11 +02:00
|
|
|
# GEM_KEEPBUILD
|
|
|
|
# A list of shell globs representing files not to remove even it match
|
|
|
|
# with GEM_CLEANBUILD or GEM_CLEANBUILD_EXTENSIONS.
|
|
|
|
#
|
|
|
|
# Default: (empty)
|
|
|
|
#
|
2010-09-10 05:12:02 +02:00
|
|
|
# GEM_NAME
|
|
|
|
# The name of the gem to install. The default value is ${DISTNAME}.
|
2020-05-02 19:03:11 +02:00
|
|
|
# gem installed in the installation root.
|
2010-09-10 05:12:02 +02:00
|
|
|
#
|
|
|
|
# GEM_SPECFILE
|
|
|
|
# The path to the gemspec file to use when building a gem using
|
|
|
|
# the ``gemspec'' GEM_BUILD method. It defaults to
|
|
|
|
# ${WRKDIR}/${DISTNAME}.gemspec.
|
|
|
|
#
|
|
|
|
# RUBYGEM_OPTIONS
|
|
|
|
# Optional parameter to pass to gem on install stage.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Variables defined in this file:
|
|
|
|
#
|
|
|
|
# GEM_DOCDIR
|
|
|
|
# The relative path from PREFIX to the directory in the local gem
|
|
|
|
# repository that holds the documentation for the installed gem.
|
|
|
|
#
|
|
|
|
# GEM_LIBDIR
|
|
|
|
# The relative path from PREFIX to the directory in the local gem
|
|
|
|
# repository that holds the contents of the installed gem.
|
|
|
|
#
|
2014-03-13 18:21:01 +01:00
|
|
|
# GEM_EXTSDIR
|
2021-01-11 12:21:31 +01:00
|
|
|
# "extensions" directory under ${GEM_HOME}.
|
|
|
|
#
|
|
|
|
# GEM_PLUGINSDIR
|
|
|
|
# "plguins" direcotry under ${GEM_HOME}. It is generated by
|
|
|
|
# rubygems 3.2 and later.
|
|
|
|
# In PLIST file, it will be replace to "${GEM_HOME}/plugins" or
|
2014-03-13 18:21:01 +01:00
|
|
|
# "@comment ..." depends on the version of rubygems.
|
|
|
|
#
|
2010-09-10 05:12:02 +02:00
|
|
|
# RUBYGEM
|
|
|
|
# The path to the rubygems ``gem'' script.
|
|
|
|
#
|
2012-03-02 04:46:09 +01:00
|
|
|
.if !defined(_RUBYGEM_MK)
|
|
|
|
_RUBYGEM_MK= # defined
|
2010-09-10 05:12:02 +02:00
|
|
|
|
|
|
|
# replace interpeter bin default
|
|
|
|
REPLACE_RUBY_DIRS?= bin
|
|
|
|
REPLACE_RUBY_PAT?= *
|
|
|
|
|
|
|
|
# Default to using rake to build the local gem from the unpacked files.
|
|
|
|
GEM_BUILD?= gemspec
|
|
|
|
|
2011-08-12 16:35:34 +02:00
|
|
|
OVERRIDE_GEMSPEC?= # default is empty
|
|
|
|
|
2010-09-10 05:12:02 +02:00
|
|
|
# Include this early in case some of its target are needed
|
|
|
|
.include "../../lang/ruby/modules.mk"
|
|
|
|
|
|
|
|
# Build and run-time dependencies for Ruby prior to 1.9.
|
|
|
|
#
|
|
|
|
# We need rubygems>=1.1.0 to actually build the package, but the
|
|
|
|
# resulting installed gem can run with older versions of rubygems.
|
|
|
|
#
|
|
|
|
# If we're using rake to build the local gem, then include it as a
|
|
|
|
# build tool.
|
|
|
|
#
|
2015-03-08 15:41:12 +01:00
|
|
|
.include "../../lang/ruby/gem-vars.mk"
|
2014-03-15 13:30:26 +01:00
|
|
|
|
2010-09-10 05:12:02 +02:00
|
|
|
CATEGORIES+= ruby
|
2013-03-14 13:57:42 +01:00
|
|
|
MASTER_SITES?= ${MASTER_SITE_RUBYGEMS}
|
2010-09-10 05:12:02 +02:00
|
|
|
|
|
|
|
EXTRACT_SUFX?= .gem
|
|
|
|
DISTFILES?= ${DISTNAME}${EXTRACT_SUFX}
|
|
|
|
|
|
|
|
# If any of the DISTFILES are gems, then skip the normal do-extract actions
|
|
|
|
# and extract them ourselves in gem-extract.
|
|
|
|
#
|
|
|
|
.if !empty(DISTFILES:M*.gem)
|
|
|
|
EXTRACT_ONLY?= # empty
|
|
|
|
.endif
|
|
|
|
|
|
|
|
# Directory for the Gem to install
|
|
|
|
GEM_NAME?= ${DISTNAME}
|
|
|
|
GEM_CACHEDIR= ${GEM_HOME}/cache
|
2013-07-07 17:16:38 +02:00
|
|
|
GEM_DOCDIR= ${GEM_HOME}/doc/${GEM_NAME}
|
|
|
|
GEM_LIBDIR= ${GEM_HOME}/gems/${GEM_NAME}
|
2010-09-10 05:12:02 +02:00
|
|
|
|
2014-03-13 18:21:01 +01:00
|
|
|
GEM_BUILDINFO_DIR= ${GEM_HOME}/build_info
|
|
|
|
|
2010-09-10 05:12:02 +02:00
|
|
|
# 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'
|
|
|
|
# permission.
|
|
|
|
#
|
|
|
|
CHECK_INTERPRETER_SKIP+= ${GEM_LIBDIR}/*
|
|
|
|
CHECK_PERMS_SKIP+= ${GEM_LIBDIR}/*
|
|
|
|
|
|
|
|
# PLIST support
|
|
|
|
PLIST_SUBST+= GEM_NAME=${GEM_NAME}
|
|
|
|
PLIST_SUBST+= GEM_LIBDIR=${GEM_LIBDIR}
|
|
|
|
PLIST_SUBST+= GEM_DOCDIR=${GEM_DOCDIR}
|
|
|
|
|
2014-05-01 14:45:09 +02:00
|
|
|
# Add indirect support for print-PLIST
|
|
|
|
_RUBY_PRINT_PLIST_GEM= /${GEM_NAME}\.info$$/ \
|
2014-03-15 13:30:26 +01:00
|
|
|
{ gsub(/${GEM_NAME}\.info/, "$${GEM_NAME}.info"); }
|
2014-05-01 14:45:09 +02:00
|
|
|
_RUBY_PRINT_PLIST_GEM+= /${GEM_NAME}\.(gem|gemspec)$$/ \
|
2014-03-15 13:30:26 +01:00
|
|
|
{ gsub(/${GEM_NAME}\.gem/, "$${GEM_NAME}.gem"); }
|
2014-05-01 14:45:09 +02:00
|
|
|
_RUBY_PRINT_PLIST_GEM+= /${GEM_NAME:S/./[.]/g}[.](gem|gemspec)$$/ \
|
2014-03-15 13:30:26 +01:00
|
|
|
{ gsub(/${PKGVERSION_NOREV:S|/|\\/|g}[.]gem/, "$${PKGVERSION}.gem"); }
|
|
|
|
.if !empty(GEM_EXTSDIR)
|
2014-05-01 14:45:09 +02:00
|
|
|
_RUBY_PRINT_PLIST_GEM+= /^${GEM_EXTSDIR:S|/|\\/|g}/ \
|
2019-11-03 20:03:56 +01:00
|
|
|
{ gsub(/${GEM_EXTSDIR:S|/|\\/|g}/, "$${GEM_EXTSDIR}"); \
|
2014-03-15 13:30:26 +01:00
|
|
|
print; next; }
|
|
|
|
.endif
|
2021-01-11 12:21:31 +01:00
|
|
|
.if !empty(GEM_PLUGINSDIR)
|
|
|
|
_RUBY_PRINT_PLIST_GEM+= /^${GEM_PLUGINSDIR:S|/|\\/|g}/ \
|
|
|
|
{ gsub(/${GEM_PLUGINSDIR:S|/|\\/|g}/, "$${PLIST.ruby_plugins}$${GEM_PLUGINSDIR}"); \
|
|
|
|
print; next; }
|
|
|
|
.endif
|
2014-05-01 14:45:09 +02:00
|
|
|
_RUBY_PRINT_PLIST_GEM+= /^${GEM_LIBDIR:S|/|\\/|g}/ \
|
2014-03-15 13:30:26 +01:00
|
|
|
{ gsub(/${GEM_LIBDIR:S|/|\\/|g}/, "$${GEM_LIBDIR}"); print; next; }
|
2014-05-01 14:45:09 +02:00
|
|
|
_RUBY_PRINT_PLIST_GEM+= /^${GEM_DOCDIR:S|/|\\/|g}/ \
|
2014-03-15 13:30:26 +01:00
|
|
|
{ next; }
|
2014-05-01 14:45:09 +02:00
|
|
|
_RUBY_PRINT_PLIST_GEM+= /^${GEM_HOME:S|/|\\/|g}/ \
|
2014-03-15 13:30:26 +01:00
|
|
|
{ gsub(/${GEM_HOME:S|/|\\/|g}/, "$${GEM_HOME}"); \
|
|
|
|
print; next; }
|
2014-05-01 14:45:09 +02:00
|
|
|
_RUBY_PRINT_PLIST_GEM+= /^${RUBY_GEM_BASE:S|/|\\/|g}/ \
|
2019-11-03 20:03:56 +01:00
|
|
|
{ gsub(/${RUBY_GEM_BASE:S|/|\\/|g}/, "$${RUBY_GEM_BASE}"); \
|
2014-03-15 13:30:26 +01:00
|
|
|
print; next; }
|
|
|
|
|
2015-03-08 15:41:12 +01:00
|
|
|
.include "../../lang/ruby/gem-extract.mk"
|
2010-09-10 05:12:02 +02:00
|
|
|
|
|
|
|
###
|
|
|
|
### gem-build
|
|
|
|
###
|
|
|
|
### The gem-build target builds a new local gem from the extracted gem's
|
|
|
|
### contents. The new gem as created as ${WRKSRC}/${GEM_NAME}.gem.
|
|
|
|
### The local gem is then installed into a special build root under
|
|
|
|
### ${WRKDIR} (${RUBYGEM_INSTALL_ROOT}), possibly compiling any extensions.
|
|
|
|
###
|
2015-03-08 15:41:12 +01:00
|
|
|
GEM_SPECFILE?= ${WRKDIR}/${DISTNAME}.gemspec
|
2014-03-13 18:21:01 +01:00
|
|
|
GEM_CLEANBUILD?= ext/*
|
2015-03-08 15:41:12 +01:00
|
|
|
GEM_CLEANBUILD_EXTENSIONS+= *.out *.log
|
2020-05-02 19:03:11 +02:00
|
|
|
GEM_KEEPBUILD?= # empty
|
2010-09-10 05:12:02 +02:00
|
|
|
|
|
|
|
.if !empty(GEM_CLEANBUILD:M/*) || !empty(GEM_CLEANBUILD:M*../*)
|
2016-04-11 06:22:33 +02:00
|
|
|
PKG_FAIL_REASON+= "GEM_CLEANBUILD must be relative to "${PREFIX}/${GEM_LIBDIR:Q}"."
|
2010-09-10 05:12:02 +02:00
|
|
|
.endif
|
|
|
|
|
2015-01-16 10:18:47 +01:00
|
|
|
.if !empty(GEM_CLEANBUILD_EXTENSIONS:M/*) || !empty(GEM_CLEANBUILD_EXTENSIONS:M*../*)
|
2016-04-11 06:22:33 +02:00
|
|
|
PKG_FAIL_REASON+= "GEM_CLEANBUILD_EXTENSIONS must be relative to "${PREFIX}/${GEM_LIBDIR:Q}"."
|
2014-03-13 18:21:01 +01:00
|
|
|
.endif
|
|
|
|
|
2020-05-02 19:03:11 +02:00
|
|
|
.if !empty(GEM_KEEPBUILD:M/*) || !empty(GEM_KEEPBUILD:M*../*)
|
|
|
|
PKG_FAIL_REASON+= "GEM_KEEPBUILD must be relative to "${PREFIX}/${GEM_LIBDIR:Q}"."
|
|
|
|
.endif
|
|
|
|
|
2010-09-10 05:12:02 +02:00
|
|
|
.PHONY: gem-build
|
|
|
|
do-build: _gem-pre-build gem-build
|
|
|
|
|
|
|
|
_gem-pre-build:
|
2011-08-12 16:35:34 +02:00
|
|
|
.if !empty(OVERRIDE_GEMSPEC)
|
2019-02-09 16:22:46 +01:00
|
|
|
@${STEP_MSG} Override gemspec
|
2011-08-12 16:35:34 +02:00
|
|
|
@${RUBY} ${.CURDIR}/${UPDATE_GEMSPEC} ${WRKDIR}/${GEM_NAME}.gemspec \
|
|
|
|
${OVERRIDE_GEMSPEC:Q}
|
|
|
|
.endif
|
|
|
|
@${STEP_MSG} "Removing backup files of patch before build"
|
2010-09-10 05:12:02 +02:00
|
|
|
@find ${WRKSRC} -name \*.orig -exec rm {} \;
|
|
|
|
|
|
|
|
gem-build: _gem-${GEM_BUILD}-build
|
|
|
|
|
|
|
|
.PHONY: _gem-gemspec-build
|
|
|
|
_gem-gemspec-build:
|
2011-11-08 16:19:22 +01:00
|
|
|
${RUN} cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${RUBYGEM_ENV} \
|
2010-09-10 05:12:02 +02:00
|
|
|
${RUBYGEM} build ${GEM_SPECFILE}
|
|
|
|
${RUN} ${TEST} -f ${WRKSRC}/${GEM_NAME}.gem || \
|
|
|
|
${FAIL_MSG} "Build of ${GEM_NAME}.gem failed."
|
|
|
|
|
|
|
|
BUILD_TARGET?= gem
|
|
|
|
|
|
|
|
.PHONY: _gem-rake-build
|
|
|
|
_gem-rake-build:
|
|
|
|
${RUN} cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${RAKE} ${BUILD_TARGET}
|
|
|
|
${RUN} cd ${WRKSRC} && rm -f ${GEM_NAME}.gem
|
|
|
|
${RUN} cd ${WRKSRC} && find . -name ${GEM_NAME}.gem -print | \
|
|
|
|
while read file; do \
|
|
|
|
ln -fs "$$file" ${GEM_NAME}.gem; \
|
|
|
|
exit 0; \
|
|
|
|
done
|
|
|
|
|
|
|
|
RUBYGEM_INSTALL_ROOT= ${WRKDIR}/.inst
|
|
|
|
_RUBYGEM_OPTIONS= --no-update-sources # don't cache the gem index
|
|
|
|
_RUBYGEM_OPTIONS+= --install-dir ${PREFIX}/${GEM_HOME}
|
|
|
|
_RUBYGEM_OPTIONS+= ${RUBYGEM_INSTALL_ROOT_OPTION}
|
|
|
|
_RUBYGEM_OPTIONS+= --ignore-dependencies
|
|
|
|
_RUBYGEM_OPTIONS+= --local ${WRKSRC}/${GEM_NAME}.gem
|
2021-01-11 07:51:27 +01:00
|
|
|
.if !empty(RUBYGEM_VERBOSE:M[Yy][Ee][Ss])
|
|
|
|
_RUBYGEM_OPTIONS+= -V
|
|
|
|
.endif
|
2019-10-24 16:39:37 +02:00
|
|
|
.if !empty(RUBY_BUILD_DOCUMENT:M[nN][oO])
|
|
|
|
_RUBYGEM_OPTIONS+= --no-document
|
2010-09-10 05:12:02 +02:00
|
|
|
.endif
|
2014-08-19 17:26:44 +02:00
|
|
|
.if !empty(CONFIGURE_ARGS) || !empty(RUBY_EXTCONF_ARGS)
|
|
|
|
_RUBYGEM_OPTIONS+= --
|
2019-11-03 20:03:56 +01:00
|
|
|
. if !empty(RUBY_EXTCONF_ARGS)
|
2014-08-19 17:26:44 +02:00
|
|
|
_RUBYGEM_OPTIONS+= ${RUBY_EXTCONF_ARGS}
|
2019-11-03 20:03:56 +01:00
|
|
|
. endif
|
|
|
|
. if !empty(CONFIGURE_ARGS)
|
2014-08-19 17:26:44 +02:00
|
|
|
_RUBYGEM_OPTIONS+= --build-args ${CONFIGURE_ARGS}
|
2019-11-03 20:03:56 +01:00
|
|
|
. endif
|
2011-08-12 16:35:34 +02:00
|
|
|
.endif
|
2010-09-10 05:12:02 +02:00
|
|
|
|
|
|
|
RUBYGEM_INSTALL_ROOT_OPTION= --install-root ${RUBYGEM_INSTALL_ROOT}
|
|
|
|
|
|
|
|
.PHONY: _gem-build-install-root
|
|
|
|
_gem-build-install-root:
|
|
|
|
@${STEP_MSG} "Installing gem into installation root"
|
2011-11-08 16:19:22 +01:00
|
|
|
${RUN} ${SETENV} ${MAKE_ENV} ${RUBYGEM_ENV} \
|
2013-03-07 17:42:53 +01:00
|
|
|
${RUBYGEM} install --backtrace ${RUBYGEM_OPTIONS} ${_RUBYGEM_OPTIONS}
|
2010-09-10 05:12:02 +02:00
|
|
|
|
|
|
|
# The ``gem'' command doesn't exit with a non-zero result even if the
|
|
|
|
# install of the gem failed, so we do the check and return the proper exit
|
|
|
|
# code ourselves.
|
|
|
|
#
|
|
|
|
.PHONY: _gem-build-install-root-check
|
|
|
|
_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."
|
|
|
|
|
2015-01-16 10:18:47 +01:00
|
|
|
.if !empty(GEM_CLEANBUILD) || !empty(GEM_CLEANBUILD_EXTENSIONS)
|
2010-09-10 05:12:02 +02:00
|
|
|
.PHONY: _gem-build-cleanbuild
|
|
|
|
_gem-build-cleanbuild:
|
|
|
|
@${STEP_MSG} "Cleaning intermediate gem build files"
|
2019-11-03 20:03:56 +01:00
|
|
|
. if !empty(GEM_CLEANBUILD)
|
2010-09-10 05:12:02 +02:00
|
|
|
${RUN} cd ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_LIBDIR} && \
|
|
|
|
find . -print | sort -r | \
|
|
|
|
while read file; do \
|
|
|
|
case $$file in \
|
2020-05-02 19:03:11 +02:00
|
|
|
${GEM_KEEPBUILD:@.p.@./${.p.}) continue ;;@} \
|
2010-09-10 05:12:02 +02:00
|
|
|
${GEM_CLEANBUILD:@.p.@./${.p.}) ;;@} \
|
|
|
|
*) continue ;; \
|
|
|
|
esac; \
|
2013-07-07 17:16:38 +02:00
|
|
|
if [ -e ${WRKSRC:Q}"/$$file" ]; then \
|
2013-07-14 23:08:17 +02:00
|
|
|
continue; \
|
2013-07-07 17:16:38 +02:00
|
|
|
elif [ -d "$$file" ]; then \
|
|
|
|
rfile=`echo $$file | ${SED} -e 's|^\./||'`; \
|
|
|
|
${ECHO} "rmdir "${GEM_NAME}"/$$rfile"; \
|
2010-09-10 05:12:02 +02:00
|
|
|
rmdir $$file; \
|
2013-07-07 17:16:38 +02:00
|
|
|
elif [ -f "$$file" ]; then \
|
|
|
|
rfile=`echo $$file | ${SED} -e 's|^\./||'`; \
|
|
|
|
${ECHO} "rm "${GEM_NAME}"/$$rfile"; \
|
2010-09-10 05:12:02 +02:00
|
|
|
rm -f $$file; \
|
|
|
|
fi; \
|
|
|
|
done
|
2019-11-03 20:03:56 +01:00
|
|
|
. endif
|
2020-12-19 15:41:16 +01:00
|
|
|
@${RMDIR} ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_BUILDINFO_DIR} \
|
|
|
|
${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_EXTSBASE} \
|
|
|
|
>/dev/null 2>&1 || true
|
2019-11-03 20:03:56 +01:00
|
|
|
. if !empty(GEM_EXTSDIR) && !empty(GEM_CLEANBUILD_EXTENSIONS)
|
2014-03-13 18:21:01 +01:00
|
|
|
${RUN} \
|
|
|
|
if test ! -d ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_EXTSDIR}; then \
|
|
|
|
:; \
|
|
|
|
else \
|
|
|
|
cd ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_EXTSDIR} && \
|
2015-01-16 10:18:47 +01:00
|
|
|
for f in ${GEM_CLEANBUILD_EXTENSIONS}; do \
|
2014-03-13 18:21:01 +01:00
|
|
|
echo "rm -f $$f"; \
|
|
|
|
rm -f $$f; \
|
|
|
|
done; \
|
|
|
|
fi
|
2019-11-03 20:03:56 +01:00
|
|
|
. endif
|
2014-03-13 18:21:01 +01:00
|
|
|
.endif
|
2010-09-10 05:12:02 +02:00
|
|
|
|
|
|
|
###
|
|
|
|
### gem-install
|
|
|
|
###
|
|
|
|
### The gem-install target installs the gem in ${_RUBY_INSTALL_ROOT} into
|
|
|
|
### the actual gem repository.
|
|
|
|
###
|
|
|
|
GENERATE_PLIST+= ${RUBYGEM_GENERATE_PLIST}
|
|
|
|
RUBYGEM_GENERATE_PLIST= \
|
|
|
|
${ECHO} "@comment The following lines are automatically generated." && \
|
|
|
|
( cd ${RUBYGEM_INSTALL_ROOT}${PREFIX} && test -d ${GEM_DOCDIR} && \
|
|
|
|
${FIND} ${GEM_DOCDIR} \! -type d -print | ${SORT} ) || true;
|
|
|
|
|
|
|
|
_GEM_INSTALL_TARGETS= _gem-build-install-root
|
|
|
|
_GEM_INSTALL_TARGETS+= _gem-build-install-root-check
|
|
|
|
.if !empty(GEM_CLEANBUILD)
|
|
|
|
_GEM_INSTALL_TARGETS+= _gem-build-cleanbuild
|
|
|
|
.endif
|
|
|
|
_GEM_INSTALL_TARGETS+= _gem-install
|
|
|
|
|
|
|
|
.ORDER: ${_GEM_INSTALL_TARGETS}
|
|
|
|
|
|
|
|
USE_TOOLS+= pax
|
|
|
|
|
|
|
|
do-install: ${_GEM_INSTALL_TARGETS}
|
|
|
|
|
|
|
|
.PHONY: _gem-install
|
|
|
|
_gem-install:
|
|
|
|
@${STEP_MSG} "gem install"
|
|
|
|
${RUN} cd ${RUBYGEM_INSTALL_ROOT}${PREFIX} && \
|
2014-03-14 23:31:31 +01:00
|
|
|
pax -rwpp . ${DESTDIR}${PREFIX}
|
2012-03-02 04:46:09 +01:00
|
|
|
|
|
|
|
.endif
|