Class: BungeeGum::RubyBuild
- Inherits:
-
Object
- Object
- BungeeGum::RubyBuild
- Defined in:
- lib/bungee_gum/ruby_build.rb
Constant Summary collapse
- GITHUB_RUBY_REPOSITORY =
'https://github.com/ruby/ruby.git'
- LOCAL_RUBY_REPOSITORY =
'base-ruby-repo'
- FOR_BUILD_REPOSITORY =
'build-ruby-repo'
- FOR_UP_BUILD_REPOSITORY =
'build-up-ruby-repo'
- FOR_YJIT_BUILD_REPOSITORY =
'build-yjit-ruby-repo'
- FOR_FORCE_YJIT_BUILD_REPOSITORY =
'build-force-yjit-ruby-repo'
- FOR_RJIT_BUILD_REPOSITORY =
'build-rjit-ruby-repo'
- FOR_FORCE_RJIT_BUILD_REPOSITORY =
'build-force-rjit-ruby-repo'
- INSTALL_PREFIX_BASE =
"#{Dir.home}/.rubies"
- INSTALL_PREFIX_RUBY =
"#{INSTALL_PREFIX_BASE}/ruby-master"
- INSTALL_PREFIX_RUBY_UP =
"#{INSTALL_PREFIX_BASE}/ruby-universal-parser"
- INSTALL_PREFIX_RUBY_YJIT =
"#{INSTALL_PREFIX_BASE}/ruby-yjit"
- INSTALL_PREFIX_RUBY_FORCE_YJIT =
"#{INSTALL_PREFIX_BASE}/ruby-force-yjit"
- INSTALL_PREFIX_RUBY_RJIT =
"#{INSTALL_PREFIX_BASE}/ruby-rjit"
- INSTALL_PREFIX_RUBY_FORCE_RJIT =
"#{INSTALL_PREFIX_BASE}/ruby-force-rjit"
Instance Method Summary collapse
-
#initialize ⇒ RubyBuild
constructor
A new instance of RubyBuild.
- #run ⇒ Object
Constructor Details
#initialize ⇒ RubyBuild
Returns a new instance of RubyBuild.
24 25 26 27 28 29 30 |
# File 'lib/bungee_gum/ruby_build.rb', line 24 def initialize @base_ruby_repo = "#{Dir.pwd}/#{LOCAL_RUBY_REPOSITORY}" @working_dir = {} @now = Time.now.strftime('%Y%m%d%H%M%S') @opt = OptionParser.new @opt.version = BungeeGum::VERSION end |
Instance Method Details
#run ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/bungee_gum/ruby_build.rb', line 32 def run param = {} params = [] param[:with] = {} param[:only] = {} param[:skip] = {} @opt.on('--with-universalparser', 'Add `--with-universalparser` if you also would like to build with enabled Universal Parser. This is equivalent to adding `cppflags=-DUNIVERSAL_PARSER`.') {|v| param[:with][:up] = v params << '--with-universalparser' } @opt.on('--only-universalparser', 'Add `--only-universalparser` if you would like to build with only enabled Universal Parser. This is equivalent to adding `cppflags=-DUNIVERSAL_PARSER`. This option can not be used in conjunction with other options.') {|v| param[:only][:up] = v params << '--only-universalparser' } @opt.on('--with-yjit', 'Add `--with-yjit` if you also would like to build with enabled YJIT. This is equivalent to adding `--enable-yjit`.') {|v| param[:with][:yjit] = v params << '--with-yjit' } @opt.on('--only-yjit', 'Add `--only-yjit` if you would like to build with only enabled YJIT. This is equivalent to adding `--enable-yjit`. This option can not be used in conjunction with other options.') {|v| param[:only][:yjit] = v params << '--only-yjit' } @opt.on('--with-force-yjit', 'Add `--with-force-yjit` if you also would like to build with enabled YJIT. This is equivalent to adding `cppflags=-DYJIT_FORCE_ENABLE`.') {|v| param[:with][:force_yjit] = v params << '--with-force-yjit' } @opt.on('--only-force-yjit', 'Add `--only-force-yjit` if you would like to build with only enabled YJIT. This is equivalent to adding `cppflags=-DYJIT_FORCE_ENABLE`. This option can not be used in conjunction with other options.') {|v| param[:only][:force_yjit] = v params << '--only-force-yjit' } @opt.on('--with-rjit', 'Add `--with-rjit` if you also would like to build with enabled RJIT. This is equivalent to adding `--enable-rjit --disable-yjit`.') {|v| param[:with][:rjit] = v params << '--with-rjit' } @opt.on('--only-rjit', 'Add `--only-rjit` if you would like to build with only enabled RJIT. This is equivalent to adding `--enable-rjit --disable-yjit`. This option can not be used in conjunction with other options.') {|v| param[:only][:rjit] = v params << '--only-rjit' } @opt.on('--with-force-rjit', 'Add `--with-force-rjit` if you also would like to build with enabled RJIT. This is equivalent to adding `cppflags=-DRJIT_FORCE_ENABLE`.') {|v| param[:with][:force_rjit] = v params << '--with-force-rjit' } @opt.on('--only-force-rjit', 'Add `--only-force-rjit` if you would like to build with only enabled RJIT. This is equivalent to adding `cppflags=-DRJIT_FORCE_ENABLE`. This option can not be used in conjunction with other options.') {|v| param[:only][:force_rjit] = v params << '--only-force-rjit' } @opt.on('--all-build', 'Add `--all-build` if you would like to build with all patterns that include `cppflags` option') {|v| param[:all_build] = v params << '--all-build' } @opt.parse!(ARGV) if param[:only].keys.size > 1 || (param[:only].keys.size == 1 && !param[:with].empty?) || (param[:only].keys.size == 1 && !!param[:all_build]) only_error('--only-universalparser') if params.include?('--only-universalparser') only_error('--only-yjit') if params.include?('--only-yjit') only_error('--only-force-yjit') if params.include?('--only-force-yjit') only_error('--only-rjit') if params.include?('--only-rjit') only_error('--only-force-rjit') if params.include?('--only-force-rjit') exit 1 end clone_or_pull(LOCAL_RUBY_REPOSITORY, true) Dir.mkdir(INSTALL_PREFIX_BASE, 0755) unless Dir.exist?(INSTALL_PREFIX_BASE) Dir.mkdir('logs', 0755) unless Dir.exist?('./logs') if param[:only].keys.size == 0 clone_or_pull(FOR_BUILD_REPOSITORY) fork { make_and_test( FOR_BUILD_REPOSITORY, 'master', "--prefix=#{INSTALL_PREFIX_RUBY}") } end if param[:only][:up] || param[:with][:up] || param[:all_build] clone_or_pull(FOR_UP_BUILD_REPOSITORY) fork { make_and_test( FOR_UP_BUILD_REPOSITORY, 'universal-parser', "--prefix=#{INSTALL_PREFIX_RUBY_UP} --enable-shared cppflags=-DUNIVERSAL_PARSER") } end if param[:only][:yjit] || param[:with][:yjit] || param[:all_build] clone_or_pull(FOR_YJIT_BUILD_REPOSITORY) fork { make_and_test( FOR_YJIT_BUILD_REPOSITORY, 'yjit', "--prefix=#{INSTALL_PREFIX_RUBY_YJIT} --enable-yjit --disable-install-doc") } end if param[:only][:force_yjit] || param[:with][:force_yjit] || param[:all_build] clone_or_pull(FOR_FORCE_YJIT_BUILD_REPOSITORY) fork { make_and_test( FOR_FORCE_YJIT_BUILD_REPOSITORY, 'force-yjit', "--prefix=#{INSTALL_PREFIX_RUBY_FORCE_YJIT} cppflags=-DYJIT_FORCE_ENABLE --disable-install-doc") } end if param[:only][:rjit] || param[:with][:rjit] || param[:all_build] clone_or_pull(FOR_RJIT_BUILD_REPOSITORY) fork { make_and_test( FOR_RJIT_BUILD_REPOSITORY, 'rjit', "--prefix=#{INSTALL_PREFIX_RUBY_RJIT} --enable-rjit --disable-yjit --disable-install-doc") } end if param[:only][:force_rjit] || param[:with][:force_rjit] || param[:all_build] clone_or_pull(FOR_FORCE_RJIT_BUILD_REPOSITORY) fork { make_and_test( FOR_FORCE_RJIT_BUILD_REPOSITORY, 'force-rjit', "--prefix=#{INSTALL_PREFIX_RUBY_FORCE_RJIT} cppflags=-DRJIT_FORCE_ENABLE --disable-install-doc") } end Process.waitall end |