Commit 53e80b586da3cdf1810ccebc475b27b81c0cf9cc
1 parent
3db33a93
Exists in
master
and in
11 other branches
Vendor the ruby software definition
Source: https://github.com/opscode/omnibus-software/blob/4309667e135644c0c49473ec16aa7dba9fa84f41/config/software/ruby.rb
Showing
1 changed file
with
162 additions
and
0 deletions
Show diff stats
@@ -0,0 +1,162 @@ | @@ -0,0 +1,162 @@ | ||
1 | +# | ||
2 | +# Copyright:: Copyright (c) 2012-2014 Chef Software, Inc. | ||
3 | +# License:: Apache License, Version 2.0 | ||
4 | +# | ||
5 | +# Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | +# you may not use this file except in compliance with the License. | ||
7 | +# You may obtain a copy of the License at | ||
8 | +# | ||
9 | +# http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | +# | ||
11 | +# Unless required by applicable law or agreed to in writing, software | ||
12 | +# distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | +# See the License for the specific language governing permissions and | ||
15 | +# limitations under the License. | ||
16 | +# | ||
17 | + | ||
18 | +name "ruby" | ||
19 | +default_version "1.9.3-p484" | ||
20 | + | ||
21 | +dependency "zlib" | ||
22 | +dependency "ncurses" | ||
23 | +dependency "libedit" | ||
24 | +dependency "openssl" | ||
25 | +dependency "libyaml" | ||
26 | +dependency "libiconv" | ||
27 | +dependency "gdbm" | ||
28 | +dependency "libgcc" if (platform == "solaris2" and Omnibus.config.solaris_compiler == "gcc") | ||
29 | + | ||
30 | +version "1.9.3-p484" do | ||
31 | + source md5: '8ac0dee72fe12d75c8b2d0ef5d0c2968' | ||
32 | +end | ||
33 | + | ||
34 | +version "2.1.1" do | ||
35 | + source md5: 'e57fdbb8ed56e70c43f39c79da1654b2' | ||
36 | +end | ||
37 | + | ||
38 | +source url: "http://cache.ruby-lang.org/pub/ruby/#{version.match(/^(\d+\.\d+)/)[0]}/ruby-#{version}.tar.gz" | ||
39 | + | ||
40 | +relative_path "ruby-#{version}" | ||
41 | + | ||
42 | +env = | ||
43 | + case platform | ||
44 | + when "mac_os_x" | ||
45 | + { | ||
46 | + # -Qunused-arguments suppresses "argument unused during compilation" | ||
47 | + # warnings. These can be produced if you compile a program that doesn't | ||
48 | + # link to anything in a path given with -Lextra-libs. Normally these | ||
49 | + # would be harmless, except that autoconf treats any output to stderr as | ||
50 | + # a failure when it makes a test program to check your CFLAGS (regardless | ||
51 | + # of the actual exit code from the compiler). | ||
52 | + "CFLAGS" => "-arch x86_64 -m64 -L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include -I#{install_dir}/embedded/include/ncurses -O3 -g -pipe -Qunused-arguments", | ||
53 | + "LDFLAGS" => "-arch x86_64 -L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include -I#{install_dir}/embedded/include/ncurses" | ||
54 | + } | ||
55 | + when "solaris2" | ||
56 | + { | ||
57 | + "CFLAGS" => "-L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include -O3 -g -pipe", | ||
58 | + "LDFLAGS" => "-R#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include -static-libgcc", | ||
59 | + "LD_OPTIONS" => "-R#{install_dir}/embedded/lib" | ||
60 | + } | ||
61 | + when "aix" | ||
62 | + { | ||
63 | + # see http://www.ibm.com/developerworks/aix/library/au-gnu.html | ||
64 | + # | ||
65 | + # specifically: | ||
66 | + # | ||
67 | + # "To use AIX run-time linking, you should create the shared object | ||
68 | + # using gcc -shared -Wl,-G and create executables using the library | ||
69 | + # by adding the -Wl,-brtl option to the link line. Technically, you | ||
70 | + # can leave off the -shared option, but it does no harm and reduces | ||
71 | + # confusion." | ||
72 | + # | ||
73 | + # AIX also uses -Wl,-blibpath instead of -R or LD_RUN_PATH, but the | ||
74 | + # option is not additive, so requires /usr/lib and /lib as well (there | ||
75 | + # is a -bsvr4 option to allow ld to take an -R flag in addition | ||
76 | + # to turning on -brtl, but it had other side effects I couldn't fix). | ||
77 | + # | ||
78 | + # If libraries linked with gcc -shared have symbol resolution failures | ||
79 | + # then it may be useful to add -bexpfull to export all symbols. | ||
80 | + # | ||
81 | + # -O2 optimized away some configure test which caused ext libs to fail | ||
82 | + # | ||
83 | + # We also need prezl's M4 instead of picking up /usr/bin/m4 which | ||
84 | + # barfs on ruby. | ||
85 | + # | ||
86 | + "CC" => "xlc -q64", | ||
87 | + "CXX" => "xlC -q64", | ||
88 | + "LD" => "ld -b64", | ||
89 | + "CFLAGS" => "-q64 -O -qhot -I#{install_dir}/embedded/include", | ||
90 | + "CXXFLAGS" => "-q64 -O -qhot -I#{install_dir}/embedded/include", | ||
91 | + "LDFLAGS" => "-q64 -L#{install_dir}/embedded/lib -Wl,-brtl -Wl,-blibpath:#{install_dir}/embedded/lib:/usr/lib:/lib", | ||
92 | + "OBJECT_MODE" => "64", | ||
93 | + "ARFLAGS" => "-X64 cru", | ||
94 | + "M4" => "/opt/freeware/bin/m4", | ||
95 | + "warnflags" => "-qinfo=por" | ||
96 | + } | ||
97 | + else | ||
98 | + { | ||
99 | + "CFLAGS" => "-I#{install_dir}/embedded/include -O3 -g -pipe", | ||
100 | + "LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib" | ||
101 | + } | ||
102 | + end | ||
103 | + | ||
104 | +build do | ||
105 | + configure_command = ["./configure", | ||
106 | + "--prefix=#{install_dir}/embedded", | ||
107 | + "--with-out-ext=fiddle,dbm", | ||
108 | + "--enable-shared", | ||
109 | + "--enable-libedit", | ||
110 | + "--with-ext=psych", | ||
111 | + "--disable-install-doc"] | ||
112 | + | ||
113 | + case platform | ||
114 | + when "aix" | ||
115 | + patch :source => "ruby-aix-configure.patch", :plevel => 1 | ||
116 | + patch :source => "ruby_aix_1_9_3_448_ssl_EAGAIN.patch", :plevel => 1 | ||
117 | + # --with-opt-dir causes ruby to send bogus commands to the AIX linker | ||
118 | + when "freebsd" | ||
119 | + configure_command << "--without-execinfo" | ||
120 | + configure_command << "--with-opt-dir=#{install_dir}/embedded" | ||
121 | + when "smartos" | ||
122 | + # Opscode patch - someara@opscode.com | ||
123 | + # GCC 4.7.0 chokes on mismatched function types between OpenSSL 1.0.1c and Ruby 1.9.3-p286 | ||
124 | + patch :source => "ruby-openssl-1.0.1c.patch", :plevel => 1 | ||
125 | + | ||
126 | + # Patches taken from RVM. | ||
127 | + # http://bugs.ruby-lang.org/issues/5384 | ||
128 | + # https://www.illumos.org/issues/1587 | ||
129 | + # https://github.com/wayneeseguin/rvm/issues/719 | ||
130 | + patch :source => "rvm-cflags.patch", :plevel => 1 | ||
131 | + | ||
132 | + # From RVM forum | ||
133 | + # https://github.com/wayneeseguin/rvm/commit/86766534fcc26f4582f23842a4d3789707ce6b96 | ||
134 | + configure_command << "ac_cv_func_dl_iterate_phdr=no" | ||
135 | + configure_command << "--with-opt-dir=#{install_dir}/embedded" | ||
136 | + else | ||
137 | + configure_command << "--with-opt-dir=#{install_dir}/embedded" | ||
138 | + end | ||
139 | + | ||
140 | + # @todo expose bundle_bust() in the DSL | ||
141 | + env.merge!({ | ||
142 | + "RUBYOPT" => nil, | ||
143 | + "BUNDLE_BIN_PATH" => nil, | ||
144 | + "BUNDLE_GEMFILE" => nil, | ||
145 | + "GEM_PATH" => nil, | ||
146 | + "GEM_HOME" => nil | ||
147 | + }) | ||
148 | + | ||
149 | + # @todo: move into omnibus-ruby | ||
150 | + has_gmake = system("gmake --version") | ||
151 | + | ||
152 | + if has_gmake | ||
153 | + env.merge!({'MAKE' => 'gmake'}) | ||
154 | + make_binary = 'gmake' | ||
155 | + else | ||
156 | + make_binary = 'make' | ||
157 | + end | ||
158 | + | ||
159 | + command configure_command.join(" "), :env => env | ||
160 | + command "#{make_binary} -j #{max_build_jobs}", :env => env | ||
161 | + command "#{make_binary} -j #{max_build_jobs} install", :env => env | ||
162 | +end |