forked from adestefan/homebrew-headonly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sigar.rb
68 lines (55 loc) · 1.93 KB
/
sigar.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
require 'formula'
class Sigar < Formula
# HEAD has up to date bindings that are actually useful.
head 'https://github.com/hyperic/sigar.git'
homepage 'http://sigar.hyperic.com/'
option "perl", "Build Perl bindings"
option "python", "Build Python bindings"
option "ruby", "Build Ruby bindings"
def java_script; <<-EOS.undent
#!/bin/sh
# Runs SIGAR's REPL.
java -jar #{prefix}/sigar.jar
EOS
end
def install
# Build Java JAR & C library first.
cd "bindings/java" do
system "ant"
cd "sigar-bin/lib" do
prefix.install 'sigar.jar'
lib.install Dir['*.dylib']
end
include.install Dir['sigar-bin/include/*']
(bin/'sigar').write java_script
end
# Install Python bindings
cd "bindings/python" do
system "python", "setup.py", "install", "--prefix=#{prefix}"
end if build.include? "python"
# Install Perl bindings
cd "bindings/perl" do
system "perl", "Makefile.PL"
# Tweak the Makefile to install.
# Can't pass PREFIX, as the Sigar build system uses ARGV[0]
inreplace "Makefile" do |s|
s.change_make_var! 'PREFIX', prefix
s.change_make_var! 'PERLPREFIX', '$(PREFIX)'
s.change_make_var! 'SITEPREFIX', '$(PREFIX)'
s.change_make_var! 'VENDORPREFIX', '$(PREFIX)'
s.change_make_var! 'INSTALLPRIVLIB', "$(PERLPREFIX)\\1"
s.change_make_var! 'INSTALLSITELIB', "$(PERLPREFIX)\\1"
s.change_make_var! 'INSTALLVENDORLIB', "$(PERLPREFIX)\\1"
s.change_make_var! 'INSTALLARCHLIB', "$(PERLPREFIX)\\1"
s.change_make_var! 'INSTALLSITEARCH', "$(PERLPREFIX)\\1"
s.change_make_var! 'INSTALLVENDORARCH', "$(PERLPREFIX)\\1"
end
system "make install"
end if build.include? "perl"
# Install Ruby bindings
cd "bindings/ruby" do
system "ruby", "extconf.rb", "--prefix=#{prefix}"
system "make install"
end if build.include? "ruby"
end
end