forked from wtaysom/rglpk
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
executable file
·71 lines (57 loc) · 1.85 KB
/
Rakefile
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
69
70
71
require 'rake/clean'
# Adapted from Hoe.
def paragraphs_of(path, *paragraphs)
File.read(path).split(/\n\n+/).values_at(*paragraphs).join("\n\n")
end
def in_dir(path)
original_dir = Dir.pwd
Dir.chdir(path)
yield
ensure
Dir.chdir(original_dir)
end
begin
require 'jeweler'
Jeweler::Tasks.new do |gemspec|
gemspec.name = "heroku-rglpk"
gemspec.summary = paragraphs_of("README.md", 1)
gemspec.description = paragraphs_of("README.md", 1..3)
# gemspec.homepage = "http://rglpk.rubyforge.org/"
# gemspec.rubyforge_project = "rglpk"
gemspec.authors = ["Alex Gutteridge", "William Taysom"]
gemspec.email = ["[email protected]", "[email protected]"]
gemspec.extensions << 'ext/extconf.rb'
gemspec.require_paths << 'ext'
gemspec.require_paths << 'ext/glpk_install/lib'
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler not available. Install it with: gem install jeweler"
end
SHARED_LIBRARY_EXTENSION = RUBY_PLATFORM.include?("darwin") ? 'bundle' : 'so'
EXTENSION = 'ext/glpk_wrapper.'+SHARED_LIBRARY_EXTENSION
desc "Use extconf.rb and make to build the extension."
task :build_extension => EXTENSION
file EXTENSION => 'ext/glpk_wrapper.c' do
puts "why am I here?"
in_dir('ext') do
system("ruby extconf.rb")
system("make")
end
end
CLEAN.include('ext/Makefile', 'ext/conftest.dSYM', 'ext/mkmf.log',
'ext/glpk_wrapper.bundle', 'ext/glpk_wrapper.o')
file 'ext/glpk_wrapper.c' => 'swig/glpk.i' do
in_dir('swig') do
system("autoconf")
system("configure")
system("make wrap")
end
end
CLEAN.include('swig/Makefile', 'swig/autom4te.cache', 'swig/config.log',
'swig/config.status', 'swig/configure', 'swig/glpk_wrapper.c')
CLOBBER.include('ext/glpk_wrapper.c', 'rglpk.gemspec')
desc "Run Test::Unit tests."
task :test => :build_extension do
system("ruby test/test_all.rb")
end