Skip to content

Commit 3fb6efb

Browse files
committed
ruby-build definitions to support running old Ruby versions on current M1 macOS
Start with 1.8.7-p374
0 parents  commit 3fb6efb

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

1.8.7-p374

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Old config.guess isn't arm64-aware. Pull a new one in from automake.
2+
build_package_freshen_automake_config() {
3+
{
4+
brew install automake
5+
cp `brew --prefix automake`/share/automake-*/config.{guess,sub} .
6+
} >&4 2>&1
7+
}
8+
9+
# https://bugs.ruby-lang.org/issues/1382
10+
build_package_patch_lex_c99() {
11+
patch -p1 --force <<EOF
12+
diff --git a/lex.c b/lex.c
13+
index a15309d502..35a2f03052 100644
14+
--- a/lex.c
15+
+++ b/lex.c
16+
@@ -68,7 +68,7 @@ hash (str, len)
17+
#ifdef __GNUC__
18+
__inline
19+
#endif
20+
-struct kwtable *
21+
+static struct kwtable *
22+
rb_reserved_word (str, len)
23+
register const char *str;
24+
register unsigned int len;
25+
EOF
26+
}
27+
28+
# Clang errors on warnings. Tell it to ignore this one.
29+
export RUBY_CFLAGS="-Wno-error=implicit-function-declaration"
30+
31+
# M1-compatible OpenSSL 1.0 from https://github.com/basecamp/homebrew-dev
32+
brew install basecamp/dev/[email protected]
33+
package_option ruby configure --with-openssl-dir="$(brew --prefix basecamp/dev/[email protected])"
34+
35+
require_gcc
36+
install_package "ruby-1.8.7-p374" "https://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p374.tar.bz2#b4e34703137f7bfb8761c4ea474f7438d6ccf440b3d35f39cc5e4d4e239c07e3" freshen_automake_config patch_lex_c99 auto_tcltk standard
37+
install_package "rubygems-1.8.23" "https://rubygems.org/rubygems/rubygems-1.8.23.tgz#e4a1c6bbaac411eaab94deae78228b7584033a1f10a022f52bffa9613aa29061" ruby

README.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## Old Rubies, meet new macOS
2+
3+
Trying to run an old, unsupported Ruby on an M1 Mac? You're in the right place.
4+
5+
This is a collection of ruby-build definitions for local dev on macOS. Not for production use. Homebrew is required.
6+
7+
Ruby versions:
8+
* 1.8.7-p374
9+
10+
11+
### How to install
12+
13+
Grab the build definition by cloning the repo or `curl`ing a specific file, then `rbenv install` the path to the definition.
14+
15+
```bash
16+
git clone https://github.com/basecamp/ruby-dev
17+
cd ruby-dev
18+
rbenv install ./1.8.7-p374
19+
```
20+
21+
or
22+
```bash
23+
curl -O https://raw.githubusercontent.com/basecamp/ruby-dev/main/1.8.7-p374
24+
rbenv install ./1.8.7-p374
25+
```
26+
27+
(Note the leading `./` - this is a path to a specific build definition for ruby-build, not a version specific for it to look for among its built-in definitions.)

0 commit comments

Comments
 (0)