Commit graph

201 commits

Author SHA1 Message Date
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ć
c4f811a23d
Fix commands printed when TMPDIR is empty 2023-11-08 23:56:03 +01:00
Mislav Marohnić
1aa0bfce12
Add ruby-build(1) man page 2023-11-07 18:20:59 +01:00
Mislav Marohnić
b80edb1889
💅 Tidy up ruby-build help output 2023-11-07 18:20:59 +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ć
93c50bbaf0
Show progress of downloaded files in the terminal
This connects the stderr of download utilities like curl and wget to the
original stderr of the process so that they can detect a terminal and
print progress bars to it.
2023-11-07 10:17:54 +01:00
Mislav Marohnić
c6f8eb38cf
Print external commands that ruby-build executes
ruby-build now prints the full invocation of (almost) every external
command that it runs. Typically that is something like:

    -> ./configure --prefix=/path/to/ruby
    -> make -j 2
    -> make install

All output of these commands still goes to the log file by default.

This changes the behavior of `--verbose` mode to simply redirect all
command output to the stdout & stderr of the parent process instead of
writing to and then tailing the log file. This allows implementations of
commands like `./configure` or `make` to detect a terminal and output
color.
2023-11-07 09:48:04 +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ć
fe933abbf8
Merge pull request #2271 from rbenv/ldflags-clean
Remove implicit LDFLAGS, CPPFLAGS, and "ldflags_dirs" build step
2023-10-16 18:19:29 +02:00
Mislav Marohnić
aada31aed5
Avoiding excessive cd when fetching git repos (#2273) 2023-10-16 14:40:04 +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ć
a4c6878ff5
Remove require_gcc implementation
This was only used in Ruby versions < 1.9.3, which are now EOL.

This also removes a 11-years old workaround for building Ruby 2.0 with clang.
06d7994bcf
2023-08-03 14:53:52 +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ć
4cc9dc3be8
appease linter 2023-03-06 19:19:31 +01: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
Masato Ohba
46878c9646
Remove brew update instruction (#2151)
because `brew update` runs automatically on `brew upgrade` by default since long time ago.
2023-02-20 16:00:59 +01:00
Mislav Marohnić
7de903c560
Fix rbenv install --list exit status 2022-10-03 13:28:58 +02:00
Mislav Marohnić
cde170b581
Suggest rbenv global if there is no explicit global setting (#2052)
Upon installing their first Ruby version on the system, the user may want to set it as their default; otherwise the default will remain "system" and any `gem install` attempts will fail with a permission error.

This suggestion is skipped if the user already has chosen an explicit default, even if it's "system".
2022-09-25 11:20:43 +02: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
a753b24551 Show the log file to make it easy to follow progress
* Fixes https://github.com/rbenv/ruby-build/issues/1721
2022-08-06 13:04:40 +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
Benoit Daloze
44729b287f Handle multiple directories in PATH having an executable for remove_commands_from_path
* This is common on Linux where e.g. /bin = /usr/bin and both are in PATH.
2021-07-07 20:04:22 +02:00
Hiroshi SHIBATA
99f6bcbe49
Merge pull request #1457 from uzxmx/feature/specify-complete-mirror-url
Support specifying the complete mirror URL
2020-12-03 15:14:46 +09:00
Benoit Daloze
30895f03c4 Rename definition to truffleruby+graalvm
* '+' needs to be considered part of the name for --definitions and -l
  to see truffleruby and truffleruby+graalvm as separate.
2020-07-22 16:41:01 +02:00
Benoit Daloze
767a1ccc30 Add support for installing GraalVM
* Supports using other GraalVM languages such as JavaScript, Python, R and Java.
* Supports running TruffleRuby on JVM and not only Native.
* Add GraalVM 20.1.0.
2020-07-22 16:41:01 +02:00
Mingxiang Xue
b034b8cd37 Add RUBY_BUILD_MIRROR_PACKAGE_URL to specify the complete mirror URL
Signed-off-by: Mingxiang Xue <mingxiangxue@gmail.com>
2020-07-18 00:36:59 +08:00
Koichiro Iwao
e2b65f5dd5 Merge branch 'master' into list-exclude-eol 2020-04-27 11:20:31 +09:00
Koichiro Iwao
c76bf6fb80
s/all available definitions/all local definitions/
"available" implies ruby-build will be checking online sources but
actually ruby-build doesn't do that. "local definitions" may be
prefered.

Pointed out by jasonkarns.
2020-03-20 18:08:04 +09:00
Koichiro Iwao
66647e3953
s/all built-in definitions/all available definitions/
Suggested by mislav: https://github.com/rbenv/ruby-build/pull/1402#discussion_r389060742

> I wonder should we substitute "built-in" with something like "all
> available definitions". Since ruby-build will additionally pick up
> definitions found under the paths listed in RUBY_BUILD_DEFINITIONS,
> these definitions will get listed even if they are not "built-in".
> Therefore, "built-in" feels like a misnomer here.
2020-03-19 18:16:16 +09:00
Koichiro Iwao
67ac0b45d6
the short list now shows only latest stable versions
for each Ruby implementations like the following.

    2.4.9
    2.5.7
    2.6.5
    2.7.0
    jruby-9.2.9.0
    maglev-1.0.0
    mruby-2.1.0
    rbx-3.107
    truffleruby-19.3.1
2020-03-06 22:23:46 +09:00
Koichiro Iwao
abaebf3ea1
Fix CI 2020-03-03 15:44:02 +09:00
Koichiro Iwao
f9aae4e6ff
Fix CI 2020-02-19 11:13:35 +09:00
eladeyal-intel
1e94192659 shorter git command chains 2020-01-31 17:23:02 +02:00
Koichiro Iwao
4577be8fac
Fix CI: Add --list-exclude-eol option to test 2020-01-30 15:36:26 +09:00
Benoit Daloze
08af628396 Add a few extra examples for the version sorting test 2019-11-21 16:41:12 +01:00