Commit 2d99c10ccf57a8ad6cd6701a0c79184303900b83

Authored by Jacob Vosmaer
1 parent b855ab5e

Vendor openssl from omnibus-software

Source:
https://github.com/opscode/omnibus-software/blob/3d9d097332199fdafc3237c0ec11fcd784c11b4d/config/software/openssl.rb
Showing 1 changed file with 154 additions and 0 deletions   Show diff stats
config/software/openssl.rb 0 → 100644
... ... @@ -0,0 +1,154 @@
  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 "openssl"
  19 +
  20 +dependency "zlib"
  21 +dependency "cacerts"
  22 +dependency "libgcc"
  23 +
  24 +
  25 +if platform == "aix"
  26 + # XXX: OpenSSL has an open bug on 1.0.1e where it fails to install on AIX
  27 + # http://rt.openssl.org/Ticket/Display.html?id=2986&user=guest&pass=guest
  28 + version "1.0.1c"
  29 + source :url => "http://www.openssl.org/source/openssl-1.0.1c.tar.gz",
  30 + :md5 => "ae412727c8c15b67880aef7bd2999b2e"
  31 +else
  32 + version "1.0.1f"
  33 + source :url => "http://www.openssl.org/source/openssl-1.0.1f.tar.gz",
  34 + :md5 => "f26b09c028a0541cab33da697d522b25"
  35 +end
  36 +
  37 +relative_path "openssl-#{version}"
  38 +
  39 +build do
  40 + patch :source => "openssl-1.0.1f-do-not-build-docs.patch"
  41 +
  42 + env = case platform
  43 + when "mac_os_x"
  44 + {
  45 + "CFLAGS" => "-arch x86_64 -m64 -L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include -I#{install_dir}/embedded/include/ncurses",
  46 + "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"
  47 + }
  48 + when "aix"
  49 + {
  50 + "CC" => "xlc -q64",
  51 + "CXX" => "xlC -q64",
  52 + "LD" => "ld -b64",
  53 + "CFLAGS" => "-q64 -I#{install_dir}/embedded/include -O",
  54 + "CXXFLAGS" => "-q64 -I#{install_dir}/embedded/include -O",
  55 + "LDFLAGS" => "-q64 -L#{install_dir}/embedded/lib -Wl,-blibpath:#{install_dir}/embedded/lib:/usr/lib:/lib",
  56 + "OBJECT_MODE" => "64",
  57 + "AR" => "/usr/bin/ar",
  58 + "ARFLAGS" => "-X64 cru",
  59 + "M4" => "/opt/freeware/bin/m4",
  60 + }
  61 + when "solaris2"
  62 + {
  63 + "CFLAGS" => "-L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include",
  64 + "LDFLAGS" => "-R#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include -static-libgcc",
  65 + "LD_OPTIONS" => "-R#{install_dir}/embedded/lib"
  66 + }
  67 + else
  68 + {
  69 + "CFLAGS" => "-I#{install_dir}/embedded/include",
  70 + "LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib"
  71 + }
  72 + end
  73 +
  74 + common_args = [
  75 + "--prefix=#{install_dir}/embedded",
  76 + "--with-zlib-lib=#{install_dir}/embedded/lib",
  77 + "--with-zlib-include=#{install_dir}/embedded/include",
  78 + "no-idea",
  79 + "no-mdc2",
  80 + "no-rc5",
  81 + "zlib",
  82 + "shared",
  83 + ].join(" ")
  84 +
  85 + configure_command = case platform
  86 + when "aix"
  87 + ["perl", "./Configure",
  88 + "aix64-cc",
  89 + common_args,
  90 + "-L#{install_dir}/embedded/lib",
  91 + "-I#{install_dir}/embedded/include",
  92 + "-Wl,-blibpath:#{install_dir}/embedded/lib:/usr/lib:/lib"].join(" ")
  93 + when "mac_os_x"
  94 + ["./Configure",
  95 + "darwin64-x86_64-cc",
  96 + common_args,
  97 + ].join(" ")
  98 + when "smartos"
  99 + ["/bin/bash ./Configure",
  100 + "solaris64-x86_64-gcc",
  101 + common_args,
  102 + "-L#{install_dir}/embedded/lib",
  103 + "-I#{install_dir}/embedded/include",
  104 + "-R#{install_dir}/embedded/lib",
  105 + "-static-libgcc"].join(" ")
  106 + when "solaris2"
  107 + if Omnibus.config.solaris_compiler == "gcc"
  108 + if architecture == "sparc"
  109 + ["/bin/sh ./Configure",
  110 + "solaris-sparcv9-gcc",
  111 + common_args,
  112 + "-L#{install_dir}/embedded/lib",
  113 + "-I#{install_dir}/embedded/include",
  114 + "-R#{install_dir}/embedded/lib",
  115 + "-static-libgcc"].join(" ")
  116 + else
  117 + # This should not require a /bin/sh, but without it we get
  118 + # Errno::ENOEXEC: Exec format error
  119 + ["/bin/sh ./Configure",
  120 + "solaris-x86-gcc",
  121 + common_args,
  122 + "-L#{install_dir}/embedded/lib",
  123 + "-I#{install_dir}/embedded/include",
  124 + "-R#{install_dir}/embedded/lib",
  125 + "-static-libgcc"].join(" ")
  126 + end
  127 + else
  128 + raise "sorry, we don't support building openssl on non-gcc solaris builds right now."
  129 + end
  130 + else
  131 + ["./config",
  132 + common_args,
  133 + "disable-gost", # fixes build on linux, but breaks solaris
  134 + "-L#{install_dir}/embedded/lib",
  135 + "-I#{install_dir}/embedded/include",
  136 + "-Wl,-rpath,#{install_dir}/embedded/lib"].join(" ")
  137 + end
  138 +
  139 + # @todo: move into omnibus-ruby
  140 + has_gmake = system("gmake --version")
  141 +
  142 + if has_gmake
  143 + env.merge!({'MAKE' => 'gmake'})
  144 + make_binary = 'gmake'
  145 + else
  146 + make_binary = 'make'
  147 + end
  148 +
  149 + command configure_command, :env => env
  150 + command "#{make_binary} depend", :env => env
  151 + # make -j N on openssl is not reliable
  152 + command "#{make_binary}", :env => env
  153 + command "#{make_binary} install", :env => env
  154 +end
... ...