require "mkmf" require "ftools" # Linux and Windows should use install.rb instead if RUBY_PLATFORM =~ /windows|win32|mingw|cygwin|dos|linux/ STDERR.puts "For this platform, run 'ruby install.rb' instead" STDERR.puts "Exiting..." exit end # Move any .rb files to .orig to prevent them from being installed # during make site-install. File.move("lib/sys/linux.rb","lib/sys/linux.orig") rescue nil File.move("lib/sys/windows.rb","lib/sys/windows.orig") rescue nil File.delete('cpu.c') if File.exists?('cpu.c') case RUBY_PLATFORM when /hpux/i File.symlink("lib/sys/hpux.c", "cpu.c") create_makefile("sys/cpu") when /sunos|solaris/i File.symlink("lib/sys/sunos.c", "cpu.c") unless have_func("getloadavg") have_library("kstat") end create_makefile("sys/cpu") when /freebsd/i File.symlink("lib/sys/freebsd.c", "cpu.c") have_library("kvm") create_makefile("sys/cpu") when /linux|dos|windows|win32|mingw|cygwin/i STDERR.puts "Run 'ruby install.rb' instead for this platform" else STDERR.puts "This platform is not currently supported. Exiting..." end