Commit fb0e82c6 authored by Kazuhiro NISHIYAMA's avatar Kazuhiro NISHIYAMA Committed by Benoit Daloze
Browse files

Install openssl 1 when openssl is 3

parent c520cac8
Loading
Loading
Loading
Loading
+39 −3
Original line number Diff line number Diff line
@@ -1090,6 +1090,15 @@ has_broken_mac_openssl() {
  [[ "$RUBY_CONFIGURE_OPTS" != *--with-openssl-dir=* ]]
}

needs_openssl() {
  [[ "$RUBY_CONFIGURE_OPTS" != *--with-openssl-dir=* ]] &&
  {
    openssl version 2>/dev/null ||
    printf '#include <openssl/opensslv.h>\nOPENSSL_VERSION_TEXT\n' | cc -xc -E - 2>/dev/null
  } | grep -q "OpenSSL 3" ||
  has_broken_mac_openssl
}

use_homebrew_openssl() {
  local ssldir="$(brew --prefix openssl@1.1 2>/dev/null || true)"
  if [ -d "$ssldir" ]; then
@@ -1102,6 +1111,10 @@ use_homebrew_openssl() {
}

build_package_mac_openssl() {
  build_package_openssl
}

build_package_openssl() {
  # Install to a subdirectory since we don't want shims for bin/openssl.
  OPENSSL_PREFIX_PATH="${PREFIX_PATH}/openssl"

@@ -1136,10 +1149,33 @@ build_package_mac_openssl() {
    MAKE_INSTALL_TARGET="install_sw install_ssldirs" build_package_standard "$@"
  fi

  # Extract root certs from the system keychain in .pem format and rehash.
  local pem_file="$OPENSSLDIR/cert.pem"
  if is_mac; then
    # Extract root certs from the system keychain in .pem format.
    security find-certificate -a -p /Library/Keychains/System.keychain > "$pem_file"
    security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain >> "$pem_file"
  elif [ -e /etc/pki/tls/cert.pem ]; then # RedHat
    # See https://github.com/rubygems/rubygems/issues/2415#issuecomment-509806259
    rm -rf "$OPENSSLDIR/certs" "$pem_file"
    ln -s /etc/pki/tls/certs "$OPENSSLDIR/certs"
    ln -s /etc/pki/tls/cert.pem "$pem_file"
  elif [ -e /etc/ssl/certs/ca-certificates.crt ]; then # Debian
    # See https://github.com/rubygems/rubygems/issues/2415#issuecomment-509806259
    rm -rf "$OPENSSLDIR/certs" "$pem_file"
    ln -s /etc/ssl/certs "$OPENSSLDIR/certs"
    ln -s /etc/ssl/certs/ca-certificates.crt "$pem_file"
  elif type -p openssl >/dev/null; then
    # symlink to the system openssl certs
    local SYSTEM_OPENSSLDIR
    SYSTEM_OPENSSLDIR=$(openssl version -d 2>/dev/null | cut -d'"' -f2)
    if [ -n "$SYSTEM_OPENSSLDIR" ]; then
      ln -sf "$SYSTEM_OPENSSLDIR/cert.pem" "$OPENSSLDIR/cert.pem"
      ln -snf "$SYSTEM_OPENSSLDIR/certs" "$OPENSSLDIR/certs"
    fi
  else
    echo "Could not find OpenSSL certificates" >&2
    exit 1
  fi
}

# Post-install check that the openssl extension was built.
+1 −1
Original line number Diff line number Diff line
@@ -18,6 +18,6 @@ url="https://cache.ruby-lang.org/pub/ruby/${major_minor_version}/${basename}"
sha256=$(sha256sum "$release_directory/$basename" | cut -d ' ' -f 1)

cat > "$file" <<EOS
install_package "openssl-1.1.1q" "https://www.openssl.org/source/openssl-1.1.1q.tar.gz#d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca" mac_openssl --if has_broken_mac_openssl
install_package "openssl-1.1.1q" "https://www.openssl.org/source/openssl-1.1.1q.tar.gz#d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca" openssl --if has_broken_mac_openssl
install_package "ruby-${version}" "${url}#${sha256}" ldflags_dirs enable_shared standard verify_openssl
EOS
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ URI.open(file).each do |package|

  definition = <<-TEMPLATE
require_llvm 3.7
install_package "openssl-1.0.2o" "https://www.openssl.org/source/openssl-1.0.2o.tar.gz#ec3f5c9714ba0fd45cb4e087301eb1336c317e0d20b575a125050470e8089e4d" mac_openssl --if has_broken_mac_openssl
install_package "openssl-1.0.2o" "https://www.openssl.org/source/openssl-1.0.2o.tar.gz#ec3f5c9714ba0fd45cb4e087301eb1336c317e0d20b575a125050470e8089e4d" openssl --if needs_openssl
install_package "rubinius-#{version}" "#{package_url}##{sha256}" rbx
  TEMPLATE

+1 −1
Original line number Diff line number Diff line
install_package "openssl-1.0.2u" "https://www.openssl.org/source/openssl-1.0.2u.tar.gz#ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16" mac_openssl --if has_broken_mac_openssl
install_package "openssl-1.0.2u" "https://www.openssl.org/source/openssl-1.0.2u.tar.gz#ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16" openssl --if needs_openssl
install_package "yaml-0.1.6" "http://pyyaml.org/download/libyaml/yaml-0.1.6.tar.gz#7da6971b4bd08a986dd2a61353bc422362bd0edcc67d7ebaac68c95f74182749" --if needs_yaml
install_git "ruby-1.9.3-dev" "https://github.com/ruby/ruby.git" "ruby_1_9_3" warn_eol autoconf standard
+1 −1
Original line number Diff line number Diff line
require_gcc
install_package "openssl-1.0.2u" "https://www.openssl.org/source/openssl-1.0.2u.tar.gz#ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16" mac_openssl --if has_broken_mac_openssl
install_package "openssl-1.0.2u" "https://www.openssl.org/source/openssl-1.0.2u.tar.gz#ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16" openssl --if needs_openssl
install_package "yaml-0.1.6" "http://pyyaml.org/download/libyaml/yaml-0.1.6.tar.gz#7da6971b4bd08a986dd2a61353bc422362bd0edcc67d7ebaac68c95f74182749" --if needs_yaml
install_package "ruby-1.9.3-p0" "https://cache.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.bz2#ca8ba4e564fc5f98b210a5784e43dfffef9471222849e46f8e848b37e9f38acf" warn_eol standard
install_package "rubygems-1.8.23" "https://rubygems.org/rubygems/rubygems-1.8.23.tgz#e4a1c6bbaac411eaab94deae78228b7584033a1f10a022f52bffa9613aa29061" ruby
Loading