Class: LibarchiveBinary::ZLibRecipe

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

Instance Method Summary collapse

Methods inherited from BaseRecipe

#apple_arch_flag, #cflags, #ldflags, #message

Constructor Details

#initializeZLibRecipe

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

#checkpointObject



68
69
70
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 68

def checkpoint
  File.join(@target, "#{name}-#{version}-#{host}.installed")
end

#compileObject



52
53
54
55
56
57
58
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 52

def compile
  if MiniPortile::windows?
    execute("compile", "make -f win32/Makefile.gcc libz.a")
  else
    super
  end
end

#configureObject



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 30

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

#configure_defaultsObject



12
13
14
15
16
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 12

def configure_defaults
  [
    "--static",
  ]
end

#configure_windowsObject



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

#configured?Boolean

Returns:

  • (Boolean)


42
43
44
45
46
47
48
49
50
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 42

def configured?
  if MiniPortile::windows?
    Dir.chdir(work_path) do
      !!(File.read("win32/Makefile.gcc") =~ /^BINARY_PATH/)
    end
  else
    super
  end
end

#cookObject



76
77
78
79
80
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 76

def cook
  super

  FileUtils.touch(checkpoint)
end

#cook_if_notObject



72
73
74
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 72

def cook_if_not
  cook unless File.exist?(checkpoint)
end

#installObject



60
61
62
63
64
65
66
# File 'lib/ffi-libarchive-binary/zlib_recipe.rb', line 60

def install
  if MiniPortile::windows?
    execute("install", "make -f win32/Makefile.gcc install")
  else
    super
  end
end