Sha256: d041dad3167563f85279be02a876264274e448aae19d61ea593ac000878951d7

Contents?: true

Size: 1.45 KB

Versions: 20

Compression:

Stored size: 1.45 KB

Contents

# frozen_string_literal: true

require "mini_portile2"

module LibarchiveBinary
  FORMATS = {
    "arm64-apple-darwin" => "Mach-O 64-bit dynamically linked shared library arm64",
    "x86_64-apple-darwin" => "Mach-O 64-bit dynamically linked shared library x86_64",
    "aarch64-linux-gnu" => "ELF 64-bit LSB shared object, ARM aarch64",
    "x86_64-linux-gnu" => "ELF 64-bit LSB shared object, x86-64",
    "x86_64-w64-mingw32" => "PE32+ executable",
  }.freeze

  ARCHS = {
    "arm64-apple-darwin" => "arm64",
    "x86_64-apple-darwin" => "x86_64",
  }.freeze

  LIBNAMES = {
    "x86_64-w64-mingw32" => "libarchive.dll",
    "x86_64-linux-gnu" => "libarchive.so",
    "aarch64-linux-gnu" => "libarchive.so",
    "x86_64-apple-darwin" => "libarchive.dylib",
    "arm64-apple-darwin" => "libarchive.dylib",
  }.freeze

  class BaseRecipe < MiniPortile
    def initialize(name, version)
      super
      @printed = {}
    end

    def apple_arch_flag(host)
      fl = ARCHS[host]
      fl.nil? ? "" : " -arch #{fl}"
    end

    def cflags(host)
      "CFLAGS=-fPIC#{apple_arch_flag(host)}"
    end

    def ldflags(host)
      "LDFLAGS=-fPIC#{apple_arch_flag(host)}"
    end

    def message(text)
      return super unless text.start_with?("\rDownloading")

      match = text.match(/(\rDownloading .*)\((\s*)(\d+)%\)/)
      pattern = match ? match[1] : text
      return if @printed[pattern] && match[3].to_i != 100

      @printed[pattern] = true
      super
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
ffi-libarchive-binary-0.3.4 lib/ffi-libarchive-binary/base_recipe.rb
ffi-libarchive-binary-0.3.4-x86_64-linux lib/ffi-libarchive-binary/base_recipe.rb
ffi-libarchive-binary-0.3.4-x86_64-darwin lib/ffi-libarchive-binary/base_recipe.rb
ffi-libarchive-binary-0.3.4-arm64-darwin lib/ffi-libarchive-binary/base_recipe.rb
ffi-libarchive-binary-0.3.4-aarch64-linux lib/ffi-libarchive-binary/base_recipe.rb
ffi-libarchive-binary-0.3.2 lib/ffi-libarchive-binary/base_recipe.rb
ffi-libarchive-binary-0.3.2-x86_64-linux lib/ffi-libarchive-binary/base_recipe.rb
ffi-libarchive-binary-0.3.2-x86_64-darwin lib/ffi-libarchive-binary/base_recipe.rb
ffi-libarchive-binary-0.3.2-arm64-darwin lib/ffi-libarchive-binary/base_recipe.rb
ffi-libarchive-binary-0.3.2-aarch64-linux lib/ffi-libarchive-binary/base_recipe.rb
ffi-libarchive-binary-0.3.2.rc1 lib/ffi-libarchive-binary/base_recipe.rb
ffi-libarchive-binary-0.3.2.rc1-x86_64-linux lib/ffi-libarchive-binary/base_recipe.rb
ffi-libarchive-binary-0.3.2.rc1-x86_64-darwin lib/ffi-libarchive-binary/base_recipe.rb
ffi-libarchive-binary-0.3.2.rc1-arm64-darwin lib/ffi-libarchive-binary/base_recipe.rb
ffi-libarchive-binary-0.3.2.rc1-aarch64-linux lib/ffi-libarchive-binary/base_recipe.rb
ffi-libarchive-binary-0.3.1 lib/ffi-libarchive-binary/base_recipe.rb
ffi-libarchive-binary-0.3.1-x86_64-linux lib/ffi-libarchive-binary/base_recipe.rb
ffi-libarchive-binary-0.3.1-x86_64-darwin lib/ffi-libarchive-binary/base_recipe.rb
ffi-libarchive-binary-0.3.1-arm64-darwin lib/ffi-libarchive-binary/base_recipe.rb
ffi-libarchive-binary-0.3.1-aarch64-linux lib/ffi-libarchive-binary/base_recipe.rb