Class: LibarchiveBinary::ZLibRecipe
- Inherits:
-
BaseRecipe
- Object
- MiniPortile
- BaseRecipe
- LibarchiveBinary::ZLibRecipe
show all
- Defined in:
- lib/ffi-libarchive-binary/zlib_recipe.rb
Constant Summary
collapse
- ROOT =
Pathname.new(File.expand_path("../..", __dir__))
Instance Method Summary
collapse
Methods inherited from BaseRecipe
#apple_arch_flag, #cflags, #ldflags, #message
Constructor Details
Returns a new instance of ZLibRecipe.
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 10
def initialize
super("zlib", "1.2.11")
@files << {
url: "http://zlib.net/fossils/zlib-1.2.11.tar.gz",
sha256: "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
}
@target = ROOT.join(@target).to_s
end
|
Instance Method Details
#checkpoint ⇒ Object
77
78
79
|
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 77
def checkpoint
File.join(@target, "#{name}-#{version}-#{host}.installed")
end
|
#compile ⇒ Object
61
62
63
64
65
66
67
|
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 61
def compile
if MiniPortile::windows?
execute("compile", "make -f win32/Makefile.gcc libz.a")
else
super
end
end
|
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 39
def configure
if MiniPortile::windows?
Dir.chdir(work_path) do
configure_windows
end
else
cmd = ["env", cflags(host), ldflags(host),
"./configure"] + computed_options
execute("configure", cmd)
end
end
|
21
22
23
24
25
|
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 21
def configure_defaults
[
"--static",
]
end
|
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 27
def configure_windows
mk = File.read("win32/Makefile.gcc")
File.open("win32/Makefile.gcc", "wb") do |f|
f.puts "BINARY_PATH = #{path}/bin"
f.puts "LIBRARY_PATH = #{path}/lib"
f.puts "INCLUDE_PATH = #{path}/include"
f.puts "SHARED_MODE = 0"
f.puts "LOC = -fPIC"
f.puts mk
end
end
|
51
52
53
54
55
56
57
58
59
|
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 51
def configured?
if MiniPortile::windows?
Dir.chdir(work_path) do
!!(File.read("win32/Makefile.gcc") =~ /^BINARY_PATH/)
end
else
super
end
end
|
#cook ⇒ Object
85
86
87
88
89
|
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 85
def cook
super
FileUtils.touch(checkpoint)
end
|
#cook_if_not ⇒ Object
81
82
83
|
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 81
def cook_if_not
cook unless File.exist?(checkpoint)
end
|
#install ⇒ Object
69
70
71
72
73
74
75
|
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 69
def install
if MiniPortile::windows?
execute("install", "make -f win32/Makefile.gcc install")
else
super
end
end
|