Class: Gears::LibArchive

Inherits:
Gear
  • Object
show all
Defined in:
lib/gears/libarchive.rb

Instance Attribute Summary

Attributes inherited from Gear

#build_path, #built, #checked, #headers, #installed, #libs, #obtained

Instance Method Summary collapse

Methods inherited from Gear

#disengage, #engage, #gear_exec, #gear_exec_mac, #git_obtain, #github_obtain, #initialize, initialized?, install_path, #name, #remove, #std_config_make, #std_make_install, #target

Constructor Details

This class inherits a constructor from Gear

Instance Method Details

#buildObject



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/gears/libarchive.rb', line 28

def build()
  puts "Building libarchive in #{@build_path}"
  # TODO: fix build error
  Dir.chdir(@build_path)
  # `git checkout release`
  # `sh build/autogen.sh`
  puts '...configuring'
  `./configure --prefix=#{@@install_path} --without-lzo2 --without-nettle --without-xml2`
  puts '...making'
  `make`
  @built = true
  true
end

#checkObject



7
8
9
10
11
12
13
14
15
16
# File 'lib/gears/libarchive.rb', line 7

def check()
  puts 'Checking for libarchive'
  if RUBY_PLATFORM.match(/darwin/)
    @checked = gear_exec_mac > 0 ? true : false
  else
    gear_exec 'ldconfig -p | grep libarchive'
    @checked = $?.exitstatus == 0 ? true : false
  end
  @checked
end

#installObject



42
43
44
# File 'lib/gears/libarchive.rb', line 42

def install()
  std_make_install
end

#obtainObject



18
19
20
21
22
23
24
25
26
# File 'lib/gears/libarchive.rb', line 18

def obtain()
  puts 'Obtaining libarchive'
  # github_obtain('libarchive', 'libarchive', 'release')
  return true if File.exist? 'libarchive'
  Dir.chdir(_root_path + '/build')
  `wget http://www.libarchive.org/downloads/libarchive-3.1.2.zip`
  `unzip libarchive-3.1.2.zip`
  `mv libarchive-3.1.2 libarchive`
end

#uninstallObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/gears/libarchive.rb', line 46

def uninstall()
  FileUtils.rm_f("#{@@install_path}/bin/bsdcat")
  FileUtils.rm_f("#{@@install_path}/bin/bsdcpio")
  FileUtils.rm_f("#{@@install_path}/bin/bsdtar")
  FileUtils.rm_f("#{@@install_path}/include/archive_entry.h")
  FileUtils.rm_f("#{@@install_path}/include/archive.h")
  FileUtils.rm_f(Dir.glob("#{@@install_path}/lib/libarchive.*"))
  FileUtils.rm_rf("#{@@install_path}/lib/pkgconfig")
  FileUtils.rm_f("#{@@install_path}/share/man/man1/bsdcat.1")
  FileUtils.rm_f("#{@@install_path}/share/man/man1/bsdcpio.1")
  FileUtils.rm_f("#{@@install_path}/share/man/man1/bsdtar.1")
  FileUtils.rm_rf("#{@@install_path}/share/man/man3")
  FileUtils.rm_rf("#{@@install_path}/share/man/man5")
  @installed = false
  true
end