Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 107 lines (97 sloc) 3.355 kb
262ab306 »
2008-09-13 interval class is specd
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
3b8f13c3 »
2008-09-10 initial import
10 desc "Build the extension(s)"
3b6dc769 »
2009-06-28 all is well again, time to release
11 task :build => :clean do
b32bad4e »
2009-08-01 add in support for mingw32 gem
12 ext_config.configs.each do |extension|
13 path = Pathname.new(extension)
262ab306 »
2008-09-13 interval class is specd
14 parts = path.split
b32bad4e »
2009-08-01 add in support for mingw32 gem
15 conf = parts.last
262ab306 »
2008-09-13 interval class is specd
16 Dir.chdir(path.dirname) do |d|
17 ruby conf.to_s
888773e1 »
2008-10-11 working on windows gem
18 sh "make"
b32bad4e »
2009-08-01 add in support for mingw32 gem
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
3b8f13c3 »
2008-09-10 initial import
25 end
262ab306 »
2008-09-13 interval class is specd
26 end
3b8f13c3 »
2008-09-10 initial import
27 end
28
04cfad25 »
2010-07-26 First pass at jruby extension
29 desc "Build the jruby extension"
30 task :build_jruby => :clean do
31 path = "ext/java"
32 Dir.chdir( path ) do |d|
33 #java_ext = "lib/hitimes/java/#{RUBY_VERSION.sub(/\.\d$/,'')}/hitimes_ext.#{Config::CONFIG['DLEXT']}"
34 java_ext = "lib/hitimes/hitimes.jar"
35 jruby_home = Config::CONFIG['prefix']
36 classpath = "#{jruby_home}/lib/jruby.jar"
37 FileUtils.mkdir_p "../../#{File.dirname( java_ext )}"
38 sh "javac -g -cp #{classpath} hitimes/*.java"
39 sh "jar cf ../../#{java_ext} hitimes/*.class"
40 end
41 end
42
43
5759048f »
2009-06-28 on the way to fat binaries
44 def build_win( version = "1.8.6" )
45 ext_config = Configuration.for("extension")
46 rbconfig = ext_config.cross_rbconfig["rbconfig-#{version}"]
47 raise ArgumentError, "No cross compiler for version #{version}, we have #{ext_config.cross_rbconfig.keys.join(",")}" unless rbconfig
888773e1 »
2008-10-11 working on windows gem
48 Hitimes::GEM_SPEC.extensions.each do |extension|
49 path = Pathname.new(extension)
50 parts = path.split
51 conf = parts.last
9ce4ba65 »
2010-07-25 fix rvm path
52 rvm = File.expand_path( "~/.rvm/bin/rvm" )
888773e1 »
2008-10-11 working on windows gem
53 Dir.chdir(path.dirname) do |d|
b32bad4e »
2009-08-01 add in support for mingw32 gem
54 if File.exist?( "Makefile" ) then
55 sh "make clean distclean"
56 end
5759048f »
2009-06-28 on the way to fat binaries
57 cp "#{rbconfig}", "rbconfig.rb"
a38e5d2e »
2010-07-20 use rvm to build cross compiled versions
58 rubylib = ENV['RUBYLIB']
59 ENV['RUBYLIB'] = "."
60 sh %[#{rvm} #{version} -S extconf.rb]
61 ENV['RUBYLIB'] = rubylib
888773e1 »
2008-10-11 working on windows gem
62 sh "make"
63 end
64 end
65 end
66
46593170 »
2009-06-28 Fix up :clean and :clobber tasks
67 win_builds = []
5759048f »
2009-06-28 on the way to fat binaries
68 ext_config.cross_rbconfig.keys.each do |v|
69 s = v.split("-").last
70 desc "Build the extension for windows version #{s}"
46593170 »
2009-06-28 Fix up :clean and :clobber tasks
71 win_bname = "build_win-#{s}"
72 win_builds << win_bname
73 task win_bname => :clean do
5759048f »
2009-06-28 on the way to fat binaries
74 build_win( s )
75 end
76 end
77
262ab306 »
2008-09-13 interval class is specd
78 task :clean do
79 ext_config.configs.each do |extension|
80 path = Pathname.new(extension)
81 parts = path.split
82 conf = parts.last
83 Dir.chdir(path.dirname) do |d|
1295d2f9 »
2009-06-28 fix make clean if no Makefile
84 if File.exist?( "Makefile" ) then
85 sh "make clean"
86 end
b32bad4e »
2009-08-01 add in support for mingw32 gem
87 rm_f "rbconfig.rb"
262ab306 »
2008-09-13 interval class is specd
88 end
89 end
90 end
91
92 task :clobber do
93 ext_config.configs.each do |extension|
94 path = Pathname.new(extension)
95 parts = path.split
96 conf = parts.last
97 Dir.chdir(path.dirname) do |d|
138b7ae2 »
2008-10-11 Added ability to build windows gem as from a cross compliler
98 if File.exist?( "Makefile" ) then
99 sh "make distclean"
100 end
46593170 »
2009-06-28 Fix up :clean and :clobber tasks
101 rm_f "rbconfig.rb"
262ab306 »
2008-09-13 interval class is specd
102 end
103 end
104 end
105 end
106 end
Something went wrong with that request. Please try again.