Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing some basic issues

Fixing bin/rubyc to set the extension to .cc instead of .c so that clang++ stops complaining about compiling .c as c++.
Fixing :static to compile the plblockimp into the .static-objs dir.
Making the builder/options.rb smarter about selecting -stdlib=libc++
  • Loading branch information...
commit d1821591d536c0140037c4f8bb850063de25a045 1 parent 6e73329
@ashgti authored
View
4 bin/rubyc
@@ -258,7 +258,7 @@ extern "C" {
EOS
# Build.
- main = gen_tmpfile('main', 'c')
+ main = gen_tmpfile('main', 'cc')
File.open(main, 'w') { |io| io.write(main_txt) }
linkf = @internal ? "-L. -lmacruby" : "-L#{RbConfig::CONFIG['libdir']} -lmacruby"
execute("#{@gcxx} \"#{main}\" -fexceptions -dynamic -bundle -undefined suppress -flat_namespace #{arch_flags} #{linkf} \"#{obj}\" -o \"#{output}\"")
@@ -284,7 +284,7 @@ EOS
main_txt << "}}"
# Build.
- main = gen_tmpfile('main', 'c')
+ main = gen_tmpfile('main', 'cc')
File.open(main, 'w') { |io| io.write(main_txt) }
@linkf << @internal ? "-L. -lmacruby" : "-L#{RbConfig::CONFIG['libdir']} -lmacruby"
objs = objs_data.map { |obj, f| "\"#{obj}\"" }.join(' ')
View
2  rakelib/builder.rake
@@ -158,6 +158,8 @@ namespace :macruby do
task :static => :files do
if ENABLE_STATIC_LIBRARY
$builder.config = STATIC_CONFIG
+ Rake::Task['plblockimp'].reenable
+ Rake::Task['plblockimp'].invoke
build_objects
$builder.link_archive("lib#{RUBY_SO_NAME}-static.a", $builder.objs - ['main', 'gc-stub'] + ['plblockimp'])
end
View
5 rakelib/builder/options.rb
@@ -162,8 +162,9 @@ def initialize(opt)
has_libauto = sdk ? File.exist?("#{sdk}/usr/lib/libauto.dylib") : true
archflags = archs.map { |x| "-arch #{x}" }.join(' ')
@cflags = "-std=c99 -I. -I./include -pipe -fno-common -fexceptions -fblocks -fwrapv -g -O#{OPTZ_LEVEL} -Wall -Wno-deprecated-declarations -Werror #{archflags} #{EXTRA_CFLAGS}"
- @cxxflags = "-std=c++11 -stdlib=libc++ -I. -I./include -fblocks -g -Wall -Wno-deprecated-declarations -Werror #{archflags} #{EXTRA_CFLAGS}"
- @ldflags = '-lpthread -stdlib=libc++ -ldl -lxml2 -lobjc -licucore -framework Foundation'
+ @cxxflags = "-std=c++11 -I. -I./include -fblocks -g -Wall -Wno-deprecated-declarations -Werror #{archflags} #{EXTRA_CFLAGS}"
+ @ldflags = '-lpthread -ldl -lxml2 -lobjc -licucore -framework Foundation'
+ @ldflags << ' -stdlib=libc++' if system("#{LLVM_CONFIG} --cxxflags | grep 'stdlib=libc++' >& /dev/null")
@ldflags << " -lauto" if has_libauto
if opt.delete(:static)
@cflags << ' -DMACRUBY_STATIC'
Please sign in to comment.
Something went wrong with that request. Please try again.