Class: LibarchiveBinary::BaseRecipe

Inherits:
MiniPortile
  • Object
show all
Defined in:
lib/ffi-libarchive-binary/base_recipe.rb

Direct Known Subclasses

LibexpatRecipe, OpensslRecipe, XZRecipe, ZLibRecipe

Instance Method Summary collapse

Constructor Details

#initialize(name, version) ⇒ BaseRecipe

Returns a new instance of BaseRecipe.



28
29
30
31
# File 'lib/ffi-libarchive-binary/base_recipe.rb', line 28

def initialize(name, version)
  super
  @printed = {}
end

Instance Method Details

#apple_arch_flag(host) ⇒ Object



33
34
35
36
# File 'lib/ffi-libarchive-binary/base_recipe.rb', line 33

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

#cflags(host) ⇒ Object



38
39
40
# File 'lib/ffi-libarchive-binary/base_recipe.rb', line 38

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

#ldflags(host) ⇒ Object



42
43
44
# File 'lib/ffi-libarchive-binary/base_recipe.rb', line 42

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

#message(text) ⇒ Object



46
47
48
49
50
51
52
53
54
55
# File 'lib/ffi-libarchive-binary/base_recipe.rb', line 46

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