Class: Gears::Boost

Inherits:
Gear
  • Object
show all
Defined in:
lib/gears/boost.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



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/gears/boost.rb', line 31

def build()
  puts "Building Boost in #{@build_path}"
  Dir.chdir(@build_path)
  puts '...boostrapping'
  `./bootstrap.sh --without-libraries=python --prefix=#{@@install_path}`
  puts '...compiling headers'
  `./b2 headers`
  puts '...building'
  `./b2`
  @built = true
  return true
end

#checkObject



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

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

#installObject



44
45
46
47
48
49
50
# File 'lib/gears/boost.rb', line 44

def install()
  puts "Installing Boost to #{@@install_path}"
  Dir.chdir(@build_path)
  `./b2 install --prefix=#{@@install_path}`
  @installed = true
  true
end

#obtainObject



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/gears/boost.rb', line 18

def obtain()
  puts 'Obtaining Boost'
  # github_obtain('boostorg', 'boost')
  Dir.chdir(_root_path + '/build')
  return true if Dir.exist? 'Boost'

  `wget http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.zip`
  `unzip boost_1_59_0.zip`
  `mv boost_1_59_0 Boost`
  FileUtils.rm('boost_1_59_0.zip')
  true
end

#uninstallObject



52
53
54
55
56
57
# File 'lib/gears/boost.rb', line 52

def uninstall()
  FileUtils.rm_f(Dir.glob("#{@@install_path}/lib/libboost.*"))
  FileUtils.rm_rf("#{@@install_path}/include/boost")
  @installed = false
  true
end