Fix ruby dependent extensions. (#26729)
* Fix ruby dependent extensions. * Added Kerilk as maintainer.
This commit is contained in:
parent
33da53e325
commit
0bc1bffe50
2 changed files with 17 additions and 6 deletions
|
@ -18,6 +18,9 @@ class RubyPackage(PackageBase):
|
|||
#. :py:meth:`~.RubyPackage.build`
|
||||
#. :py:meth:`~.RubyPackage.install`
|
||||
"""
|
||||
|
||||
maintainers = ['Kerilk']
|
||||
|
||||
#: Phases of a Ruby package
|
||||
phases = ['build', 'install']
|
||||
|
||||
|
@ -50,8 +53,12 @@ def install(self, spec, prefix):
|
|||
|
||||
gems = glob.glob('*.gem')
|
||||
if gems:
|
||||
# if --install-dir is not used, GEM_PATH is deleted from the
|
||||
# environement, and Gems required to build native extensions will
|
||||
# not be found. Those extensions are built during `gem install`.
|
||||
inspect.getmodule(self).gem(
|
||||
'install', '--norc', '--ignore-dependencies', gems[0])
|
||||
'install', '--norc', '--ignore-dependencies',
|
||||
'--install-dir', prefix, gems[0])
|
||||
|
||||
# Check that self.prefix is there after installation
|
||||
run_after('install')(PackageBase.sanity_check_prefix)
|
||||
|
|
|
@ -10,6 +10,8 @@ class Ruby(AutotoolsPackage):
|
|||
"""A dynamic, open source programming language with a focus on
|
||||
simplicity and productivity."""
|
||||
|
||||
maintainers = ['Kerilk']
|
||||
|
||||
homepage = "https://www.ruby-lang.org/"
|
||||
url = "https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.0.tar.gz"
|
||||
list_url = "https://cache.ruby-lang.org/pub/ruby/"
|
||||
|
@ -88,16 +90,18 @@ def configure_args(self):
|
|||
def setup_dependent_build_environment(self, env, dependent_spec):
|
||||
# TODO: do this only for actual extensions.
|
||||
# Set GEM_PATH to include dependent gem directories
|
||||
ruby_paths = []
|
||||
for d in dependent_spec.traverse():
|
||||
for d in dependent_spec.traverse(deptype=('build', 'run', 'test'), root=True):
|
||||
if d.package.extends(self.spec):
|
||||
ruby_paths.append(d.prefix)
|
||||
|
||||
env.set_path('GEM_PATH', ruby_paths)
|
||||
env.prepend_path('GEM_PATH', d.prefix)
|
||||
|
||||
# The actual installation path for this gem
|
||||
env.set('GEM_HOME', dependent_spec.prefix)
|
||||
|
||||
def setup_dependent_run_environment(self, env, dependent_spec):
|
||||
for d in dependent_spec.traverse(deptype=('run'), root=True):
|
||||
if d.package.extends(self.spec):
|
||||
env.prepend_path('GEM_PATH', d.prefix)
|
||||
|
||||
def setup_dependent_package(self, module, dependent_spec):
|
||||
"""Called before ruby modules' install() methods. Sets GEM_HOME
|
||||
and GEM_PATH to values appropriate for the package being built.
|
||||
|
|
Loading…
Reference in a new issue