Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 209 lines (188 sloc) 6.815 kB
6db33ad @alloy Move rbconfig and Info.plist creation to a separate file.
alloy authored
1 require File.expand_path('../builder/builder', __FILE__)
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
2
bd7eba3 objc exceptions should now be catchable in ruby
Laurent Sansonetti authored
3 desc "Build the markgc tool"
4 task :mark_gc do
5 if !File.exist?('markgc')
2c6aafe revert r3931
Laurent Sansonetti authored
6 sh "/usr/bin/gcc -std=c99 markgc.c -o markgc -Wno-format"
bd7eba3 objc exceptions should now be catchable in ruby
Laurent Sansonetti authored
7 end
8 end
9
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
10 desc "Build known objects"
bd7eba3 objc exceptions should now be catchable in ruby
Laurent Sansonetti authored
11 task :objects => [:config_h, :dtrace_h, :revision_h, :mark_gc] do
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
12 sh "/usr/bin/ruby tool/compile_prelude.rb prelude.rb miniprelude.c.new"
13 if !File.exist?('miniprelude.c') or File.read('miniprelude.c') != File.read('miniprelude.c.new')
14 mv('miniprelude.c.new', 'miniprelude.c')
15 else
16 rm('miniprelude.c.new')
17 end
18 if !File.exist?('prelude.c')
19 touch('prelude.c') # create empty file nevertheless
20 end
21 if !File.exist?('parse.c') or File.mtime('parse.y') > File.mtime('parse.c')
22 sh("/usr/bin/bison -o y.tab.c parse.y")
23 sh("/usr/bin/sed -f ./tool/ytab.sed -e \"/^#/s!y\.tab\.c!parse.c!\" y.tab.c > parse.c.new")
24 if !File.exist?('parse.c') or File.read('parse.c.new') != File.read('parse.c')
25 mv('parse.c.new', 'parse.c')
26 rm_f('parse.o')
27 else
28 rm('parse.c.new')
29 end
30 end
31 if !File.exist?('lex.c') or File.read('lex.c') != File.read('lex.c.blt')
32 cp('lex.c.blt', 'lex.c')
33 end
34 if !File.exist?('node_name.inc') or File.mtime('include/ruby/node.h') > File.mtime('node_name.inc')
35 sh("/usr/bin/ruby -n tool/node_name.rb include/ruby/node.h > node_name.inc")
36 end
bd7eba3 objc exceptions should now be catchable in ruby
Laurent Sansonetti authored
37 t = File.exist?('dispatcher.o') ? File.mtime('dispatcher.o') : nil
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
38 $builder.build
bd7eba3 objc exceptions should now be catchable in ruby
Laurent Sansonetti authored
39 if t == nil or File.mtime('dispatcher.o') > t
40 # dispatcher.o must be marked as GC compliant to avoid a linker problem.
41 # We do not build it using -fobjc-gc because gcc generates unnecessary (and slow) write
42 # barriers.
43 sh "./markgc ./dispatcher.o"
44 end
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
45 end
46
47 desc "Create miniruby"
48 task :miniruby => :objects do
49 $builder.link_executable('miniruby', OBJS - ['prelude'])
50 end
51
52 desc "Create config file"
53 task :rbconfig => :miniruby do
6db33ad @alloy Move rbconfig and Info.plist creation to a separate file.
alloy authored
54 require File.expand_path('../builder/templates', __FILE__)
55 Builder.create_rbconfig
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
56 end
57
58 namespace :macruby do
59 desc "Build dynamic libraries for MacRuby"
60 task :dylib => [:rbconfig, :miniruby] do
8c5a2dd let's go further miniruby
Laurent Sansonetti authored
61 =begin
da4daf6 @drernie Rakefile changes (unused) for including gcd_prelude
drernie authored
62 sh("./miniruby -I. -I./lib -rrbconfig tool/compile_prelude.rb prelude.rb gem_prelude.rb gcd_prelude prelude.c.new")
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
63 if !File.exist?('prelude.c') or File.read('prelude.c') != File.read('prelude.c.new')
64 mv('prelude.c.new', 'prelude.c')
65 $builder.build(['prelude'])
66 else
67 rm('prelude.c.new')
68 end
8c5a2dd let's go further miniruby
Laurent Sansonetti authored
69 =end
70 cp('miniprelude.c', 'prelude.c')
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
71 dylib = "lib#{RUBY_SO_NAME}.#{NEW_RUBY_VERSION}.dylib"
72 $builder.link_dylib(dylib, $builder.objs - ['main', 'gc-stub', 'miniprelude'])
73 major, minor, teeny = NEW_RUBY_VERSION.scan(/\d+/)
74 ["lib#{RUBY_SO_NAME}.#{major}.#{minor}.dylib", "lib#{RUBY_SO_NAME}.dylib"].each do |dylib_alias|
2be2465 @alloy Move extension builder code to Builder::Ext and clean builder.rake
alloy authored
75 if !File.exist?(dylib_alias) or File.readlink(dylib_alias) != dylib
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
76 rm_f(dylib_alias)
77 ln_s(dylib, dylib_alias)
78 end
79 end
80 end
81
82 desc "Build static libraries for MacRuby"
83 task :static => :dylib do
84 $builder.link_archive("lib#{RUBY_SO_NAME}-static.a", $builder.objs - ['main', 'gc-stub', 'miniprelude'])
85 end
86
87 desc "Build MacRuby"
88 task :build => :dylib do
89 $builder.link_executable(RUBY_INSTALL_NAME, ['main', 'gc-stub'], "-L. -l#{RUBY_SO_NAME} -lobjc")
90 end
094c682 created a macruby:weak_symbols task which dumps a list of weak symbols
Laurent Sansonetti authored
91
92 # Generates a list of weak symbols in libmacruby.dylib. You must not pass a unexported symbols list to
93 # rake when calling this command.
94 task :weak_symbols => :dylib do
95 sh("nm -m -P -arch i386 libmacruby.1.9.0.dylib | grep 'weak external' | grep -v 'undefined' | egrep -v '__ZT[IS]' | awk '{print$5}' > /tmp/syms-i386")
96 sh("nm -m -P -arch x86_64 libmacruby.1.9.0.dylib | grep 'weak external' | grep -v 'undefined' | egrep -v '__ZT[IS]' | awk '{print$5}' > /tmp/syms-x86_64")
97 sh("cat /tmp/syms-i386 /tmp/syms-x86_64 | uniq > unexported_symbols.list")
98 end
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
99 end
100
101 DESTDIR = (ENV['DESTDIR'] or "")
102 EXTOUT = (ENV['EXTOUT'] or ".ext")
103 INSTALLED_LIST = '.installed.list'
104 SCRIPT_ARGS = "--make=\"/usr/bin/make\" --dest-dir=\"#{DESTDIR}\" --extout=\"#{EXTOUT}\" --mflags=\"\" --make-flags=\"\""
43a7ba7 now generating and installing RDoc ri files
Laurent Sansonetti authored
105 INSTRUBY_ARGS = "#{SCRIPT_ARGS} --data-mode=0644 --prog-mode=0755 --installed-list #{INSTALLED_LIST} --mantype=\"doc\" --sym-dest-dir=\"#{SYM_INSTDIR}\" --rdoc-output=\"doc\""
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
106
107 desc "Build extensions"
108 task :extensions => [:miniruby, "macruby:static"] do
2be2465 @alloy Move extension builder code to Builder::Ext and clean builder.rake
alloy authored
109 Builder::Ext.build
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
110 end
111
43a7ba7 now generating and installing RDoc ri files
Laurent Sansonetti authored
112 desc "Generate RDoc files"
113 task :doc => [:macruby, :extensions] do
114 doc_op = './doc'
115 unless File.exist?(doc_op)
116 sh "DYLD_LIBRARY_PATH=. ./macruby -I. -I./lib -I./ext/libyaml -I./ext/etc bin/rdoc --ri --op \"#{doc_op}\""
117 end
118 end
119
28d81c6 added a bunch of stdlib files to the aot list
Laurent Sansonetti authored
120 AOT_STDLIB = [
121 'rbconfig.rb',
122 'lib/date.rb',
123 'lib/date/**/*.rb',
70e1800 added erb to the aot list
Laurent Sansonetti authored
124 'lib/erb.rb',
28d81c6 added a bunch of stdlib files to the aot list
Laurent Sansonetti authored
125 'lib/fileutils.rb',
126 'lib/irb.rb',
127 'lib/irb/**/*.rb',
4f163cb add all net/* libraries to the aot list
Laurent Sansonetti authored
128 'lib/net/**/*.rb',
28d81c6 added a bunch of stdlib files to the aot list
Laurent Sansonetti authored
129 'lib/optparse.rb',
130 #'lib/stringio.rb', #spec fails
cfd0f9e added rexml to the AOT list
Laurent Sansonetti authored
131 'lib/rexml.rb',
132 'lib/rexml/**/*.rb',
53c50f1 now AOT compiling rubygems
Laurent Sansonetti authored
133 'lib/rubygems.rb',
134 'lib/rubygems/**/*.rb',
28d81c6 added a bunch of stdlib files to the aot list
Laurent Sansonetti authored
135 'lib/thread.rb',
136 'lib/time.rb',
137 'lib/timeout.rb',
764c005 forgot uri.rb
Laurent Sansonetti authored
138 'lib/uri.rb',
28d81c6 added a bunch of stdlib files to the aot list
Laurent Sansonetti authored
139 'lib/uri/**/*.rb',
aeafee7 adding xmlrpc to the AOT list
Laurent Sansonetti authored
140 'lib/xmlrpc/**/*.rb',
28d81c6 added a bunch of stdlib files to the aot list
Laurent Sansonetti authored
141 'lib/yaml.rb',
142 'lib/yaml/rubytypes.rb',
143 ]
96df0a7 aot_compile_stdlib becomes stdlib:build + added stdlib:touch for lazy…
Laurent Sansonetti authored
144 namespace :stdlib do
145 desc "AOT compile the stdlib"
146 task :build => [:miniruby, 'macruby:dylib'] do
d6d6b6f @alloy Add a simple way to execute commands in parallel. For the time being …
alloy authored
147 archf = ARCHS.map { |x| "--arch #{x}" }.join(' ')
5741ccc @alloy Add a compile_stdlib option for the builder, which can be set to fals…
alloy authored
148 commands = (COMPILE_STDLIB ? AOT_STDLIB : %w{ rbconfig.rb }).map do |pattern|
d6d6b6f @alloy Add a simple way to execute commands in parallel. For the time being …
alloy authored
149 Dir.glob(pattern).map do |path|
96df0a7 aot_compile_stdlib becomes stdlib:build + added stdlib:touch for lazy…
Laurent Sansonetti authored
150 out = File.join(File.dirname(path), File.basename(path, '.rb') + '.rbo')
151 if !File.exist?(out) or File.mtime(path) > File.mtime(out) or File.mtime('./miniruby') > File.mtime(out)
d6d6b6f @alloy Add a simple way to execute commands in parallel. For the time being …
alloy authored
152 "./miniruby -I. -I./lib bin/rubyc --internal #{archf} -C \"#{path}\" -o \"#{out}\""
96df0a7 aot_compile_stdlib becomes stdlib:build + added stdlib:touch for lazy…
Laurent Sansonetti authored
153 end
3ae269b move the AOT compilation of the stdlib into the main build task, intr…
Laurent Sansonetti authored
154 end
d6d6b6f @alloy Add a simple way to execute commands in parallel. For the time being …
alloy authored
155 end.flatten.compact
95da69a @alloy Moved the parallel_execute method to Builder and make it accept array…
alloy authored
156 Builder.parallel_execute(commands)
96df0a7 aot_compile_stdlib becomes stdlib:build + added stdlib:touch for lazy…
Laurent Sansonetti authored
157 end
3ae269b move the AOT compilation of the stdlib into the main build task, intr…
Laurent Sansonetti authored
158 end
159
0bc95cf fixed rbconfig.rb to use absolute paths + fixed TRY_LINK to use g++, …
Laurent Sansonetti authored
160 desc "Same as extensions"
161 task :ext => 'extensions'
162
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
163 namespace :framework do
164 desc "Create the plist file for the framework"
165 task :info_plist do
6db33ad @alloy Move rbconfig and Info.plist creation to a separate file.
alloy authored
166 require File.expand_path('../builder/templates', __FILE__)
167 Builder.create_framework_info_plist
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
168 end
169
108e7c1 added a framework:install_ext task that only installs extensions
Laurent Sansonetti authored
170 desc "Install the extensions"
171 task :install_ext do
2be2465 @alloy Move extension builder code to Builder::Ext and clean builder.rake
alloy authored
172 Builder::Ext.install
108e7c1 added a framework:install_ext task that only installs extensions
Laurent Sansonetti authored
173 end
174
175 desc "Install the framework"
176 task :install => [:info_plist, :install_ext] do
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
177 sh "./miniruby instruby.rb #{INSTRUBY_ARGS}"
178 end
179 end
180
181 namespace :clean do
182 desc "Clean local build files"
183 task :local do
184 $builder.clean
69528db fixed the clean task to remove binary build producfs too
Laurent Sansonetti authored
185 list = ['parse.c', 'lex.c', INSTALLED_LIST, 'Makefile', RUBY_INSTALL_NAME, 'miniruby']
186 list.concat(Dir['*.inc'])
187 list.concat(Dir['lib*.{dylib,a}'])
188 list.each { |x| rm_f(x) }
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
189 end
190
6b57493 added a task to delete the .rbo files
Laurent Sansonetti authored
191 desc "Clean .rbo build files"
192 task :rbo do
193 list = []
194 list.concat(Dir['*.rbo'])
195 list.concat(Dir['lib/**/*.rbo'])
196 list.each { |x| rm_f(x) }
197 end
198
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
199 desc "Clean extension build files"
200 task :ext do
2be2465 @alloy Move extension builder code to Builder::Ext and clean builder.rake
alloy authored
201 Builder::Ext.clean
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
202 end
43a7ba7 now generating and installing RDoc ri files
Laurent Sansonetti authored
203
204 desc "Clean the RDoc files"
205 task :doc do
206 rm_rf('doc')
207 end
b0f57d9 blocked the rake all/install tasks for now
Laurent Sansonetti authored
208 end
Something went wrong with that request. Please try again.