Skip to content
Newer
Older
100644 476 lines (446 sloc) 16.3 KB
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
1 require File.expand_path('../builder', __FILE__)
b8cf6a6 @alloy Added available build options to the output of: $ rake -T
alloy authored
2 require 'rake'
3
4 # We monkey-patch the method that Rake uses to display the tasks so we can add
5 # the build options.
6 module Rake
7 class Application
8 def formatted_macruby_options
9 $builder_options.sort_by { |name, _| name }.map do |name, default|
10 default = default.join(',') if default.is_a?(Array)
ac477e5 @alloy Oops, a bit too much indentation.
alloy authored
11 " #{name.ljust(30)} \"#{default}\""
b8cf6a6 @alloy Added available build options to the output of: $ rake -T
alloy authored
12 end.join("\n")
13 end
14
15 alias_method :display_tasks_and_comments_without_macruby_options, :display_tasks_and_comments
16
17 def display_tasks_and_comments
18 display_tasks_and_comments_without_macruby_options
19 puts %{
20 To change any of the default build options, use the rake build task
21 of choice with any of these following option-value pairs:
22
27ca189 @alloy Removed all specfic specs that are to be run from the rake tasks and …
alloy authored
23 Usage: $ rake [task] [option=value, ...]
b8cf6a6 @alloy Added available build options to the output of: $ rake -T
alloy authored
24
25 #{'Option:'.ljust(30)} Default value:
26
27 #{formatted_macruby_options}
28
29 Example:
30
31 $ rake all archs="i386,ppc" framework_instdir="~/Library/Frameworks"
32
33 }
34 end
35 end
36 end
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
37
bd7eba3 objc exceptions should now be catchable in ruby
Laurent Sansonetti authored
38 desc "Build the markgc tool"
39 task :mark_gc do
40 if !File.exist?('markgc')
41 sh "/usr/bin/gcc -std=c99 markgc.c -o markgc -Wno-format"
42 end
43 end
44
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
45 desc "Build known objects"
bd7eba3 objc exceptions should now be catchable in ruby
Laurent Sansonetti authored
46 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
47 sh "/usr/bin/ruby tool/compile_prelude.rb prelude.rb miniprelude.c.new"
48 if !File.exist?('miniprelude.c') or File.read('miniprelude.c') != File.read('miniprelude.c.new')
49 mv('miniprelude.c.new', 'miniprelude.c')
50 else
51 rm('miniprelude.c.new')
52 end
53 if !File.exist?('prelude.c')
54 touch('prelude.c') # create empty file nevertheless
55 end
56 if !File.exist?('parse.c') or File.mtime('parse.y') > File.mtime('parse.c')
57 sh("/usr/bin/bison -o y.tab.c parse.y")
58 sh("/usr/bin/sed -f ./tool/ytab.sed -e \"/^#/s!y\.tab\.c!parse.c!\" y.tab.c > parse.c.new")
59 if !File.exist?('parse.c') or File.read('parse.c.new') != File.read('parse.c')
60 mv('parse.c.new', 'parse.c')
61 rm_f('parse.o')
62 else
63 rm('parse.c.new')
64 end
65 end
66 if !File.exist?('lex.c') or File.read('lex.c') != File.read('lex.c.blt')
67 cp('lex.c.blt', 'lex.c')
68 end
69 if !File.exist?('node_name.inc') or File.mtime('include/ruby/node.h') > File.mtime('node_name.inc')
70 sh("/usr/bin/ruby -n tool/node_name.rb include/ruby/node.h > node_name.inc")
71 end
bd7eba3 objc exceptions should now be catchable in ruby
Laurent Sansonetti authored
72 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
73 $builder.build
bd7eba3 objc exceptions should now be catchable in ruby
Laurent Sansonetti authored
74 if t == nil or File.mtime('dispatcher.o') > t
75 # dispatcher.o must be marked as GC compliant to avoid a linker problem.
76 # We do not build it using -fobjc-gc because gcc generates unnecessary (and slow) write
77 # barriers.
78 sh "./markgc ./dispatcher.o"
79 end
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
80 end
81
82 desc "Create miniruby"
83 task :miniruby => :objects do
84 $builder.link_executable('miniruby', OBJS - ['prelude'])
85 end
86
87 desc "Create config file"
88 task :rbconfig => :miniruby do
89 rbconfig = <<EOS
90 # This file was created when MacRuby was built. Any changes made to this file
91 # will be lost the next time MacRuby is built.
92
93 module RbConfig
94 RUBY_VERSION == "#{NEW_RUBY_VERSION}" or
95 raise "ruby lib version (#{NEW_RUBY_VERSION}) doesn't match executable version (\#{RUBY_VERSION})"
96
97 TOPDIR = File.dirname(__FILE__).chomp!("/lib/ruby/#{NEW_RUBY_VERSION}/#{NEW_RUBY_PLATFORM}")
98 DESTDIR = '' unless defined? DESTDIR
99 CONFIG = {}
100 CONFIG["DESTDIR"] = DESTDIR
101 CONFIG["INSTALL"] = '/usr/bin/install -c'
102 CONFIG["prefix"] = (TOPDIR || DESTDIR + "#{FRAMEWORK_USR}")
103 CONFIG["EXEEXT"] = ""
104 CONFIG["ruby_install_name"] = "#{RUBY_INSTALL_NAME}"
105 CONFIG["RUBY_INSTALL_NAME"] = "#{RUBY_INSTALL_NAME}"
106 CONFIG["RUBY_SO_NAME"] = "#{RUBY_SO_NAME}"
107 CONFIG["SHELL"] = "/bin/sh"
108 CONFIG["PATH_SEPARATOR"] = ":"
109 CONFIG["PACKAGE_NAME"] = ""
110 CONFIG["PACKAGE_TARNAME"] = ""
111 CONFIG["PACKAGE_VERSION"] = ""
112 CONFIG["PACKAGE_STRING"] = ""
113 CONFIG["PACKAGE_BUGREPORT"] = ""
114 CONFIG["exec_prefix"] = "$(prefix)"
115 CONFIG["bindir"] = "$(exec_prefix)/bin"
116 CONFIG["sbindir"] = "$(exec_prefix)/sbin"
117 CONFIG["libexecdir"] = "$(exec_prefix)/libexec"
118 CONFIG["datarootdir"] = "$(prefix)/share"
119 CONFIG["datadir"] = "$(datarootdir)"
120 CONFIG["sysconfdir"] = "$(prefix)/etc"
121 CONFIG["sharedstatedir"] = "$(prefix)/com"
122 CONFIG["localstatedir"] = "$(prefix)/var"
123 CONFIG["includedir"] = "$(prefix)/include"
124 CONFIG["oldincludedir"] = "/usr/include"
125 CONFIG["docdir"] = "$(datarootdir)/doc/$(PACKAGE)"
126 CONFIG["infodir"] = "$(datarootdir)/info"
127 CONFIG["htmldir"] = "$(docdir)"
128 CONFIG["dvidir"] = "$(docdir)"
129 CONFIG["pdfdir"] = "$(docdir)"
130 CONFIG["psdir"] = "$(docdir)"
131 CONFIG["libdir"] = "$(exec_prefix)/lib"
132 CONFIG["localedir"] = "$(datarootdir)/locale"
133 CONFIG["mandir"] = "$(datarootdir)/man"
134 CONFIG["DEFS"] = ""
135 CONFIG["ECHO_C"] = "\\\\\\\\c"
136 CONFIG["ECHO_N"] = ""
137 CONFIG["ECHO_T"] = ""
138 CONFIG["LIBS"] = ""
139 CONFIG["build_alias"] = ""
140 CONFIG["host_alias"] = ""
141 CONFIG["target_alias"] = ""
142 CONFIG["BASERUBY"] = "ruby"
143 CONFIG["MAJOR"], CONFIG["MINOR"], CONFIG["TEENY"] = [#{NEW_RUBY_VERSION.scan(/\d+/).map { |x| "\"" + x + "\"" }.join(', ')}]
144 CONFIG["build"] = "i686-apple-darwin9.0.0"
145 CONFIG["build_cpu"] = "i686"
146 CONFIG["build_vendor"] = "apple"
147 CONFIG["build_os"] = "darwin9.0.0"
148 CONFIG["host"] = "i686-apple-darwin9.0.0"
149 CONFIG["host_cpu"] = "i686"
150 CONFIG["host_vendor"] = "apple"
151 CONFIG["host_os"] = "darwin9.0.0"
152 CONFIG["target"] = "i686-apple-darwin9.0.0"
153 CONFIG["target_cpu"] = "i686"
154 CONFIG["target_vendor"] = "apple"
155 CONFIG["target_os"] = "darwin9.0"
0bc95cf fixed rbconfig.rb to use absolute paths + fixed TRY_LINK to use g++, …
Laurent Sansonetti authored
156 CONFIG["CC"] = "/usr/bin/gcc"
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
157 CONFIG["CFLAGS"] = "-fno-common -pipe $(cflags)"
158 CONFIG["LDFLAGS"] = ""
159 CONFIG["CPPFLAGS"] = "$(cppflags)"
160 CONFIG["OBJEXT"] = "o"
0bc95cf fixed rbconfig.rb to use absolute paths + fixed TRY_LINK to use g++, …
Laurent Sansonetti authored
161 CONFIG["CXX"] = "/usr/bin/g++"
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
162 CONFIG["CXXFLAGS"] = ""
0bc95cf fixed rbconfig.rb to use absolute paths + fixed TRY_LINK to use g++, …
Laurent Sansonetti authored
163 CONFIG["CPP"] = "/usr/bin/gcc -E"
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
164 CONFIG["GREP"] = "/usr/bin/grep"
165 CONFIG["EGREP"] = "/usr/bin/grep -E"
166 CONFIG["GNU_LD"] = "no"
167 CONFIG["CPPOUTFILE"] = "-o conftest.i"
168 CONFIG["OUTFLAG"] = "-o "
169 CONFIG["COUTFLAG"] = "-o "
170 CONFIG["RANLIB"] = "ranlib"
171 CONFIG["AR"] = "ar"
172 CONFIG["AS"] = "as"
173 CONFIG["ASFLAGS"] = ""
174 CONFIG["NM"] = ""
175 CONFIG["WINDRES"] = ""
176 CONFIG["DLLWRAP"] = ""
177 CONFIG["OBJDUMP"] = ""
178 CONFIG["LN_S"] = "ln -s"
179 CONFIG["SET_MAKE"] = ""
180 CONFIG["INSTALL_PROGRAM"] = "$(INSTALL)"
181 CONFIG["INSTALL_SCRIPT"] = "$(INSTALL)"
182 CONFIG["INSTALL_DATA"] = "$(INSTALL) -m 644"
183 CONFIG["RM"] = "rm -f"
184 CONFIG["CP"] = "cp"
185 CONFIG["MAKEDIRS"] = "mkdir -p"
186 CONFIG["ALLOCA"] = ""
187 CONFIG["DLDFLAGS"] = ""
188 CONFIG["ARCH_FLAG"] = "#{ARCHFLAGS}"
189 CONFIG["STATIC"] = ""
190 CONFIG["CCDLFLAGS"] = "-fno-common"
191 CONFIG["LDSHARED"] = "$(CC) -dynamic -bundle -undefined suppress -flat_namespace #{ARCHFLAGS}"
192 CONFIG["LDSHAREDXX"] = "$(CXX) -dynamic -bundle -undefined suppress -flat_namespace"
193 CONFIG["DLEXT"] = "bundle"
194 CONFIG["DLEXT2"] = ""
195 CONFIG["LIBEXT"] = "a"
196 CONFIG["LINK_SO"] = ""
197 CONFIG["LIBPATHFLAG"] = " -L%s"
198 CONFIG["RPATHFLAG"] = ""
199 CONFIG["LIBPATHENV"] = "DYLD_LIBRARY_PATH"
030c32b fixed rbconfig.rb to never mention libmacruby-static, reverted TRY_LINK
Laurent Sansonetti authored
200 CONFIG["TRY_LINK"] = ""
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
201 CONFIG["STRIP"] = "strip -A -n"
202 CONFIG["EXTSTATIC"] = ""
203 CONFIG["setup"] = "Setup"
204 CONFIG["PREP"] = "miniruby$(EXEEXT)"
205 CONFIG["EXTOUT"] = ".ext"
206 CONFIG["ARCHFILE"] = ""
207 CONFIG["RDOCTARGET"] = "install-doc"
208 CONFIG["cppflags"] = ""
209 CONFIG["cflags"] = "$(optflags) $(debugflags) $(warnflags)"
def059d building the ripper extension (but not installing it yet)
Laurent Sansonetti authored
210 CONFIG["optflags"] = "-O3"
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
211 CONFIG["debugflags"] = "-g"
212 CONFIG["warnflags"] = "-Wall -Wno-parentheses"
0bc95cf fixed rbconfig.rb to use absolute paths + fixed TRY_LINK to use g++, …
Laurent Sansonetti authored
213 CONFIG["LIBRUBY_LDSHARED"] = "/usr/bin/gcc -dynamiclib -undefined suppress -flat_namespace"
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
214 CONFIG["LIBRUBY_DLDFLAGS"] = "-install_name $(libdir)/lib$(RUBY_SO_NAME).dylib -current_version $(MAJOR).$(MINOR).$(TEENY) -compatibility_version $(MAJOR).$(MINOR)"
215 CONFIG["rubyw_install_name"] = ""
216 CONFIG["RUBYW_INSTALL_NAME"] = ""
217 CONFIG["LIBRUBY_A"] = "lib$(RUBY_SO_NAME)-static.a"
218 CONFIG["LIBRUBY_SO"] = "lib$(RUBY_SO_NAME).$(MAJOR).$(MINOR).$(TEENY).dylib"
219 CONFIG["LIBRUBY_ALIASES"] = "lib$(RUBY_SO_NAME).$(MAJOR).$(MINOR).dylib lib$(RUBY_SO_NAME).dylib"
220 CONFIG["LIBRUBY"] = "$(LIBRUBY_SO)"
221 CONFIG["LIBRUBYARG"] = "$(LIBRUBYARG_SHARED)"
030c32b fixed rbconfig.rb to never mention libmacruby-static, reverted TRY_LINK
Laurent Sansonetti authored
222 #CONFIG["LIBRUBYARG_STATIC"] = "-l$(RUBY_SO_NAME)-static #{LDFLAGS}"
223 CONFIG["LIBRUBYARG_SHARED"] = CONFIG["LIBRUBYARG_STATIC"] = "-l$(RUBY_SO_NAME)"
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
224 CONFIG["SOLIBS"] = ""
225 CONFIG["DLDLIBS"] = ""
226 CONFIG["ENABLE_SHARED"] = "yes"
227 CONFIG["ENABLE_STATIC"] = "#{ENABLE_STATIC_LIBRARY}"
228 CONFIG["MAINLIBS"] = ""
229 CONFIG["COMMON_LIBS"] = ""
230 CONFIG["COMMON_MACROS"] = ""
231 CONFIG["COMMON_HEADERS"] = ""
232 CONFIG["EXPORT_PREFIX"] = ""
233 CONFIG["THREAD_MODEL"] = "pthread"
234 CONFIG["MAKEFILES"] = "Makefile"
235 CONFIG["arch"] = "#{NEW_RUBY_PLATFORM}"
236 CONFIG["sitearch"] = "#{NEW_RUBY_PLATFORM}"
237 CONFIG["sitedir"] = "$(libdir)/ruby/site_ruby"
238 CONFIG["vendordir"] = "$(prefix)/lib/ruby/vendor_ruby"
239 CONFIG["configure_args"] = ""
240 CONFIG["rubyhdrdir"] = "$(includedir)/ruby-$(MAJOR).$(MINOR).$(TEENY)"
241 CONFIG["sitehdrdir"] = "$(rubyhdrdir)/site_ruby"
242 CONFIG["vendorhdrdir"] = "$(rubyhdrdir)/vendor_ruby"
243 CONFIG["NROFF"] = "/usr/bin/nroff"
244 CONFIG["MANTYPE"] = "doc"
245 CONFIG["ruby_version"] = "$(MAJOR).$(MINOR).$(TEENY)"
246 CONFIG["rubylibdir"] = "$(libdir)/ruby/$(ruby_version)"
247 CONFIG["archdir"] = "$(rubylibdir)/$(arch)"
248 CONFIG["sitelibdir"] = "$(sitedir)/$(ruby_version)"
249 CONFIG["sitearchdir"] = "$(sitelibdir)/$(sitearch)"
250 CONFIG["vendorlibdir"] = "$(vendordir)/$(ruby_version)"
251 CONFIG["vendorarchdir"] = "$(vendorlibdir)/$(sitearch)"
252 CONFIG["topdir"] = File.dirname(__FILE__)
253 MAKEFILE_CONFIG = {}
254 CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
255 def RbConfig::expand(val, config = CONFIG)
256 val.gsub!(/\\$\\$|\\$\\(([^()]+)\\)|\\$\\{([^{}]+)\\}/) do
257 var = $&
258 if !(v = $1 || $2)
259 '$'
260 elsif key = config[v = v[/\\A[^:]+(?=(?::(.*?)=(.*))?\\z)/]]
261 pat, sub = $1, $2
262 config[v] = false
263 RbConfig::expand(key, config)
264 config[v] = key
265 key = key.gsub(/\#{Regexp.quote(pat)}(?=\\s|\\z)/n) {sub} if pat
266 key
267 else
268 var
269 end
270 end
271 val
272 end
273 CONFIG.each_value do |val|
274 RbConfig::expand(val)
275 end
276 end
277 Config = RbConfig # compatibility for ruby-1.8.4 and older.
278 CROSS_COMPILING = nil
279 RUBY_FRAMEWORK = true
280 RUBY_FRAMEWORK_VERSION = RbConfig::CONFIG['ruby_version']
281 EOS
282 if !File.exist?('rbconfig.rb') or File.read('rbconfig.rb') != rbconfig
283 File.open('rbconfig.rb', 'w') { |io| io.print rbconfig }
284 end
285 end
286
287 namespace :macruby do
288 desc "Build dynamic libraries for MacRuby"
289 task :dylib => [:rbconfig, :miniruby] do
8c5a2dd let's go further miniruby
Laurent Sansonetti authored
290 =begin
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
291 sh("./miniruby -I. -I./lib -rrbconfig tool/compile_prelude.rb prelude.rb gem_prelude.rb prelude.c.new")
292 if !File.exist?('prelude.c') or File.read('prelude.c') != File.read('prelude.c.new')
293 mv('prelude.c.new', 'prelude.c')
294 $builder.build(['prelude'])
295 else
296 rm('prelude.c.new')
297 end
8c5a2dd let's go further miniruby
Laurent Sansonetti authored
298 =end
299 cp('miniprelude.c', 'prelude.c')
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
300 dylib = "lib#{RUBY_SO_NAME}.#{NEW_RUBY_VERSION}.dylib"
301 $builder.link_dylib(dylib, $builder.objs - ['main', 'gc-stub', 'miniprelude'])
302 major, minor, teeny = NEW_RUBY_VERSION.scan(/\d+/)
303 ["lib#{RUBY_SO_NAME}.#{major}.#{minor}.dylib", "lib#{RUBY_SO_NAME}.dylib"].each do |dylib_alias|
304 if !File.exist?(dylib_alias) or File.readlink(dylib_alias) != dylib
305 rm_f(dylib_alias)
306 ln_s(dylib, dylib_alias)
307 end
308 end
309 end
310
311 desc "Build static libraries for MacRuby"
312 task :static => :dylib do
313 $builder.link_archive("lib#{RUBY_SO_NAME}-static.a", $builder.objs - ['main', 'gc-stub', 'miniprelude'])
314 end
315
316 desc "Build MacRuby"
317 task :build => :dylib do
318 $builder.link_executable(RUBY_INSTALL_NAME, ['main', 'gc-stub'], "-L. -l#{RUBY_SO_NAME} -lobjc")
319 end
320 end
321
322 DESTDIR = (ENV['DESTDIR'] or "")
323 EXTOUT = (ENV['EXTOUT'] or ".ext")
324 INSTALLED_LIST = '.installed.list'
325 SCRIPT_ARGS = "--make=\"/usr/bin/make\" --dest-dir=\"#{DESTDIR}\" --extout=\"#{EXTOUT}\" --mflags=\"\" --make-flags=\"\""
326 EXTMK_ARGS = "#{SCRIPT_ARGS} --extension --extstatic"
327 INSTRUBY_ARGS = "#{SCRIPT_ARGS} --data-mode=0644 --prog-mode=0755 --installed-list #{INSTALLED_LIST} --mantype=\"doc\" --sym-dest-dir=\"#{SYM_INSTDIR}\""
328
86042c6 adding preliminary support for sockets
Laurent Sansonetti authored
329 EXTENSIONS = ['ripper', 'digest', 'etc', 'readline', 'libyaml', 'fcntl', 'socket', 'zlib']
1f30d04 better code path to deal with extensions
Laurent Sansonetti authored
330 def perform_extensions_target(target)
331 EXTENSIONS.map { |x| File.join('ext', x) }.each do |ext_dir|
332 Dir.glob(File.join(ext_dir, '**/extconf.rb')) do |p|
333 dir = File.dirname(p)
334 Dir.chdir(dir) do
030c32b fixed rbconfig.rb to never mention libmacruby-static, reverted TRY_LINK
Laurent Sansonetti authored
335 $stderr.puts "cd #{dir}"
1f30d04 better code path to deal with extensions
Laurent Sansonetti authored
336 srcdir = File.join(*dir.split(File::SEPARATOR).map { |x| '..' })
63d8310 better fix
Laurent Sansonetti authored
337 next if target == :clean and !File.exist?('Makefile')
338 if !File.exist?('Makefile') or File.mtime('extconf.rb') > File.mtime('Makefile')
abe901c more extension build fixes
Laurent Sansonetti authored
339 sh "#{srcdir}/miniruby -I#{srcdir} -I#{srcdir}/lib -r rbconfig -e \"RbConfig::CONFIG['libdir'] = '#{srcdir}'; require './extconf.rb'\""
1f30d04 better code path to deal with extensions
Laurent Sansonetti authored
340 end
0cd758f adding a new optimized Array for default allocations plus various opt…
Laurent Sansonetti authored
341 line = "/usr/bin/make top_srcdir=#{srcdir} ruby=\"#{srcdir}/miniruby -I#{srcdir} -I#{srcdir}/lib\" extout=#{srcdir}/.ext hdrdir=#{srcdir}/include arch_hdrdir=#{srcdir}/include"
1f30d04 better code path to deal with extensions
Laurent Sansonetti authored
342 case target
343 when :all
344 line << " libdir=#{srcdir}"
345 else
0bc95cf fixed rbconfig.rb to use absolute paths + fixed TRY_LINK to use g++, …
Laurent Sansonetti authored
346 line << " #{target}"
1f30d04 better code path to deal with extensions
Laurent Sansonetti authored
347 end
348 sh line
0bc95cf fixed rbconfig.rb to use absolute paths + fixed TRY_LINK to use g++, …
Laurent Sansonetti authored
349 rm_f 'Makefile' if target == :clean
1f30d04 better code path to deal with extensions
Laurent Sansonetti authored
350 end
351 end
352 end
353 end
354
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
355 desc "Build extensions"
356 task :extensions => [:miniruby, "macruby:static"] do
8c5a2dd let's go further miniruby
Laurent Sansonetti authored
357 =begin
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
358 sh "./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb ext/extmk.rb #{EXTMK_ARGS}"
8c5a2dd let's go further miniruby
Laurent Sansonetti authored
359 =end
1f30d04 better code path to deal with extensions
Laurent Sansonetti authored
360 perform_extensions_target(:all)
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
361 end
362
28d81c6 added a bunch of stdlib files to the aot list
Laurent Sansonetti authored
363 AOT_STDLIB = [
364 'rbconfig.rb',
365 'lib/date.rb',
366 'lib/date/**/*.rb',
70e1800 added erb to the aot list
Laurent Sansonetti authored
367 'lib/erb.rb',
28d81c6 added a bunch of stdlib files to the aot list
Laurent Sansonetti authored
368 'lib/fileutils.rb',
369 'lib/irb.rb',
370 'lib/irb/**/*.rb',
4f163cb add all net/* libraries to the aot list
Laurent Sansonetti authored
371 'lib/net/**/*.rb',
28d81c6 added a bunch of stdlib files to the aot list
Laurent Sansonetti authored
372 'lib/optparse.rb',
373 #'lib/stringio.rb', #spec fails
53c50f1 now AOT compiling rubygems
Laurent Sansonetti authored
374 'lib/rubygems.rb',
375 'lib/rubygems/**/*.rb',
28d81c6 added a bunch of stdlib files to the aot list
Laurent Sansonetti authored
376 'lib/thread.rb',
377 'lib/time.rb',
378 'lib/timeout.rb',
764c005 forgot uri.rb
Laurent Sansonetti authored
379 'lib/uri.rb',
28d81c6 added a bunch of stdlib files to the aot list
Laurent Sansonetti authored
380 'lib/uri/**/*.rb',
381 'lib/yaml.rb',
382 'lib/yaml/rubytypes.rb',
383 ]
3ae269b move the AOT compilation of the stdlib into the main build task, intr…
Laurent Sansonetti authored
384 desc "AOT compile parts of the stdlib"
7937d64 fix build
Laurent Sansonetti authored
385 task :aot_compile_stdlib => [:miniruby, 'macruby:dylib'] do
3ae269b move the AOT compilation of the stdlib into the main build task, intr…
Laurent Sansonetti authored
386 AOT_STDLIB.each do |pat|
387 Dir.glob(pat).each do |path|
388 out = File.join(File.dirname(path), File.basename(path, '.rb') + '.rbo')
389 if !File.exist?(out) or File.mtime(path) > File.mtime(out) or File.mtime('./miniruby') > File.mtime(out)
390 sh "./miniruby -I. -I./lib bin/rubyc --internal -C \"#{path}\" -o \"#{out}\""
391 end
392 end
393 end
394 end
395
0bc95cf fixed rbconfig.rb to use absolute paths + fixed TRY_LINK to use g++, …
Laurent Sansonetti authored
396 desc "Same as extensions"
397 task :ext => 'extensions'
398
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
399 namespace :framework do
400 desc "Create the plist file for the framework"
401 task :info_plist do
402 plist = <<EOS
403 <?xml version="1.0" encoding="UTF-8"?>
404 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
405 <plist version="1.0">
406 <dict>
407 <key>CFBundleDevelopmentRegion</key>
408 <string>English</string>
409 <key>CFBundleExecutable</key>
410 <string>Ruby</string>
411 <key>CFBundleName</key>
412 <string>Ruby</string>
413 <key>CFBundleGetInfoString</key>
414 <string>MacRuby Runtime and Library</string>
415 <key>CFBundleIconFile</key>
416 <string></string>
417 <key>CFBundleIdentifier</key>
418 <string>com.apple.macruby</string>
419 <key>CFBundleInfoDictionaryVersion</key>
420 <string>#{MACRUBY_VERSION}</string>
421 <key>CFBundlePackageType</key>
422 <string>FMWK</string>
423 <key>CFBundleShortVersionString</key>
424 <string>#{MACRUBY_VERSION}</string>
425 <key>CFBundleSignature</key>
426 <string>????</string>
427 <key>CFBundleVersion</key>
428 <string>MacRuby-#{MACRUBY_VERSION}</string>
429 <key>NSPrincipalClass</key>
430 <string></string>
431 </dict>
432 </plist>
433 EOS
434 File.open('framework/Info.plist', 'w') { |io| io.print plist }
435 end
436
108e7c1 added a framework:install_ext task that only installs extensions
Laurent Sansonetti authored
437 desc "Install the extensions"
438 task :install_ext do
1f30d04 better code path to deal with extensions
Laurent Sansonetti authored
439 perform_extensions_target(:install)
108e7c1 added a framework:install_ext task that only installs extensions
Laurent Sansonetti authored
440 end
441
442 desc "Install the framework"
443 task :install => [:info_plist, :install_ext] do
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
444 sh "./miniruby instruby.rb #{INSTRUBY_ARGS}"
445 end
446 end
447
448 namespace :clean do
449 desc "Clean local build files"
450 task :local do
451 $builder.clean
69528db fixed the clean task to remove binary build producfs too
Laurent Sansonetti authored
452 list = ['parse.c', 'lex.c', INSTALLED_LIST, 'Makefile', RUBY_INSTALL_NAME, 'miniruby']
453 list.concat(Dir['*.inc'])
454 list.concat(Dir['lib*.{dylib,a}'])
455 list.each { |x| rm_f(x) }
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
456 end
457
6b57493 added a task to delete the .rbo files
Laurent Sansonetti authored
458 desc "Clean .rbo build files"
459 task :rbo do
460 list = []
461 list.concat(Dir['*.rbo'])
462 list.concat(Dir['lib/**/*.rbo'])
463 list.each { |x| rm_f(x) }
464 end
465
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
466 desc "Clean extension build files"
467 task :ext do
8c5a2dd let's go further miniruby
Laurent Sansonetti authored
468 =begin
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
469 if File.exist?('./miniruby')
470 sh "./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb ext/extmk.rb #{EXTMK_ARGS} -- clean"
471 end
8c5a2dd let's go further miniruby
Laurent Sansonetti authored
472 =end
0bc95cf fixed rbconfig.rb to use absolute paths + fixed TRY_LINK to use g++, …
Laurent Sansonetti authored
473 perform_extensions_target(:clean)
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
474 end
b0f57d9 blocked the rake all/install tasks for now
Laurent Sansonetti authored
475 end
Something went wrong with that request. Please try again.