Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 111 lines (97 sloc) 3.408 kB
262ab30 @copiousfreetime interval class is specd
authored
1 require 'tasks/config'
2 require 'pathname'
3
4 #-----------------------------------------------------------------------
5 # Extensions
6 #-----------------------------------------------------------------------
7
8 if ext_config = Configuration.for_if_exist?('extension') then
9 namespace :ext do
3b8f13c @copiousfreetime initial import
authored
10 desc "Build the extension(s)"
ebf77c7 @copiousfreetime coordinate building of gems for 3 different platforms
authored
11 task :build => :clobber do
b32bad4 @copiousfreetime add in support for mingw32 gem
authored
12 ext_config.configs.each do |extension|
13 path = Pathname.new(extension)
262ab30 @copiousfreetime interval class is specd
authored
14 parts = path.split
b32bad4 @copiousfreetime add in support for mingw32 gem
authored
15 conf = parts.last
262ab30 @copiousfreetime interval class is specd
authored
16 Dir.chdir(path.dirname) do |d|
17 ruby conf.to_s
888773e @copiousfreetime working on windows gem
authored
18 sh "make"
b32bad4 @copiousfreetime add in support for mingw32 gem
authored
19
20 # install into requireable location so specs will run
21 subdir = "hitimes/#{RUBY_VERSION.sub(/\.\d$/,'')}"
22 dest_dir = Hitimes::Paths.lib_path( subdir )
23 mkdir_p dest_dir, :verbose => true
24 cp "hitimes_ext.#{Config::CONFIG['DLEXT']}", dest_dir, :verbose => true
3b8f13c @copiousfreetime initial import
authored
25 end
262ab30 @copiousfreetime interval class is specd
authored
26 end
3b8f13c @copiousfreetime initial import
authored
27 end
28
ebf77c7 @copiousfreetime coordinate building of gems for 3 different platforms
authored
29 if RUBY_PLATFORM == "java" then
30 desc "Build the jruby extension"
31 task :build_java => [ :clobber, "lib/hitimes/hitimes.jar" ]
32
33 file "lib/hitimes/hitimes.jar" => FileList["ext/java/src/hitimes/*.java"] do |t|
04cfad2 @copiousfreetime First pass at jruby extension
authored
34 jruby_home = Config::CONFIG['prefix']
ebf77c7 @copiousfreetime coordinate building of gems for 3 different platforms
authored
35 jruby_jar = File.join( jruby_home, 'lib', 'jruby.jar' )
36
37 mkdir_p 'pkg/classes'
38 sh "javac -classpath #{jruby_jar} -d pkg/classes #{t.prerequisites.join(' ')}"
39
40 dest_dir = File.dirname(t.name)
41 sh "jar cf #{t.name} -C pkg/classes ."
04cfad2 @copiousfreetime First pass at jruby extension
authored
42 end
43 end
44
45
5759048 @copiousfreetime on the way to fat binaries
authored
46 def build_win( version = "1.8.6" )
47 ext_config = Configuration.for("extension")
972bfb7 @copiousfreetime Make allowances for those that want to build/test but do not have cro…
authored
48 return nil unless ext_config.cross_rbconfig
49
5759048 @copiousfreetime on the way to fat binaries
authored
50 rbconfig = ext_config.cross_rbconfig["rbconfig-#{version}"]
51 raise ArgumentError, "No cross compiler for version #{version}, we have #{ext_config.cross_rbconfig.keys.join(",")}" unless rbconfig
888773e @copiousfreetime working on windows gem
authored
52 Hitimes::GEM_SPEC.extensions.each do |extension|
53 path = Pathname.new(extension)
54 parts = path.split
55 conf = parts.last
9ce4ba6 @copiousfreetime fix rvm path
authored
56 rvm = File.expand_path( "~/.rvm/bin/rvm" )
888773e @copiousfreetime working on windows gem
authored
57 Dir.chdir(path.dirname) do |d|
b32bad4 @copiousfreetime add in support for mingw32 gem
authored
58 if File.exist?( "Makefile" ) then
59 sh "make clean distclean"
60 end
5759048 @copiousfreetime on the way to fat binaries
authored
61 cp "#{rbconfig}", "rbconfig.rb"
a38e5d2 @copiousfreetime use rvm to build cross compiled versions
authored
62 rubylib = ENV['RUBYLIB']
63 ENV['RUBYLIB'] = "."
64 sh %[#{rvm} #{version} -S extconf.rb]
65 ENV['RUBYLIB'] = rubylib
888773e @copiousfreetime working on windows gem
authored
66 sh "make"
67 end
68 end
69 end
70
4659317 @copiousfreetime Fix up :clean and :clobber tasks
authored
71 win_builds = []
5759048 @copiousfreetime on the way to fat binaries
authored
72 ext_config.cross_rbconfig.keys.each do |v|
73 s = v.split("-").last
74 desc "Build the extension for windows version #{s}"
4659317 @copiousfreetime Fix up :clean and :clobber tasks
authored
75 win_bname = "build_win-#{s}"
76 win_builds << win_bname
77 task win_bname => :clean do
5759048 @copiousfreetime on the way to fat binaries
authored
78 build_win( s )
79 end
80 end
81
262ab30 @copiousfreetime interval class is specd
authored
82 task :clean do
83 ext_config.configs.each do |extension|
84 path = Pathname.new(extension)
85 parts = path.split
86 conf = parts.last
87 Dir.chdir(path.dirname) do |d|
1295d2f @copiousfreetime fix make clean if no Makefile
authored
88 if File.exist?( "Makefile" ) then
89 sh "make clean"
90 end
b32bad4 @copiousfreetime add in support for mingw32 gem
authored
91 rm_f "rbconfig.rb"
262ab30 @copiousfreetime interval class is specd
authored
92 end
93 end
94 end
95
96 task :clobber do
97 ext_config.configs.each do |extension|
98 path = Pathname.new(extension)
99 parts = path.split
100 conf = parts.last
101 Dir.chdir(path.dirname) do |d|
138b7ae @copiousfreetime Added ability to build windows gem as from a cross compliler
authored
102 if File.exist?( "Makefile" ) then
103 sh "make distclean"
104 end
4659317 @copiousfreetime Fix up :clean and :clobber tasks
authored
105 rm_f "rbconfig.rb"
262ab30 @copiousfreetime interval class is specd
authored
106 end
107 end
108 end
109 end
110 end
Something went wrong with that request. Please try again.