Class: LibarchiveBinary::ZLibRecipe
- Inherits:
-
BaseRecipe
- Object
- MiniPortile
- BaseRecipe
- LibarchiveBinary::ZLibRecipe
show all
- Defined in:
- lib/ffi-libarchive-binary/zlib_recipe.rb
Instance Method Summary
collapse
Methods inherited from BaseRecipe
#apple_arch_flag, #cflags, #cross_compiler_env, #ldflags, #message
Constructor Details
Returns a new instance of ZLibRecipe.
8
9
10
|
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 8
def initialize
super("zlib")
end
|
Instance Method Details
#checkpoint ⇒ Object
70
71
72
|
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 70
def checkpoint
File.join(@target, "#{name}-#{version}-#{host}.installed")
end
|
#compile ⇒ Object
54
55
56
57
58
59
60
|
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 54
def compile
if MiniPortile::windows?
execute("compile", "make -f win32/Makefile.gcc libz.a")
else
super
end
end
|
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 30
def configure
if MiniPortile::windows?
Dir.chdir(work_path) do
configure_windows
end
else
env_vars = cross_compiler_env(host)
cmd = ["env"] + env_vars.map { |k, v| "#{k}=#{v}" } +
[cflags(host), ldflags(host), "./configure"] + computed_options
execute("configure", cmd)
end
end
|
12
13
14
15
16
|
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 12
def configure_defaults
[
"--static",
]
end
|
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 18
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
|
44
45
46
47
48
49
50
51
52
|
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 44
def configured?
if MiniPortile::windows?
Dir.chdir(work_path) do
!!(File.read("win32/Makefile.gcc") =~ /^BINARY_PATH/)
end
else
super
end
end
|
#cook ⇒ Object
78
79
80
81
82
|
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 78
def cook
super
FileUtils.touch(checkpoint)
end
|
#cook_if_not ⇒ Object
74
75
76
|
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 74
def cook_if_not
cook unless File.exist?(checkpoint)
end
|
#install ⇒ Object
62
63
64
65
66
67
68
|
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 62
def install
if MiniPortile::windows?
execute("install", "make -f win32/Makefile.gcc install")
else
super
end
end
|