Commit e5409c918266c46d624dafd1339ad3d7e03d4b48
1 parent
0f502fa6
Exists in
master
and in
17 other branches
Use a custom ruby software definition
While we are waiting for a decision on https://github.com/opscode/omnibus-software/pull/124 , we can vendor the ruby software definition to get more reliable Ruby source downloads in the meantime.
Showing
1 changed file
with
158 additions
and
0 deletions
Show diff stats
| @@ -0,0 +1,158 @@ | @@ -0,0 +1,158 @@ | ||
| 1 | +# | ||
| 2 | +# Copyright:: Copyright (c) 2012 Opscode, 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 | +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" if (platform == "mac_os_x" or platform == "freebsd" or platform == "aix") | ||
| 28 | +dependency "libgcc" if (platform == "solaris2" and Omnibus.config.solaris_compiler == "gcc") | ||
| 29 | + | ||
| 30 | +source :url => "http://cache.ruby-lang.org/pub/ruby/1.9/ruby-#{version}.tar.gz", | ||
| 31 | + :md5 => '8ac0dee72fe12d75c8b2d0ef5d0c2968' | ||
| 32 | + | ||
| 33 | +relative_path "ruby-#{version}" | ||
| 34 | + | ||
| 35 | +env = | ||
| 36 | + case platform | ||
| 37 | + when "mac_os_x" | ||
| 38 | + { | ||
| 39 | + "CFLAGS" => "-arch x86_64 -m64 -L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include -I#{install_dir}/embedded/include/ncurses -O3 -g -pipe", | ||
| 40 | + "LDFLAGS" => "-arch x86_64 -R#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include -I#{install_dir}/embedded/include/ncurses" | ||
| 41 | + } | ||
| 42 | + when "solaris2" | ||
| 43 | + if Omnibus.config.solaris_compiler == "studio" | ||
| 44 | + { | ||
| 45 | + "CFLAGS" => "-L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include", | ||
| 46 | + "LDFLAGS" => "-R#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include" | ||
| 47 | + } | ||
| 48 | + elsif Omnibus.config.solaris_compiler == "gcc" | ||
| 49 | + { | ||
| 50 | + "CFLAGS" => "-L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include -O3 -g -pipe", | ||
| 51 | + "LDFLAGS" => "-R#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include -static-libgcc", | ||
| 52 | + "LD_OPTIONS" => "-R#{install_dir}/embedded/lib" | ||
| 53 | + } | ||
| 54 | + else | ||
| 55 | + raise "Sorry, #{Omnibus.config.solaris_compiler} is not a valid compiler selection." | ||
| 56 | + end | ||
| 57 | + when "aix" | ||
| 58 | + { | ||
| 59 | + # see http://www.ibm.com/developerworks/aix/library/au-gnu.html | ||
| 60 | + # | ||
| 61 | + # specifically: | ||
| 62 | + # | ||
| 63 | + # "To use AIX run-time linking, you should create the shared object | ||
| 64 | + # using gcc -shared -Wl,-G and create executables using the library | ||
| 65 | + # by adding the -Wl,-brtl option to the link line. Technically, you | ||
| 66 | + # can leave off the -shared option, but it does no harm and reduces | ||
| 67 | + # confusion." | ||
| 68 | + # | ||
| 69 | + # AIX also uses -Wl,-blibpath instead of -R or LD_RUN_PATH, but the | ||
| 70 | + # option is not additive, so requires /usr/lib and /lib as well (there | ||
| 71 | + # is a -bsvr4 option to allow ld to take an -R flag in addition | ||
| 72 | + # to turning on -brtl, but it had other side effects I couldn't fix). | ||
| 73 | + # | ||
| 74 | + # If libraries linked with gcc -shared have symbol resolution failures | ||
| 75 | + # then it may be useful to add -bexpfull to export all symbols. | ||
| 76 | + # | ||
| 77 | + # -O2 optimized away some configure test which caused ext libs to fail | ||
| 78 | + # | ||
| 79 | + # We also need prezl's M4 instead of picking up /usr/bin/m4 which | ||
| 80 | + # barfs on ruby. | ||
| 81 | + # | ||
| 82 | + "CC" => "xlc -q64", | ||
| 83 | + "CXX" => "xlC -q64", | ||
| 84 | + "LD" => "ld -b64", | ||
| 85 | + "CFLAGS" => "-q64 -O -qhot -I#{install_dir}/embedded/include", | ||
| 86 | + "CXXFLAGS" => "-q64 -O -qhot -I#{install_dir}/embedded/include", | ||
| 87 | + "LDFLAGS" => "-q64 -L#{install_dir}/embedded/lib -Wl,-brtl -Wl,-blibpath:#{install_dir}/embedded/lib:/usr/lib:/lib", | ||
| 88 | + "OBJECT_MODE" => "64", | ||
| 89 | + "ARFLAGS" => "-X64 cru", | ||
| 90 | + "M4" => "/opt/freeware/bin/m4", | ||
| 91 | + "warnflags" => "-qinfo=por" | ||
| 92 | + } | ||
| 93 | + else | ||
| 94 | + { | ||
| 95 | + "CFLAGS" => "-I#{install_dir}/embedded/include -O3 -g -pipe", | ||
| 96 | + "LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib" | ||
| 97 | + } | ||
| 98 | + end | ||
| 99 | + | ||
| 100 | +build do | ||
| 101 | + configure_command = ["./configure", | ||
| 102 | + "--prefix=#{install_dir}/embedded", | ||
| 103 | + "--with-out-ext=fiddle", | ||
| 104 | + "--enable-shared", | ||
| 105 | + "--enable-libedit", | ||
| 106 | + "--with-ext=psych", | ||
| 107 | + "--disable-install-doc"] | ||
| 108 | + | ||
| 109 | + case platform | ||
| 110 | + when "aix" | ||
| 111 | + patch :source => "ruby-aix-configure.patch", :plevel => 1 | ||
| 112 | + patch :source => "ruby_aix_1_9_3_448_ssl_EAGAIN.patch", :plevel => 1 | ||
| 113 | + # --with-opt-dir causes ruby to send bogus commands to the AIX linker | ||
| 114 | + when "freebsd" | ||
| 115 | + configure_command << "--without-execinfo" | ||
| 116 | + configure_command << "--with-opt-dir=#{install_dir}/embedded" | ||
| 117 | + when "smartos" | ||
| 118 | + # Opscode patch - someara@opscode.com | ||
| 119 | + # GCC 4.7.0 chokes on mismatched function types between OpenSSL 1.0.1c and Ruby 1.9.3-p286 | ||
| 120 | + patch :source => "ruby-openssl-1.0.1c.patch", :plevel => 1 | ||
| 121 | + | ||
| 122 | + # Patches taken from RVM. | ||
| 123 | + # http://bugs.ruby-lang.org/issues/5384 | ||
| 124 | + # https://www.illumos.org/issues/1587 | ||
| 125 | + # https://github.com/wayneeseguin/rvm/issues/719 | ||
| 126 | + patch :source => "rvm-cflags.patch", :plevel => 1 | ||
| 127 | + | ||
| 128 | + # From RVM forum | ||
| 129 | + # https://github.com/wayneeseguin/rvm/commit/86766534fcc26f4582f23842a4d3789707ce6b96 | ||
| 130 | + configure_command << "ac_cv_func_dl_iterate_phdr=no" | ||
| 131 | + configure_command << "--with-opt-dir=#{install_dir}/embedded" | ||
| 132 | + else | ||
| 133 | + configure_command << "--with-opt-dir=#{install_dir}/embedded" | ||
| 134 | + end | ||
| 135 | + | ||
| 136 | + # @todo expose bundle_bust() in the DSL | ||
| 137 | + env.merge!({ | ||
| 138 | + "RUBYOPT" => nil, | ||
| 139 | + "BUNDLE_BIN_PATH" => nil, | ||
| 140 | + "BUNDLE_GEMFILE" => nil, | ||
| 141 | + "GEM_PATH" => nil, | ||
| 142 | + "GEM_HOME" => nil | ||
| 143 | + }) | ||
| 144 | + | ||
| 145 | + # @todo: move into omnibus-ruby | ||
| 146 | + has_gmake = system("gmake --version") | ||
| 147 | + | ||
| 148 | + if has_gmake | ||
| 149 | + env.merge!({'MAKE' => 'gmake'}) | ||
| 150 | + make_binary = 'gmake' | ||
| 151 | + else | ||
| 152 | + make_binary = 'make' | ||
| 153 | + end | ||
| 154 | + | ||
| 155 | + command configure_command.join(" "), :env => env | ||
| 156 | + command "#{make_binary} -j #{max_build_jobs}", :env => env | ||
| 157 | + command "#{make_binary} -j #{max_build_jobs} install", :env => env | ||
| 158 | +end |