Sha256: 4fb5950968febb8db9f5d5d20ca24f37219e9cf9c291f817979019ceccdab7be

Contents?: true

Size: 1.17 KB

Versions: 5

Compression:

Stored size: 1.17 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
    def initialize
      super("openssl")
    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

5 entries across 5 versions & 1 rubygems

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