Sha256: 7c6903b8fa87513848eaab5067275f8bb142f143ab37b807d445a1ff768e81bd

Contents?: true

Size: 1.46 KB

Versions: 15

Compression:

Stored size: 1.46 KB

Contents

# frozen_string_literal: true

require_relative "base_recipe"

module LibarchiveBinary
  OS_COMPILERS = {
    "arm64-apple-darwin" => "darwin64-arm64-cc",
    "x86_64-apple-darwin" => "darwin64-x86_64-cc",
    "aarch64-linux-gnu" => nil,
    "x86_64-linux-gnu" => nil,
    "x86_64-w64-mingw32" => "mingw64",
  }.freeze

  ENV_CMD = ["env", "CFLAGS=-fPIC", "LDFLAGS=-fPIC"].freeze

  class OpensslRecipe < BaseRecipe
    ROOT = Pathname.new(File.expand_path("../..", __dir__))

    def initialize
      super("openssl", "1.1.1n")

      @files << {
        url: "https://www.openssl.org/source/openssl-1.1.1n.tar.gz",
        sha256: "40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a",
      }

      @target = ROOT.join(@target).to_s
    end

    def configure
      os_compiler = OS_COMPILERS[@host]
      common_opts = ["--openssldir=#{ROOT}/ports/SSL", "no-tests", "no-shared"] +
        computed_options.grep(/--prefix/)
      cmd = if os_compiler.nil?
              message("OpensslRecipe: guessing with 'config' for '#{@host}'\n")
              ENV_CMD + ["./config"] + common_opts
            else
              ENV_CMD + ["./Configure"] + common_opts + [os_compiler]
            end
      execute("configure", cmd)
    end

    def checkpoint
      File.join(@target, "#{name}-#{version}-#{host}.installed")
    end

    def cook_if_not
      cook unless File.exist?(checkpoint)
    end

    def cook
      super

      FileUtils.touch(checkpoint)
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ffi-libarchive-binary-0.3.2 lib/ffi-libarchive-binary/openssl_recipe.rb
ffi-libarchive-binary-0.3.2-x86_64-linux lib/ffi-libarchive-binary/openssl_recipe.rb
ffi-libarchive-binary-0.3.2-x86_64-darwin lib/ffi-libarchive-binary/openssl_recipe.rb
ffi-libarchive-binary-0.3.2-arm64-darwin lib/ffi-libarchive-binary/openssl_recipe.rb
ffi-libarchive-binary-0.3.2-aarch64-linux lib/ffi-libarchive-binary/openssl_recipe.rb
ffi-libarchive-binary-0.3.2.rc1 lib/ffi-libarchive-binary/openssl_recipe.rb
ffi-libarchive-binary-0.3.2.rc1-x86_64-linux lib/ffi-libarchive-binary/openssl_recipe.rb
ffi-libarchive-binary-0.3.2.rc1-x86_64-darwin lib/ffi-libarchive-binary/openssl_recipe.rb
ffi-libarchive-binary-0.3.2.rc1-arm64-darwin lib/ffi-libarchive-binary/openssl_recipe.rb
ffi-libarchive-binary-0.3.2.rc1-aarch64-linux lib/ffi-libarchive-binary/openssl_recipe.rb
ffi-libarchive-binary-0.3.0 lib/ffi-libarchive-binary/openssl_recipe.rb
ffi-libarchive-binary-0.3.0-x86_64-linux lib/ffi-libarchive-binary/openssl_recipe.rb
ffi-libarchive-binary-0.3.0-x86_64-darwin lib/ffi-libarchive-binary/openssl_recipe.rb
ffi-libarchive-binary-0.3.0-arm64-darwin lib/ffi-libarchive-binary/openssl_recipe.rb
ffi-libarchive-binary-0.3.0-aarch64-linux lib/ffi-libarchive-binary/openssl_recipe.rb