Class: LibarchiveBinary::BaseRecipe
- Inherits:
-
MiniPortile
- Object
- MiniPortile
- LibarchiveBinary::BaseRecipe
show all
- Defined in:
- lib/ffi-libarchive-binary/base_recipe.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of BaseRecipe.
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/ffi-libarchive-binary/base_recipe.rb', line 33
def initialize(name)
library = LibarchiveBinary.library_for(name)
version = library["version"]
super(name, version)
@target = ROOT.join(@target).to_s
@files << {
url: library["url"],
sha256: library["sha256"],
}
@printed = {}
end
|
Instance Method Details
#apple_arch_flag(host) ⇒ Object
45
46
47
48
|
# File 'lib/ffi-libarchive-binary/base_recipe.rb', line 45
def apple_arch_flag(host)
fl = ARCHS[host]
fl.nil? ? "" : " -arch #{fl}"
end
|
#cflags(host) ⇒ Object
50
51
52
|
# File 'lib/ffi-libarchive-binary/base_recipe.rb', line 50
def cflags(host)
"CFLAGS=-fPIC#{apple_arch_flag(host)}"
end
|
#cross_compiler_env(host) ⇒ Object
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/ffi-libarchive-binary/base_recipe.rb', line 58
def cross_compiler_env(host)
return {} unless host&.start_with?("aarch64-linux")
{
"CC" => "aarch64-linux-gnu-gcc",
"CXX" => "aarch64-linux-gnu-g++",
"AR" => "aarch64-linux-gnu-ar",
"RANLIB" => "aarch64-linux-gnu-ranlib",
"STRIP" => "aarch64-linux-gnu-strip",
}
end
|
#ldflags(host) ⇒ Object
54
55
56
|
# File 'lib/ffi-libarchive-binary/base_recipe.rb', line 54
def ldflags(host)
"LDFLAGS=-fPIC#{apple_arch_flag(host)}"
end
|
#message(text) ⇒ Object
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/ffi-libarchive-binary/base_recipe.rb', line 76
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
|