├── .gitignore ├── patches ├── 2.0 │ └── objc_msg_send.patch └── 1.9 │ └── objc_msg_send.patch ├── README.md └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /patches/2.0/objc_msg_send.patch: -------------------------------------------------------------------------------- 1 | diff --git configure.in configure.in 2 | index 3c6ce92f81..7ce7145cbb 100644 3 | --- configure.in 4 | +++ configure.in 5 | @@ -2543,9 +2543,6 @@ else 6 | AS_CASE(["$target_os"], 7 | [hpux*], [ 8 | DLEXT=sl], 9 | - [darwin*], [ 10 | - RUBY_APPEND_OPTION(XLDFLAGS, [-Wl,-u,_objc_msgSend]) 11 | - DLEXT=bundle], 12 | [os2-emx*], [ 13 | LOAD_RELATIVE=1 14 | DLEXT=dll], 15 | -------------------------------------------------------------------------------- /patches/1.9/objc_msg_send.patch: -------------------------------------------------------------------------------- 1 | diff --git configure.in configure.in 2 | index 2736233699..11c6c5b0e4 100644 3 | --- configure.in 4 | +++ configure.in 5 | @@ -2231,9 +2231,6 @@ else 6 | AS_CASE(["$target_os"], 7 | [hpux*], [ 8 | DLEXT=sl], 9 | - [nextstep*|openstep*|rhapsody*|darwin*], [ 10 | - RUBY_APPEND_OPTION(XLDFLAGS, [-Wl,-u,_objc_msgSend]) 11 | - DLEXT=bundle], 12 | [os2-emx*], [ 13 | LOAD_RELATIVE=1 14 | DLEXT=dll], 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Build script for old versions of Ruby 2 | 3 | A build script for old Ruby versions for macOS (ARM64). 4 | 5 | ## Background 6 | 7 | Ruby versions released before Apple Silicon (M1/M2) processors do not support ARM64 architecture out of the box. This makes it difficult to build and run older Ruby versions on modern Apple Silicon Macs. This script provides necessary patches and configurations to build these older Ruby versions on Apple Silicon, enabling developers to run legacy Ruby applications or test their code across different Ruby versions on modern macOS hardware. 8 | 9 | ## Usage 10 | 11 | ``` 12 | $ ruby build.rb 13 | ``` 14 | 15 | Example: 16 | 17 | ``` 18 | $ ruby build.rb 2.7 /opt/rubies 19 | ``` 20 | 21 | This will build Ruby 2.7.8 and install it to `/opt/rubies/2.7.8`. 22 | 23 | ## Configuration 24 | 25 | Ruby version information and source URLs are stored in `package.json`. The file contains a list of Ruby versions and their corresponding source code and patch URLs. 26 | 27 | Each version entry in `package.json` has the following structure: 28 | 29 | ```json 30 | "2.7": { 31 | "before": [ 32 | "https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.8.tar.xz", 33 | "https://raw.githubusercontent.com/macports/macports-ports/refs/heads/master/lang/ruby27/files/patch-sources.diff" 34 | ], 35 | "after": [ 36 | "https://raw.githubusercontent.com/macports/macports-ports/refs/heads/master/lang/ruby27/files/patch-generated.diff" 37 | ], 38 | "full_version": "2.7.8" 39 | } 40 | ``` 41 | 42 | - `before`: Array of URLs for the Ruby source tarball and patches to apply before building 43 | - `after`: Array of URLs for patches to apply after configuration 44 | - `full_version`: The full version number including patch level 45 | 46 | ## Supported Versions 47 | 48 | The following Ruby versions are available for installation: 49 | 50 | | Major Version | Full Version | 51 | |--------------|--------------| 52 | | 3.0 | 3.0.7 | 53 | | 2.7 | 2.7.8 | 54 | | 2.6 | 2.6.10 | 55 | | 2.5 | 2.5.9 | 56 | | 2.4 | 2.4.10 | 57 | | 2.3 | 2.3.8 | 58 | | 2.2 | 2.2.10 | 59 | | 2.1 | 2.1.10 | 60 | | 2.0 | 2.0.0-p648 | 61 | | 1.9 | 1.9.3-p551 | 62 | | 1.8 | 1.8.7-p374 | 63 | 64 | To build all supported versions: 65 | 66 | ``` 67 | $ ruby build.rb all /opt/rubies 68 | ``` 69 | 70 | ## License 71 | 72 | MIT 73 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": { 3 | "3.0": { 4 | "before": [ 5 | "https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.7.tar.xz", 6 | "https://raw.githubusercontent.com/macports/macports-ports/refs/heads/master/lang/ruby30/files/patch-sources.diff" 7 | ], 8 | "after": [ 9 | "https://raw.githubusercontent.com/macports/macports-ports/refs/heads/master/lang/ruby30/files/patch-generated.diff" 10 | ], 11 | "full_version": "3.0.7" 12 | }, 13 | "2.7": { 14 | "before": [ 15 | "https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.8.tar.xz", 16 | "https://raw.githubusercontent.com/macports/macports-ports/refs/heads/master/lang/ruby27/files/patch-sources.diff" 17 | ], 18 | "after": [ 19 | "https://raw.githubusercontent.com/macports/macports-ports/refs/heads/master/lang/ruby27/files/patch-generated.diff" 20 | ], 21 | "full_version": "2.7.8" 22 | }, 23 | "2.6": { 24 | "before": [ 25 | "https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.10.tar.xz", 26 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby26/files/patch-sources.diff" 27 | ], 28 | "after": [ 29 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby26/files/patch-generated.diff" 30 | ], 31 | "full_version": "2.6.10" 32 | }, 33 | "2.5": { 34 | "before": [ 35 | "https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.9.tar.xz", 36 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby25/files/patch-tiger.diff", 37 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby25/files/patch-osversions.diff", 38 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby25/files/patch-configure_cxx11.diff", 39 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby25/files/patch-test-fiddle-helper.rb.diff", 40 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby25/files/patch-ext-openssl-extconf.rb.diff" 41 | ], 42 | "after": [], 43 | "full_version": "2.5.9" 44 | }, 45 | "2.4": { 46 | "before": [ 47 | "https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.10.tar.xz", 48 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby24/files/patch-configure.diff", 49 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby24/files/patch-tiger.diff", 50 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby24/files/patch-osversions.diff", 51 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby24/files/patch-configure_cxx11.diff", 52 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby24/files/patch-ext-openssl-extconf.rb.diff" 53 | ], 54 | "after": [], 55 | "full_version": "2.4.10" 56 | }, 57 | "2.3": { 58 | "before": [ 59 | "https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.8.tar.xz", 60 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby23/files/patch-ext_openssl_ossl.h.diff", 61 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby23/files/patch-tiger.diff", 62 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby23/files/patch-configure_cxx11.diff", 63 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby23/files/patch-openssl_pkgconfig.diff" 64 | ], 65 | "after": [], 66 | "full_version": "2.3.8" 67 | }, 68 | "2.2": { 69 | "before": [ 70 | "https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.10.tar.xz", 71 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby22/files/patch-ext_openssl_ossl.h.diff", 72 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby22/files/patch-internal.h.diff", 73 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby22/files/patch-configure_cxx11.diff", 74 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby22/files/patch-openssl_pkgconfig.diff" 75 | ], 76 | "after": [], 77 | "full_version": "2.2.10" 78 | }, 79 | "2.1": { 80 | "before": [ 81 | "https://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.10.tar.xz", 82 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby21/files/patch-ext_openssl_ossl.h.diff", 83 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby21/files/patch-configure_cxx11.diff", 84 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby21/files/patch-openssl_pkgconfig.diff" 85 | ], 86 | "after": [], 87 | "full_version": "2.1.10" 88 | }, 89 | "2.0": { 90 | "before": [ 91 | "https://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p648.tar.xz", 92 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby20/files/patch-ext-tk-extconf.rb.diff", 93 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby20/files/patch-configure_cxx11.diff", 94 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby20/files/implicit.patch", 95 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby20/files/patch-openssl_pkgconfig.diff" 96 | ], 97 | "after": [], 98 | "full_version": "2.0.0-p648" 99 | }, 100 | "1.9": { 101 | "before": [ 102 | "https://cache.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p551.tar.xz", 103 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby19/files/patch-lib-rubygems-specification.rb.diff", 104 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby19/files/patch-configure_cxx11.diff", 105 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby19/files/patch-ext-openssl-openssl_missing.diff", 106 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby19/files/patch-ext_openssl_ossl_x509ext.c.diff", 107 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby19/files/implicit.patch", 108 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby19/files/patch-openssl_pkgconfig.diff" 109 | ], 110 | "after": [], 111 | "full_version": "1.9.3-p551" 112 | }, 113 | "1.8": { 114 | "before": [ 115 | "https://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p374.tar.gz", 116 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby/files/patch-vendordir.diff", 117 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby/files/patch-bug3604.diff", 118 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby/files/patch-bug19050.diff", 119 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby/files/patch-bug15528.diff", 120 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby/files/patch-c99.diff", 121 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby/files/patch-lib-drb-ssl.rb.diff", 122 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby/files/patch-Makefile.in", 123 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby/files/patch-numeric.c.diff", 124 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby/files/patch-configure.diff", 125 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby/files/patch-ext-tk-extconf.rb.diff", 126 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby/files/patch-ext_openssl_extconf_rb.diff", 127 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby/files/patch-ext_openssl_ossl_ssl_c.diff", 128 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby/files/patch-ext_openssl_ossl.h.diff", 129 | "https://raw.githubusercontent.com/macports/macports-ports/master/lang/ruby/files/implicit.patch" 130 | ], 131 | "after": [], 132 | "full_version": "1.8.7-p374" 133 | } 134 | } 135 | } --------------------------------------------------------------------------------