sigar-test 0.7.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +201 -0
  3. data/NOTICE +117 -0
  4. data/README +2 -0
  5. data/Rakefile +105 -0
  6. data/bindings/SigarBuild.pm +301 -0
  7. data/bindings/SigarWrapper.pm +3025 -0
  8. data/bindings/ruby/extconf.rb +131 -0
  9. data/bindings/ruby/rbsigar.c +888 -0
  10. data/include/sigar.h +984 -0
  11. data/include/sigar_fileinfo.h +157 -0
  12. data/include/sigar_format.h +65 -0
  13. data/include/sigar_getline.h +18 -0
  14. data/include/sigar_log.h +80 -0
  15. data/include/sigar_private.h +429 -0
  16. data/include/sigar_ptql.h +53 -0
  17. data/include/sigar_util.h +197 -0
  18. data/src/os/aix/aix_sigar.c +2168 -0
  19. data/src/os/aix/sigar_os.h +73 -0
  20. data/src/os/darwin/Info.plist.in +27 -0
  21. data/src/os/darwin/darwin_sigar.c +3718 -0
  22. data/src/os/darwin/sigar_os.h +80 -0
  23. data/src/os/hpux/hpux_sigar.c +1361 -0
  24. data/src/os/hpux/sigar_os.h +49 -0
  25. data/src/os/linux/linux_sigar.c +2810 -0
  26. data/src/os/linux/sigar_os.h +82 -0
  27. data/src/os/solaris/get_mib2.c +321 -0
  28. data/src/os/solaris/get_mib2.h +127 -0
  29. data/src/os/solaris/kstats.c +181 -0
  30. data/src/os/solaris/procfs.c +97 -0
  31. data/src/os/solaris/sigar_os.h +224 -0
  32. data/src/os/solaris/solaris_sigar.c +2732 -0
  33. data/src/os/win32/peb.c +212 -0
  34. data/src/os/win32/sigar.rc.in +40 -0
  35. data/src/os/win32/sigar_os.h +685 -0
  36. data/src/os/win32/sigar_pdh.h +47 -0
  37. data/src/os/win32/win32_sigar.c +4109 -0
  38. data/src/sigar.c +2444 -0
  39. data/src/sigar_cache.c +253 -0
  40. data/src/sigar_fileinfo.c +815 -0
  41. data/src/sigar_format.c +696 -0
  42. data/src/sigar_getline.c +1849 -0
  43. data/src/sigar_ptql.c +1976 -0
  44. data/src/sigar_signal.c +216 -0
  45. data/src/sigar_util.c +1060 -0
  46. data/src/sigar_version.c.in +22 -0
  47. data/src/sigar_version_autoconf.c.in +22 -0
  48. data/version.properties +11 -0
  49. metadata +91 -0
@@ -0,0 +1,131 @@
1
+ #
2
+ # Copyright (c) 2007, 2009 Hyperic, Inc.
3
+ # Copyright (c) 2009 SpringSource, Inc.
4
+ # Copyright (c) 2010-2012 VMware, Inc.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'mkmf'
20
+ require 'rbconfig'
21
+
22
+ extension_name = 'sigar'
23
+
24
+ print 'Ruby platform=' + RUBY_PLATFORM + "\n"
25
+
26
+ case RUBY_PLATFORM
27
+ when /darwin/
28
+ os = 'darwin'
29
+ if File.file?("/usr/include/libproc.h")
30
+ $CPPFLAGS += ' -DDARWIN_HAS_LIBPROC_H'
31
+ end
32
+ $CPPFLAGS += ' -DDARWIN'
33
+ $LDFLAGS += ' -framework CoreServices -framework IOKit'
34
+ when /bsd/
35
+ os = 'darwin'
36
+ have_library("kvm")
37
+ when /mswin|mingw|cygwin|bccwin/
38
+ os = 'win32'
39
+ require 'ftools'
40
+ $CPPFLAGS += ' -DWIN32'
41
+ is_win32 = true
42
+ have_library("kernel32")
43
+ have_library("user32")
44
+ have_library("advapi32")
45
+ have_library("ws2_32")
46
+ have_library("netapi32")
47
+ have_library("shell32")
48
+ have_library("pdh")
49
+ have_library("version")
50
+ when /linux/
51
+ os = 'linux'
52
+ when /solaris|sun/
53
+ os = 'solaris'
54
+ have_library("nsl")
55
+ have_library("socket")
56
+ have_library("kstat")
57
+ when /hpux/
58
+ os = 'hpux'
59
+ #XXX have_libary no workie on hpux?
60
+ $LDFLAGS += ' -lnsl -lnm'
61
+ when /aix/
62
+ os = 'aix'
63
+ have_library("odm")
64
+ have_library("cfg")
65
+ have_library("perfstat")
66
+ else
67
+ os = RUBY_PLATFORM
68
+ end
69
+
70
+ osdir = "../../src/os/#{os}"
71
+ $CPPFLAGS += ' -I../../include' + ' -I' + osdir
72
+ $CPPFLAGS += ' -U_FILE_OFFSET_BITS' unless is_win32
73
+
74
+ if RUBY_VERSION > '1.8.4'
75
+ $CPPFLAGS += ' -DRB_HAS_RE_ERROR'
76
+ end
77
+ if RUBY_VERSION >= '1.9.0'
78
+ $CPPFLAGS += ' -DRB_RUBY_19'
79
+ end
80
+
81
+ #incase of nfs shared dir...
82
+ unless is_win32
83
+ if File.exist?('Makefile')
84
+ cmd = 'make distclean'
85
+ print cmd + "\n"
86
+ system(cmd)
87
+ end
88
+ Dir["./*.c"].each do |file|
89
+ if File.lstat(file).symlink?
90
+ print "unlink #{file}\n"
91
+ File.delete(file)
92
+ end
93
+ end
94
+ end
95
+
96
+ $distcleanfiles = ['rbsigar_generated.rx','sigar_version.c']
97
+
98
+ system('perl -Mlib=.. -MSigarWrapper -e generate Ruby .')
99
+ libname = extension_name + '.' + CONFIG['DLEXT']
100
+ filters =
101
+ 'ARCHNAME=' + RUBY_PLATFORM + ' ' +
102
+ 'ARCHLIB=' + libname + ' ' +
103
+ 'BINNAME=' + libname
104
+
105
+ system('perl -Mlib=.. -MSigarBuild -e version_file ' + filters)
106
+
107
+ if is_win32
108
+ system('perl -Mlib=.. -MSigarBuild -e resource_file ' + filters)
109
+ system('rc /r sigar.rc')
110
+ $LDFLAGS += ' sigar.res'
111
+ $distcleanfiles << ['sigar.rc', 'sigar.res']
112
+ #do not want dynamic runtime else "MSVCR80.dll was not found"
113
+ $CFLAGS = $CFLAGS.gsub('-MD', '')
114
+ end
115
+
116
+ #XXX seems mkmf forces basename on srcs
117
+ #XXX should be linking against libsigar anyhow
118
+ (Dir["../../src/*.c"] + Dir["#{osdir}/*.c"] + Dir["#{osdir}/*.cpp"]).each do |file|
119
+ cf = File.basename(file)
120
+ print file + ' -> ' + cf + "\n"
121
+ if is_win32
122
+ File.copy(file, cf)
123
+ else
124
+ File.symlink(file, cf) unless File.file?(cf)
125
+ end
126
+ $distcleanfiles.push(cf)
127
+ end
128
+
129
+ dir_config(extension_name)
130
+
131
+ create_makefile(extension_name)