Commit graph

86 commits

Author SHA1 Message Date
Mislav Marohnić
14d3185545
Fix linking to vendored OpenSSL on 64-bit systems
On 64-bit systems, the build system for OpenSSL tends to produce a "lib64"
directory instead of a "lib" directory due to its "multilib" feature being
enabled by default. However, the Ruby "openssl" extension assumes that the
directory is always named "lib", or explicitly passed via `--with-openssl-lib`.

This disables multilib support in OpenSSL by passing `--libdir=lib` to OpenSSL
configure step.
2024-10-15 14:24:13 +02:00
Benoit Daloze
572dd651de Use --enable-shared for dev builds too, not only for releases
* Only from Ruby 2.4+ since older releases don't use --enable-shared by default.
* As with releases it can be disabled by setting RUBY_CONFIGURE_OPTS=--disable-shared.
2024-10-09 01:50:09 +02:00
Benoit Daloze
a22ff72e32
Support ruby-build ruby-X.Y.Z DIR (#2448)
* By searching a X.Y.Z definition if no ruby-X.Y.Z definition is not found.
* Add test and documentation.

Co-authored-by: Mislav Marohnić <git@mislav.net>
2024-09-23 19:15:29 +02:00
Benoit Daloze
2d00d407e7
Add -d, --dir option to install to <prefix>/<definition> instead of <prefix> (#2447)
Similar to ruby-install's -r, --rubies-dir flag.

---------

Co-authored-by: Mislav Marohnić <git@mislav.net>
2024-09-23 18:00:15 +02:00
Mislav Marohnić
fb1b4da13d
Simplify JRuby version check
In case shelling out to jruby fails, the error output wouldn't get printed to
stderr but ruby-build would abort.
2024-06-10 11:54:48 +02:00
Mislav Marohnić
8465e028e8
Skip passing --with-readline-dir for Ruby 3.3+ 2024-01-07 14:24:40 +01:00
Mislav Marohnić
89617471f8
Fix linking to older OpenSSL for Ruby < 2.7.7
Explicitly set PKG_CONFIG_PATH when `--with-openssl-dir` is used for older Rubies.
Otherwise, Ruby will attempt to link to the latest OpenSSL found by pkg-config,
which could be incompatible.
2023-12-07 15:52:10 +01:00
Mislav Marohnić
c5346187ac
Simplify build & install steps for dev rubies
This merges "standard_build" and "standard_install" build steps into one again
and modifies "standard_install_with_bundled_gems" to just invoke "standard"
with the addition of `update-gems` & `extract-gems` targets.
2023-11-30 16:32:57 +01:00
Mislav Marohnić
efe73b4841
Fix compiling Ruby < 2.5 by omitting --with-ext
Using `--with-ext=+` only has the indended effect (compiling all extensions that would normally get compiled) on Ruby 2.5+. On older versions, it causes none of the default extensions to get compiled, resulting in a defunct installation.
2023-11-24 22:08:28 +01:00
Mislav Marohnić
6250069ccb
Instruct Ruby to fail the build if openssl or psych are missing
Normally, Ruby `make` step will print a warning about any missing
extensions, but will not abort the build and instead proceed as normal.

Since Ruby installations without openssl or psych are essentially
broken, ruby-build used to have a `verify_openssl` build step to test if
the newly built Ruby can load these extensions, and print helpful
information and abort the build on errors:

    Loading the Ruby openssl extension failed
    ERROR: Ruby install aborted due to missing extensions

The `verify_opensl` implementation was necessary to provide a good
experience for ruby-build users, but was hacky and I would prefer to
eliminate it.

It appears that passing `--with-ext=openssl,psych` to the Ruby configure
step marks those extensions as mandatory and fails the `make` process if
they failed to build. This is exactly the behavior we want, so this
enables the configure option for all Ruby builds.
2023-11-21 17:12:53 +01:00
Mislav Marohnić
56242478b1
Simplify build_package_rbx
This removes the `isolated_gem_dependency` hack as well as the `rake` &
`bundle` shell wrapper functions. The main reason is to avoid having to
use the `command` shell builtin to be able to invoke the real `rake` and
`bundle`. In my testing on bash 3.2, `command` does not respect the
usual bash error handling rules, and thus a failed `command` invocation
can trigger the ERR trap mechanism even when we don't want it to.
2023-11-07 10:51:43 +01:00
Mislav Marohnić
f6923c65f0
Fix checking system OpenSSL version
The value of OPENSSL_VERSION_TEXT seems to be printed in double quotes.
2023-11-05 13:56:45 +01:00
Mislav Marohnić
31e53468b6
Automatically link to Homebrew OpenSSL
If a system OpenSSL version was not found or is at version that is incompatible with a Ruby being installed, ruby-build would typically download and compile a new OpenSSL version scoped to that Ruby installation.

Now the `needs_openssl` condition will also check for Homebrew-installed OpenSSL and automatically link to the first one found that satisfies the version requirement. This primarily helps speed up Ruby installation on macOS where the system OpenSSL is never compatible and where Homebrew is a de-facto standard package manager.
2023-11-02 13:53:50 +01:00
Benoit Daloze
39f77ffd17 Skip ri/rdoc when installing jruby-launcher 2023-10-23 12:28:10 +02:00
Mislav Marohnić
08b1cfaf71
Add needs_openssl test 2023-10-17 15:33:08 +02:00
Mislav Marohnić
a559b30fd8
Improve cached_tarball test helper
- Now only generates a `configure` script if explicitly specified
- Add ability to add arbitrary files to the tarball
- Cache most common tarballs in fixtures directory to speed up tests
2023-10-17 12:40:17 +02:00
Mislav Marohnić
47eda17460
Remove implicit LDFLAGS, CPPFLAGS, and "ldflags_dirs" build step
The default settings for LDFLAGS and CPPFLAGS were there since the initial commit to ruby-build:

    LDFLAGS="-L${PREFIX_PATH}/lib"
    CPPFLAGS="-I${PREFIX_PATH}/include"

However, it's not clear to me what these settings help with. A typical Ruby installation will initialize files in these directories, but it will do so regardless of the environment variables.

So, let's remove them and see what breaks.
2023-10-13 19:21:04 +02:00
Mislav Marohnić
1c8689b950
Add tests for extra configure flags on the command-line 2023-10-11 18:02:07 +02:00
Mislav Marohnić
6b6fa457a0
Enable test assertions to spot erraneous word-splitting in bash 2023-10-11 18:02:07 +02:00
Thomas Hurst
4cec390699
Set default MAKE=make on FreeBSD (#2263)
This was set to gmake in https://github.com/rbenv/ruby-build/pull/1381
as a workaround for https://bugs.ruby-lang.org/issues/16331

YJIT builds in Ruby 3.3 previews require the use of BSD make on these
platforms, and no supported version of MRI requires the use of gmake, so
revert this.

JRuby continues to require gmake for jruby-launcher.

Fixes #2262

Co-authored-by: Mislav Marohnić <git@mislav.net>
2023-10-11 12:19:40 +02:00
João Duarte
c6e924edc8
workaround jruby#7799 by updating rubygems for JRuby 9.2.x (#2246)
Co-authored-by: Mislav Marohnić <git@mislav.net>
2023-09-12 16:08:47 +02:00
Mislav Marohnić
242e8beb49
Avoid test failure when stubbing FreeBSD environment
https://github.com/rbenv/ruby-build/actions/runs/5719870214/job/15517987944#step:4:18
2023-08-02 11:20:08 +02:00
Mislav Marohnić
4079aa75cd
add stub_repeated test helper 2023-03-06 19:15:49 +01:00
Roman Usherenko
40af31b46b
automatically detect and use Homebrew's libyaml
Co-authored-by: Mislav Marohnić <git@mislav.net>
2023-03-06 19:14:40 +01:00
Jean Boussier
1f9b792168 macOS: Use GMP from homebrew
MRI's BigInt use GMP under the hood if available, and if not
fallbacks to an homemade implementation with much worse performance.

Without GMP:
```
>> Benchmark.realtime { Integer('1' * (10 ** 7)) }
=> 13.80743500002427
```

With GMP
```
>> Benchmark.realtime { Integer('1' * (10 ** 7)) }
=> 0.4098639999865554
```

macOS not being a common production platform, it's not a huge deal
but it would still preferable to compile with `gmp.h` if present.

I'd also suggest to print a warning if compiling on macOS and gmp
isn't installed, but I don't know if it's desirable.

NB: `--with-gmp-dir` was only added recently, so this will only
apply to MRI >= 3.2, as well as rubies on which this flag was backported.
2022-09-22 08:56:34 +02:00
Benoit Daloze
e607953dbf Fix version check for Java 17
* Fixes https://github.com/rbenv/ruby-build/issues/1798
* OpenJDK 17 reports:
  $ java -version
  openjdk version "17" 2021-09-14
  There is no dot in the version, so we need to only use the first match from grep -o.
* Clarify it is a minimum required java version, not an exact version.
2021-09-28 12:42:07 +02:00
Benoit Daloze
ac72249e04 Ensure it is safe to remove the prefix path for TruffleRuby or error
* Only do clean_prefix_path for TruffleRuby and rename for clarity,
  since the logic is now TruffleRuby-specific.
2021-07-26 17:44:28 +02:00
Mislav Marohnić
d6af53ef1c Fix test for gmake on FreeBSD 2019-11-20 10:56:16 +01:00
Mislav Marohnić
ed46d03947 Include header files with mruby
Fix #1311
2019-11-05 11:03:49 +01:00
Mislav Marohnić
8945b5721f Add tests for different styles of patches 2019-11-05 09:48:22 +01:00
Mislav Marohnić
c30d4cba91 Fix verifying Java 9+ versions
Ref. #1135
2019-11-02 13:09:38 +01:00
Mislav Marohnić
9219a43caf
Merge pull request #1198 from yyuu/http-client-based-on-envvar
Allow overriding HTTP client type based on environment variable of `RUBY_BUILD_HTTP_CLIENT`
2018-08-22 11:27:06 +00:00
Benoit Daloze
0ec626bc4d Remove early check for LLVM when installing TruffleRuby
* TruffleRuby already checks for LLVM itself when it needs it and
  looks up more paths to find the LLVM executables clang and opt.
* See https://github.com/oracle/truffleruby/issues/1386.
2018-07-14 22:39:37 +02:00
Benoit Daloze
a8a3ebf809 Add tests for TruffleRuby 2018-06-15 20:17:13 +02:00
Yamashita, Yuu
34652a4fae Allow overriding HTTP client type based on environment variable RUBY_BUILD_HTTP_CLIENT (pyenv/pyenv#1126) 2018-04-26 02:08:59 +00:00
SHIBATA Hiroshi
331a408adc
Merge pull request #1136 from juanibiapina/relax-java-version-regexp
Relax java version regexp
2017-11-27 15:26:35 +09:00
SHIBATA Hiroshi
f41e8474a8
ubygems.rb is unavailable on Ruby 2.5 2017-10-12 11:57:46 +09:00
Juan Ibiapina
4889ec7ca6 Relax java version regexp
This allows the java version to be specified as "9", instead of "1.9".

Closes #1135
2017-10-09 12:54:13 +02:00
Yuichiro NAITO
ea90779a98 Add test of FreeBSD-11. 2017-01-27 10:49:56 +09:00
Yuichiro NAITO
0a347a4537 stub uname for Non Linux environment 2016-12-21 10:52:25 +09:00
Yuichiro NAITO
646bb47b81 add stub uname default value 2016-11-24 16:12:00 +09:00
Yamashita, Yuu
b3ba8c8666 Use curl stub during tests by default 2016-06-10 05:11:26 +00:00
Yamashita, Yuu
2d2eef7012 Remove aria2c from PATH to use curl stub during test 2016-06-10 05:09:55 +00:00
Yamashita, Yuu
54286dcb7e Use aria2c the "ultra fast" download utility if available 2016-02-13 03:43:25 +00:00
Chris Seaton
ca0e1474fc Remove builds of JRuby that bundle Graal. 2016-01-01 12:01:39 +00:00
Mislav Marohnić
bd222051df Allow space-separated LDFLAGS arguments
Fixes #829, closes #830
2015-11-16 11:07:18 +01:00
Ben Browning
4c0df6afdb Properly detect OpenJDK versions in bin/ruby-build
OpenJDK reports its version slightly different than Oracle Java, and
this was causing the logic in bin/ruby-build to not detect Java 7 or
higher when OpenJDK was used.
2015-04-29 10:39:40 -04:00
Mislav Marohnić
4c1f8842e6 Avoid double shebangs when fixing Rubinius gem binstubs
This is to fix the error when installing new gems that have executables
which match existing binstubs in the Rubinius bin directory:

    "bundle" from bundler conflicts with PREFIX/gems/bin/bundle

RubyGems is supposed to override the binstub if it detects that the
previous one was also generated by RubyGems for the gem of the same
name, but its detection mechanism gets thrown off by having a double
shebang as a result of our binstubs fixing process.

https://github.com/rubygems/rubygems/blob/v2.2.2/lib/rubygems/installer.rb#L149-L154

This avoids generating binstubs with a double shebang.
2015-01-29 01:36:04 -08:00
Mislav Marohnić
7f1d8df3fe Read Java version number even if it's not on the 1st line
Handles output like:

    Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
    java version "1.8.0_31"

Fixes #710
2015-01-21 16:51:29 -08:00
Mislav Marohnić
7f1869cbcd Fix error message assertions in JRuby tests
`assert_failure` only accepts an expected message as argument, and only
if it matches the output in full.
2014-11-17 14:56:06 -08:00