mirror of
https://github.com/rubyjs/mini_racer
synced 2023-03-27 23:21:28 -04:00

According to Apple, projects should be migrated to libc++[1]: > Building with libstdc++ was deprecated with Xcode 8 and is not supported in > Xcode 10 when targeting iOS. C++ projects must now migrate to libc++ and are > recommended to set a deployment target of macOS 10.9 or later, or iOS 7 or > later. Besides changing the C++ Standard Library build setting, developers > should audit hard-coded linker flags and target dependencies to remove > references to libstdc++ (including -lstdc++, -lstdc++.6.0.9, > libstdc++.6.0.9.tbd, and libstdc++.6.0.9.dylib). Project dependencies such as > static archives that were built against libstdc++ will also need to be rebuilt > against libc++. (40885260) [1] https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes
58 lines
1.6 KiB
Ruby
58 lines
1.6 KiB
Ruby
require 'mkmf'
|
|
require 'libv8'
|
|
|
|
IS_DARWIN = RUBY_PLATFORM =~ /darwin/
|
|
|
|
have_library('pthread')
|
|
have_library('objc') if IS_DARWIN
|
|
$CPPFLAGS += " -Wall" unless $CPPFLAGS.split.include? "-Wall"
|
|
$CPPFLAGS += " -g" unless $CPPFLAGS.split.include? "-g"
|
|
$CPPFLAGS += " -rdynamic" unless $CPPFLAGS.split.include? "-rdynamic"
|
|
$CPPFLAGS += " -fPIC" unless $CPPFLAGS.split.include? "-rdynamic" or IS_DARWIN
|
|
$CPPFLAGS += " -std=c++0x"
|
|
$CPPFLAGS += " -fpermissive"
|
|
|
|
$CPPFLAGS += " -Wno-reserved-user-defined-literal" if IS_DARWIN
|
|
|
|
$LDFLAGS.insert(0, " -stdlib=libc++ ") if IS_DARWIN
|
|
|
|
if ENV['CXX']
|
|
puts "SETTING CXX"
|
|
CONFIG['CXX'] = ENV['CXX']
|
|
end
|
|
|
|
CXX11_TEST = <<EOS
|
|
#if __cplusplus <= 199711L
|
|
# error A compiler that supports at least C++11 is required in order to compile this project.
|
|
#endif
|
|
EOS
|
|
|
|
`echo "#{CXX11_TEST}" | #{CONFIG['CXX']} -std=c++0x -x c++ -E -`
|
|
unless $?.success?
|
|
warn <<EOS
|
|
|
|
|
|
WARNING: C++11 support is required for compiling mini_racer. Please make sure
|
|
you are using a compiler that supports at least C++11. Examples of such
|
|
compilers are GCC 4.7+ and Clang 3.2+.
|
|
|
|
If you are using Travis, consider either migrating your build to Ubuntu Trusty or
|
|
installing GCC 4.8. See mini_racer's README.md for more information.
|
|
|
|
|
|
EOS
|
|
end
|
|
|
|
CONFIG['LDSHARED'] = '$(CXX) -shared' unless IS_DARWIN
|
|
if CONFIG['warnflags']
|
|
CONFIG['warnflags'].gsub!('-Wdeclaration-after-statement', '')
|
|
CONFIG['warnflags'].gsub!('-Wimplicit-function-declaration', '')
|
|
end
|
|
|
|
if enable_config('debug')
|
|
CONFIG['debugflags'] << ' -ggdb3 -O0'
|
|
end
|
|
|
|
Libv8.configure_makefile
|
|
|
|
create_makefile 'mini_racer_extension'
|