aboutsummaryrefslogtreecommitdiff
path: root/makerake.rb
blob: 92f79bb83e01f6bc613b043f522ed179bfe2fa19 (plain)
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
require "rubygems"
require "mkrf"
require 'optparse'
    
options = {}

def crash(  )
  print <<EOL
need libivy (see http://www.tls.cena.fr/products/ivy/index.html)

  Install the library or try one of the following options to makerake.rb:

    -L /path/to/libivy/lib
    -H /path/to/libivy/include
EOL
  exit 1
end  

OptionParser.new do |opts|
  opts.banner = "Usage: makerake.rb [options]"
    
  opts.on("-L", "--libraries [PATH]", String, "Path to the libivy") do |v|
    options[:libivy] = v
  end

  opts.on("-H", "--headers [PATH]", String, "Path to the Ivy headers") do |v|
    options[:headerivy] = v
  end
end.parse!
          
Mkrf::Generator.new('ivy', '*.c') do |g|
  g.include_library('ivy','IvySendMsg', [options[:libivy]]) or crash 
  
  ["ivyloop.h", "ivysocket.h", "ivychannel.h", "ivybind.h", "ivy.h", "timer.h"].each do |header_file|
    g.include_header( header_file, [options[:headerivy]] ) or crash
  end
end