/
rubinius
186 lines (141 loc) · 4.53 KB
/
rubinius
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#!/usr/bin/env bash
file_exists_at_url()
{
local _url="${1:-}"
if [[ -n "${_url}" ]]
then
if curl -slk --head "${_url}" 2>&1 | head -1 | grep '200 OK' >/dev/null 2>&1
then
return 0
else
return 1
fi
else
rvm_log "Warning: URL was not passed to __rvm_check_for_tarball"
return 1
fi
}
rbx_install()
{
rvm_log "$rvm_ruby_string installing #dependencies "
if ! __rvm_ensure_has_18_compat_ruby
then
rvm_log "No 1.8 compatible ruby found, cannot build rbx."
return 1
fi
# TODO: use 'rvm gems load' here:
unset CFLAGS LDFLAGS ARCHFLAGS # Important.
unset GEM_HOME GEM_PATH MY_RUBY_HOME IRBRC
__rvm_remove_rvm_from_path
__rvm_conditionally_add_bin_path
export PATH
builtin hash -r
if [[ -s "${rvm_archives_path}/${rvm_ruby_package_file}" ]] ||
[[ -n "${rvm_ruby_url:-}" ]] && file_exists_at_url "${rvm_ruby_url}"
then
rvm_head_flag=0
else
rvm_head_flag=1
rvm_ruby_repo_branch="${rvm_ruby_version}"
fi
if (( rvm_head_flag == 0 ))
then
# Install from tarball url.
rvm_log "$rvm_ruby_string #downloading ($rvm_ruby_package_file), this may take a while depending on your connection..."
"$rvm_scripts_path/fetch" "$rvm_ruby_url"
result=$?
if (( result > 0 ))
then
rvm_error "There has been an error while trying to fetch the source. Halting the installation."
exit $result
fi
__rvm_run "extract" \
"gunzip < \"${rvm_archives_path}/$(basename ${rvm_ruby_package_file})\" | tar xf - -C ${rvm_src_path} --no-same-owner" \
"$rvm_ruby_string - #extracting"
result=$?
if (( result > 0 ))
then
rvm_error "There has been an error while trying to extract the source. \nHalting the installation."
exit $result
fi
# Remove the left over folder first.
__rvm_rm_rf "${rvm_src_path}/$rvm_ruby_string"
mv "${rvm_src_path}/rubinius-${rvm_ruby_version}" \
"${rvm_src_path}/$rvm_ruby_string"
else
# Install from repository
__rvm_db "rubinius_repo_url" "rvm_ruby_repo_url"
#rvm_ruby_home="$rvm_rubies_path/$rvm_ruby_interpreter-$rvm_ruby_version"
__rvm_fetch_from_github "rbx"
result=$?
if (( result > 0 ))
then
rvm_error "There has been an error while fetching the rbx git repo. \nHalting the installation."
exit $result
fi
fi
builtin cd "${rvm_src_path}/$rvm_ruby_string"
chmod +x ./configure
__rvm_apply_patches
result=$?
if (( result > 0 ))
then
rvm_error "There has been an error while trying to apply patches to rubinius. \nHalting the installation."
return $result
fi
__rvm_db "${rvm_ruby_interpreter}_configure_flags" "db_configure_flags"
export ruby="$(__rvm_18_compat_ruby)"
rvm_configure_flags="${rvm_configure_flags:-"--skip-system"}"
rvm_ruby_configure="$rvm_wrappers_path/$ruby/ruby ${rvm_configure_env:-""} ./configure --prefix=$rvm_ruby_home $db_configure_flags $rvm_configure_flags ${rvm_install_args:-}"
message="$rvm_ruby_string - #configuring"
if (( ${rvm_llvm_flag:=1} == 0 ))
then # Explicitely disabled
rvm_ruby_configure="$rvm_ruby_configure --disable-llvm"
fi
__rvm_run "configure" "$rvm_ruby_configure" "$message"
result=$?
if (( result > 0 ))
then
rvm_error "There has been an error while running '$rvm_ruby_configure'. \nHalting the installation."
exit $result
fi
if (( ${rvm_trace_flag:=0} == 1 ))
then
rvm_ruby_make="$rvm_wrappers_path/$ruby/rake install --trace"
message="$rvm_ruby_string - #compiling (with --trace)"
else
rvm_ruby_make="$rvm_wrappers_path/$ruby/rake install"
message="$rvm_ruby_string - #compiling"
fi
__rvm_run "rake" "$rvm_ruby_make" "$message"
result=$?
if (( result > 0 ))
then
rvm_error "There has been an error while running '$rvm_ruby_configure'.\nHalting the installation."
exit $result
fi ; unset ruby
# Symlink rubinius wrappers
ln -fs "$rvm_ruby_home/bin/rbx" "$rvm_ruby_home/bin/ruby"
# Install IRB Wrapper on Rubinius.
file_name="$rvm_ruby_home/bin/irb"
rm -f "$file_name"
printf '#!/usr/bin/env bash\n' > "$file_name"
printf "exec '$rvm_ruby_home/bin/rbx' 'irb' \"\$@\"\n" >> "$file_name"
if [[ ! -x "$file_name" ]]
then
chmod +x "$file_name"
fi
# Install Gem Wrapper on Rubinius.
file_name="$rvm_ruby_home/bin/gem"
cp -f "$rvm_ruby_home/lib/bin/gem.rb" "$file_name"
__rvm_inject_ruby_shebang "$file_name"
if [[ ! -x "$file_name" ]]
then
chmod +x "$file_name"
fi
unset file_name
binaries=(erb ri rdoc)
__rvm_post_install
__rvm_irbrc
__rvm_bin_script
}