diff --git a/recipes/ruby/all/conanfile.py b/recipes/ruby/all/conanfile.py index 59824ba379b09e..d478600c254e88 100644 --- a/recipes/ruby/all/conanfile.py +++ b/recipes/ruby/all/conanfile.py @@ -150,14 +150,17 @@ def generate(self): # Ruby doesn't respect the --with-gmp-dir for eg. After removal of libgmp-dev on conanio/gcc10 build failed opt_dirs = [] - for name, dep_cpp_info in self.deps_cpp_info.dependencies: - if name in ['zlib', 'openssl', 'libffi', 'libyaml', 'readline', 'gmp']: - root_path = unix_path(self, dep_cpp_info.rootpath) - tc.configure_args.append(f'--with-{name}-dir={root_path}') + + # zlib always True + tc.configure_args.append(f'--with-zlib-dir={self.dependencies["zlib"].package_path.as_posix()}') + for dep in ['zlib', 'openssl', 'libffi', 'libyaml', 'readline', 'gmp']: + if self.options.get_safe(f'with_{dep}'): + root_path = self.dependencies[dep].package_path.as_posix() + tc.configure_args.append(f'--with-{dep}-dir={root_path}') opt_dirs.append(root_path) + if opt_dirs: sep = ';' if self.settings.os == "Windows" else ":" - tc.configure_args.append(f"--with-opt-dir={sep.join(opt_dirs)}") if cross_building(self) and is_apple_os(self): diff --git a/recipes/ruby/all/test_package/conanfile.py b/recipes/ruby/all/test_package/conanfile.py index 3c4aa957b2d581..55b30c6626f1f3 100644 --- a/recipes/ruby/all/test_package/conanfile.py +++ b/recipes/ruby/all/test_package/conanfile.py @@ -21,9 +21,10 @@ def build(self): # We define RUBY_STATIC_RUBY when ruby itself is static # We define RUBY_STATIC_LINKED_EXT when the ruby extensions are static (same as EXTSTATIC but clearer) defs = {} - if not self.options['ruby'].shared: + tested_options = self.dependencies[self.tested_reference_str].options + if not tested_options.shared: defs['RUBY_STATIC_RUBY'] = 1 - if self.options['ruby'].with_static_linked_ext: + if tested_options.with_static_linked_ext: defs['RUBY_STATIC_LINKED_EXT'] = 1 cmake.configure(variables=defs) cmake.build()