Class: Gears::SWIG

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



23
24
25
26
27
28
29
30
31
# File 'lib/gears/swig.rb', line 23

def build()
  puts "Building SWIG in #{@build_path}"
  Dir.chdir(@build_path)
  `./autogen.sh`
  `./configure --prefix=#{@@install_path}`
  `make`
  @built = true
  true
end

#checkObject



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

def check()
  puts 'Checking for SWIG'
  if RUBY_PLATFORM.match(/darwin/)
    @checked = gear_exec_mac > 0 ? true : false
  else
    gear_exec 'swig -version'
    @checked = $?.exitstatus == 0 ? true : false
  end
  @checked
end

#installObject



33
34
35
36
37
38
39
40
# File 'lib/gears/swig.rb', line 33

def install()
  puts "Installing SWIG to #{@@install_path}"
  Dir.chdir(@build_path)
  `make install-main`
  `make install-lib`
  @installed = true
  true
end

#obtainObject



18
19
20
21
# File 'lib/gears/swig.rb', line 18

def obtain()
  puts 'Obtaining SWIG'
  github_obtain('swig', 'swig')
end

#uninstallObject



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

def uninstall()
  puts 'Uninstalling SWIG'
  FileUtils.rm_f("#{@@install_path}/bin/swig")
  FileUtils.rm_f("#{@@install_path}/bin/ccache-swig")
  FileUtils.rm_rf("#{@@install_path}/share/swig")
  FileUtils.rm_f("#{@@install_path}/share/man/man1/ccache-swig.1")
  @installed = false
  true
end