Skip to content

Commit 4206b99

Browse files
committedMay 20, 2016
Remove Ruby from the build system.
The use of Ruby in the build sytem severely complicates building and packaging Rubinius and has resulted in Rubinius either not getting packaged for various platforms or even removed from existing packages like Homebrew.
1 parent 06916ce commit 4206b99

File tree

7 files changed

+89
-9
lines changed

7 files changed

+89
-9
lines changed
 

Diff for: ‎.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,6 @@ vendor/cache/*
9595

9696
.build_ruby
9797
.build_signature
98+
99+
rubinius-runtime-core.tar.bz2
100+
rubinius-runtime-core.tar.bz2.sha512

Diff for: ‎configure

+21
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ class Configure
166166
@ruby_libversion = @ruby_version.split(/\./)[0..1].join.to_i
167167

168168
@build_bin = "#{@sourcedir}/build/bin"
169+
@scriptsdir = "#{@sourcedir}/scripts"
169170

170171
# Configure settings
171172
@release_build = !in_git?
@@ -1779,6 +1780,24 @@ int main() { return tgetnum(""); }
17791780
end
17801781
end
17811782

1783+
def fetch_core
1784+
@log.write "\nFetching runtime core..."
1785+
1786+
unless File.directory? "#{@sourcedir}/runtime/core"
1787+
system("#{@scriptsdir}/build_support.sh fetch_core")
1788+
1789+
failure "Unable to fetch runtime core" unless $?.success?
1790+
end
1791+
end
1792+
1793+
def setup_core
1794+
@log.write "\nSetting up runtime core..."
1795+
1796+
system("#{@scriptsdir}/build_support.sh setup_core")
1797+
1798+
failure "Unable to setup runtime core from archive" unless $?.success?
1799+
end
1800+
17821801
def fetch_gems
17831802
@log.write "\nFetching gems..."
17841803
failed = false
@@ -1884,8 +1903,10 @@ int main() { return tgetnum(""); }
18841903
verify_gems
18851904
else
18861905
fetch_gems
1906+
fetch_core
18871907
end
18881908
setup_gems
1909+
setup_core
18891910
write_configure_files
18901911
write_build_signature
18911912

Diff for: ‎machine/environment.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ namespace rubinius {
656656
bool Environment::load_signature(std::string runtime) {
657657
std::string path = runtime;
658658

659-
path += "/signature";
659+
path += "/core/signature";
660660

661661
std::ifstream signature(path.c_str());
662662
if(signature) {

Diff for: ‎rakelib/core.rake

+11-5
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ end
9595
# Generate a digest of the Rubinius runtime files
9696
signature_file = "core/signature.rb"
9797

98+
runtime_signature_file = "runtime/core/signature"
99+
98100
runtime_gems_dir = BUILD_CONFIG[:runtime_gems_dir]
99101
bootstrap_gems_dir = BUILD_CONFIG[:bootstrap_gems_dir]
100102

@@ -176,7 +178,7 @@ bootstrap_gem_files.each do |name|
176178
end
177179

178180
namespace :compiler do
179-
task :load => ['compiler:generate'] do
181+
task :load do
180182
require "rubinius/bridge"
181183
require "rubinius/code/toolset"
182184

@@ -189,8 +191,6 @@ namespace :compiler do
189191

190192
require File.expand_path("../../core/signature", __FILE__)
191193
end
192-
193-
task :generate => [signature_file]
194194
end
195195

196196
directory "runtime/core"
@@ -287,11 +287,11 @@ file "runtime/core/initialize" => "runtime/core/data" do |t|
287287
end
288288
end
289289

290-
file "runtime/core/signature" => signature_file do |t|
290+
file runtime_signature_file => signature_file do |t|
291291
puts "CodeDB: writing signature..."
292292

293293
File.open t.name, "wb" do |f|
294-
f.puts Rubinius::Signature
294+
f.puts SIGNATURE_HASH
295295
end
296296
end
297297

@@ -302,6 +302,12 @@ namespace :core do
302302
desc "Build all core library files"
303303
task :build => ['compiler:load'] + runtime_files + code_db_files
304304

305+
desc "Create runtime core signature"
306+
task :signature => [signature_file, signature_header, runtime_signature_file]
307+
308+
desc "Create platform configuration"
309+
task :platform => "runtime/platform.conf"
310+
305311
desc "Delete all .rbc files"
306312
task :clean do
307313
core_clean

Diff for: ‎rakelib/vm.rake

+2-2
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@ namespace :build do
153153
# Issue the actual build commands. NEVER USE DIRECTLY.
154154
task :build => %W[
155155
#{VM_EXE}
156-
compiler:generate
156+
core:signature
157+
core:platform
157158
stage:bin
158159
stage:extra_bins
159160
stage:capi_include
160-
core:build
161161
stage:core
162162
stage:runtime
163163
stage:lib

Diff for: ‎scripts/build_support.sh

+47-1
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@ __dir__="$(cd "$(dirname "$0")" && pwd)"
44

55
# shellcheck source=scripts/configuration.sh
66
source "$__dir__/configuration.sh"
7+
# shellcheck source=scripts/digest.sh
8+
source "$__dir__/digest.sh"
79
# shellcheck source=scripts/aws.sh
810
source "$__dir__/aws.sh"
911
# shellcheck source=scripts/io.sh
1012
source "$__dir__/io.sh"
1113

1214
function rbx_archive_core {
13-
local archive ext url bucket
15+
local archive ext path bucket url
1416

1517
archive="$(rbx_runtime_core_name)"
1618
ext=".sha512"
19+
path="$(rbx_runtime_core_path)"
1720
bucket="$(rbx_binary_bucket)"
1821
url=$(rbx_url_prefix "$bucket")
1922

@@ -29,6 +32,43 @@ function rbx_archive_core {
2932
rm -f "$archive" "$archive$ext"
3033
}
3134

35+
function rbx_fetch_core {
36+
local archive digest check path bucket url
37+
38+
archive="$(rbx_runtime_core_name)"
39+
digest="$archive.sha512"
40+
check="$digest.check"
41+
path="$(rbx_runtime_core_path)"
42+
bucket="$(rbx_binary_bucket)"
43+
url=$(rbx_url_prefix "$bucket")
44+
45+
rbx_s3_download "$url" "$archive" "$path"
46+
rbx_s3_download "$url" "$digest" "$path"
47+
48+
mv "$digest" "$check"
49+
50+
rbx_digest_file "$archive"
51+
52+
diff "$digest" "$check"
53+
if [ $? -ne 0 ]; then
54+
fail "runtime core achive digest does not match"
55+
fi
56+
57+
rm -f "$digest" "$check"
58+
}
59+
60+
function rbx_setup_core {
61+
local runtime
62+
63+
runtime="./runtime"
64+
65+
rm -rf "$runtime/core"
66+
67+
if [ ! -d "$runtime" ]; then mkdir "$runtime"; fi
68+
69+
bzip2 -dc "$(rbx_runtime_core_name)" | tar -x -f -
70+
}
71+
3272
function rbx_build_support_usage {
3373
cat >&2 <<-EOM
3474
Usage: ${0##*/} archive_core
@@ -41,6 +81,12 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
4181
"archive_core")
4282
rbx_archive_core
4383
;;
84+
"fetch_core")
85+
rbx_fetch_core
86+
;;
87+
"setup_core")
88+
rbx_setup_core
89+
;;
4490
"-h"|"--help"|*)
4591
rbx_build_support_usage
4692
;;

Diff for: ‎scripts/configuration.sh

+4
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ function rbx_runtime_core_name {
6161
echo "rubinius-runtime-core.tar.bz2"
6262
}
6363

64+
function rbx_runtime_core_path {
65+
echo "/runtime/"
66+
}
67+
6468
function rbx_release_bucket {
6569
echo "rubinius-releases-rubinius-com"
6670
}

0 commit comments

Comments
 (0)
Please sign in to comment.