Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 499 lines (466 sloc) 17.344 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)"
688ff6a rubyc shouldn't use llvm-config
Laurent Sansonetti authored
222 CONFIG["LIBRUBYARG_STATIC_REALLY"] = "-l$(RUBY_SO_NAME)-static #{LDFLAGS}"
030c32b fixed rbconfig.rb to never mention libmacruby-static, reverted TRY_LINK
Laurent Sansonetti authored
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)"
90c419f introduced LLVM_PATH as a rake argument and rbconfig setting, changed…
Laurent Sansonetti authored
252 CONFIG["LLVM_PATH"] = "#{LLVM_PATH}"
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
253 CONFIG["topdir"] = File.dirname(__FILE__)
254 MAKEFILE_CONFIG = {}
255 CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
256 def RbConfig::expand(val, config = CONFIG)
257 val.gsub!(/\\$\\$|\\$\\(([^()]+)\\)|\\$\\{([^{}]+)\\}/) do
258 var = $&
259 if !(v = $1 || $2)
260 '$'
261 elsif key = config[v = v[/\\A[^:]+(?=(?::(.*?)=(.*))?\\z)/]]
262 pat, sub = $1, $2
263 config[v] = false
264 RbConfig::expand(key, config)
265 config[v] = key
266 key = key.gsub(/\#{Regexp.quote(pat)}(?=\\s|\\z)/n) {sub} if pat
267 key
268 else
269 var
270 end
271 end
272 val
273 end
274 CONFIG.each_value do |val|
275 RbConfig::expand(val)
276 end
277 end
278 Config = RbConfig # compatibility for ruby-1.8.4 and older.
279 CROSS_COMPILING = nil
280 RUBY_FRAMEWORK = true
281 RUBY_FRAMEWORK_VERSION = RbConfig::CONFIG['ruby_version']
282 EOS
283 if !File.exist?('rbconfig.rb') or File.read('rbconfig.rb') != rbconfig
284 File.open('rbconfig.rb', 'w') { |io| io.print rbconfig }
285 end
286 end
287
288 namespace :macruby do
289 desc "Build dynamic libraries for MacRuby"
290 task :dylib => [:rbconfig, :miniruby] do
8c5a2dd let's go further miniruby
Laurent Sansonetti authored
291 =begin
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
292 sh("./miniruby -I. -I./lib -rrbconfig tool/compile_prelude.rb prelude.rb gem_prelude.rb prelude.c.new")
293 if !File.exist?('prelude.c') or File.read('prelude.c') != File.read('prelude.c.new')
294 mv('prelude.c.new', 'prelude.c')
295 $builder.build(['prelude'])
296 else
297 rm('prelude.c.new')
298 end
8c5a2dd let's go further miniruby
Laurent Sansonetti authored
299 =end
300 cp('miniprelude.c', 'prelude.c')
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
301 dylib = "lib#{RUBY_SO_NAME}.#{NEW_RUBY_VERSION}.dylib"
302 $builder.link_dylib(dylib, $builder.objs - ['main', 'gc-stub', 'miniprelude'])
303 major, minor, teeny = NEW_RUBY_VERSION.scan(/\d+/)
304 ["lib#{RUBY_SO_NAME}.#{major}.#{minor}.dylib", "lib#{RUBY_SO_NAME}.dylib"].each do |dylib_alias|
305 if !File.exist?(dylib_alias) or File.readlink(dylib_alias) != dylib
306 rm_f(dylib_alias)
307 ln_s(dylib, dylib_alias)
308 end
309 end
310 end
311
312 desc "Build static libraries for MacRuby"
313 task :static => :dylib do
314 $builder.link_archive("lib#{RUBY_SO_NAME}-static.a", $builder.objs - ['main', 'gc-stub', 'miniprelude'])
315 end
316
317 desc "Build MacRuby"
318 task :build => :dylib do
319 $builder.link_executable(RUBY_INSTALL_NAME, ['main', 'gc-stub'], "-L. -l#{RUBY_SO_NAME} -lobjc")
320 end
321 end
322
323 DESTDIR = (ENV['DESTDIR'] or "")
324 EXTOUT = (ENV['EXTOUT'] or ".ext")
325 INSTALLED_LIST = '.installed.list'
326 SCRIPT_ARGS = "--make=\"/usr/bin/make\" --dest-dir=\"#{DESTDIR}\" --extout=\"#{EXTOUT}\" --mflags=\"\" --make-flags=\"\""
327 EXTMK_ARGS = "#{SCRIPT_ARGS} --extension --extstatic"
43a7ba7 now generating and installing RDoc ri files
Laurent Sansonetti authored
328 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
329
161f41d @psychs JSON support based on YAJL
psychs authored
330 EXTENSIONS = ['ripper', 'digest', 'etc', 'readline', 'libyaml', 'fcntl', 'socket', 'zlib', 'bigdecimal', 'openssl', 'json'].sort
1f30d04 better code path to deal with extensions
Laurent Sansonetti authored
331 def perform_extensions_target(target)
332 EXTENSIONS.map { |x| File.join('ext', x) }.each do |ext_dir|
333 Dir.glob(File.join(ext_dir, '**/extconf.rb')) do |p|
334 dir = File.dirname(p)
335 Dir.chdir(dir) do
030c32b fixed rbconfig.rb to never mention libmacruby-static, reverted TRY_LINK
Laurent Sansonetti authored
336 $stderr.puts "cd #{dir}"
1f30d04 better code path to deal with extensions
Laurent Sansonetti authored
337 srcdir = File.join(*dir.split(File::SEPARATOR).map { |x| '..' })
63d8310 better fix
Laurent Sansonetti authored
338 next if target == :clean and !File.exist?('Makefile')
339 if !File.exist?('Makefile') or File.mtime('extconf.rb') > File.mtime('Makefile')
abe901c more extension build fixes
Laurent Sansonetti authored
340 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
341 end
0cd758f adding a new optimized Array for default allocations plus various opt…
Laurent Sansonetti authored
342 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
343 case target
344 when :all
345 line << " libdir=#{srcdir}"
346 else
0bc95cf fixed rbconfig.rb to use absolute paths + fixed TRY_LINK to use g++, …
Laurent Sansonetti authored
347 line << " #{target}"
1f30d04 better code path to deal with extensions
Laurent Sansonetti authored
348 end
349 sh line
0bc95cf fixed rbconfig.rb to use absolute paths + fixed TRY_LINK to use g++, …
Laurent Sansonetti authored
350 rm_f 'Makefile' if target == :clean
1f30d04 better code path to deal with extensions
Laurent Sansonetti authored
351 end
352 end
353 end
354 end
355
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
356 desc "Build extensions"
357 task :extensions => [:miniruby, "macruby:static"] do
8c5a2dd let's go further miniruby
Laurent Sansonetti authored
358 =begin
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
359 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
360 =end
1f30d04 better code path to deal with extensions
Laurent Sansonetti authored
361 perform_extensions_target(:all)
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
362 end
363
43a7ba7 now generating and installing RDoc ri files
Laurent Sansonetti authored
364 desc "Generate RDoc files"
365 task :doc => [:macruby, :extensions] do
366 doc_op = './doc'
367 unless File.exist?(doc_op)
368 sh "DYLD_LIBRARY_PATH=. ./macruby -I. -I./lib -I./ext/libyaml -I./ext/etc bin/rdoc --ri --op \"#{doc_op}\""
369 end
370 end
371
28d81c6 added a bunch of stdlib files to the aot list
Laurent Sansonetti authored
372 AOT_STDLIB = [
373 'rbconfig.rb',
374 'lib/date.rb',
375 'lib/date/**/*.rb',
70e1800 added erb to the aot list
Laurent Sansonetti authored
376 'lib/erb.rb',
28d81c6 added a bunch of stdlib files to the aot list
Laurent Sansonetti authored
377 'lib/fileutils.rb',
378 'lib/irb.rb',
379 'lib/irb/**/*.rb',
4f163cb add all net/* libraries to the aot list
Laurent Sansonetti authored
380 'lib/net/**/*.rb',
28d81c6 added a bunch of stdlib files to the aot list
Laurent Sansonetti authored
381 'lib/optparse.rb',
382 #'lib/stringio.rb', #spec fails
53c50f1 now AOT compiling rubygems
Laurent Sansonetti authored
383 'lib/rubygems.rb',
384 'lib/rubygems/**/*.rb',
28d81c6 added a bunch of stdlib files to the aot list
Laurent Sansonetti authored
385 'lib/thread.rb',
386 'lib/time.rb',
387 'lib/timeout.rb',
764c005 forgot uri.rb
Laurent Sansonetti authored
388 'lib/uri.rb',
28d81c6 added a bunch of stdlib files to the aot list
Laurent Sansonetti authored
389 'lib/uri/**/*.rb',
390 'lib/yaml.rb',
391 'lib/yaml/rubytypes.rb',
392 ]
96df0a7 aot_compile_stdlib becomes stdlib:build + added stdlib:touch for lazy…
Laurent Sansonetti authored
393 namespace :stdlib do
394 desc "AOT compile the stdlib"
395 task :build => [:miniruby, 'macruby:dylib'] do
396 AOT_STDLIB.each do |pat|
397 Dir.glob(pat).each do |path|
398 out = File.join(File.dirname(path), File.basename(path, '.rb') + '.rbo')
399 if !File.exist?(out) or File.mtime(path) > File.mtime(out) or File.mtime('./miniruby') > File.mtime(out)
400 archf = ARCHS.map { |x| "--arch #{x}" }.join(' ')
401 sh "./miniruby -I. -I./lib bin/rubyc --internal #{archf} -C \"#{path}\" -o \"#{out}\""
402 end
3ae269b move the AOT compilation of the stdlib into the main build task, intr…
Laurent Sansonetti authored
403 end
404 end
96df0a7 aot_compile_stdlib becomes stdlib:build + added stdlib:touch for lazy…
Laurent Sansonetti authored
405 end
406
407 desc "Touch .rbo files to ignore their build"
408 task :touch do
409 files = ["*.rbo", "lib/**/*.rbo"]
7ee9a50 oops
Laurent Sansonetti authored
410 files.map { |pat| Dir.glob(pat) }.flatten.each { |p| sh "/usr/bin/touch #{p}" }
96df0a7 aot_compile_stdlib becomes stdlib:build + added stdlib:touch for lazy…
Laurent Sansonetti authored
411 end
3ae269b move the AOT compilation of the stdlib into the main build task, intr…
Laurent Sansonetti authored
412 end
413
0bc95cf fixed rbconfig.rb to use absolute paths + fixed TRY_LINK to use g++, …
Laurent Sansonetti authored
414 desc "Same as extensions"
415 task :ext => 'extensions'
416
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
417 namespace :framework do
418 desc "Create the plist file for the framework"
419 task :info_plist do
420 plist = <<EOS
421 <?xml version="1.0" encoding="UTF-8"?>
422 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
423 <plist version="1.0">
424 <dict>
425 <key>CFBundleDevelopmentRegion</key>
426 <string>English</string>
427 <key>CFBundleExecutable</key>
428 <string>Ruby</string>
429 <key>CFBundleName</key>
430 <string>Ruby</string>
431 <key>CFBundleGetInfoString</key>
432 <string>MacRuby Runtime and Library</string>
433 <key>CFBundleIconFile</key>
434 <string></string>
435 <key>CFBundleIdentifier</key>
436 <string>com.apple.macruby</string>
437 <key>CFBundleInfoDictionaryVersion</key>
438 <string>#{MACRUBY_VERSION}</string>
439 <key>CFBundlePackageType</key>
440 <string>FMWK</string>
441 <key>CFBundleShortVersionString</key>
442 <string>#{MACRUBY_VERSION}</string>
443 <key>CFBundleSignature</key>
444 <string>????</string>
445 <key>CFBundleVersion</key>
446 <string>MacRuby-#{MACRUBY_VERSION}</string>
447 <key>NSPrincipalClass</key>
448 <string></string>
449 </dict>
450 </plist>
451 EOS
452 File.open('framework/Info.plist', 'w') { |io| io.print plist }
453 end
454
108e7c1 added a framework:install_ext task that only installs extensions
Laurent Sansonetti authored
455 desc "Install the extensions"
456 task :install_ext do
1f30d04 better code path to deal with extensions
Laurent Sansonetti authored
457 perform_extensions_target(:install)
108e7c1 added a framework:install_ext task that only installs extensions
Laurent Sansonetti authored
458 end
459
460 desc "Install the framework"
461 task :install => [:info_plist, :install_ext] do
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
462 sh "./miniruby instruby.rb #{INSTRUBY_ARGS}"
463 end
464 end
465
466 namespace :clean do
467 desc "Clean local build files"
468 task :local do
469 $builder.clean
69528db fixed the clean task to remove binary build producfs too
Laurent Sansonetti authored
470 list = ['parse.c', 'lex.c', INSTALLED_LIST, 'Makefile', RUBY_INSTALL_NAME, 'miniruby']
471 list.concat(Dir['*.inc'])
472 list.concat(Dir['lib*.{dylib,a}'])
473 list.each { |x| rm_f(x) }
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
474 end
475
6b57493 added a task to delete the .rbo files
Laurent Sansonetti authored
476 desc "Clean .rbo build files"
477 task :rbo do
478 list = []
479 list.concat(Dir['*.rbo'])
480 list.concat(Dir['lib/**/*.rbo'])
481 list.each { |x| rm_f(x) }
482 end
483
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
484 desc "Clean extension build files"
485 task :ext do
8c5a2dd let's go further miniruby
Laurent Sansonetti authored
486 =begin
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
487 if File.exist?('./miniruby')
488 sh "./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb ext/extmk.rb #{EXTMK_ARGS} -- clean"
489 end
8c5a2dd let's go further miniruby
Laurent Sansonetti authored
490 =end
0bc95cf fixed rbconfig.rb to use absolute paths + fixed TRY_LINK to use g++, …
Laurent Sansonetti authored
491 perform_extensions_target(:clean)
6d571b4 @alloy Moved guts of the code in Rakefile into seperate files in rakelib.
alloy authored
492 end
43a7ba7 now generating and installing RDoc ri files
Laurent Sansonetti authored
493
494 desc "Clean the RDoc files"
495 task :doc do
496 rm_rf('doc')
497 end
b0f57d9 blocked the rake all/install tasks for now
Laurent Sansonetti authored
498 end
Something went wrong with that request. Please try again.