mini_racer-csim 0.21.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,75 @@
1
+ require 'mkmf'
2
+
3
+ $srcs = ["mini_racer_extension.c", "mini_racer_v8.cc"]
4
+
5
+ if RUBY_ENGINE == "truffleruby"
6
+ File.write("Makefile", dummy_makefile($srcdir).join(""))
7
+ return
8
+ end
9
+
10
+ require_relative '../../lib/mini_racer/version'
11
+ gem 'libv8-node', MiniRacer::LIBV8_NODE_VERSION
12
+ require 'libv8-node'
13
+
14
+ IS_DARWIN = RUBY_PLATFORM =~ /darwin/
15
+
16
+ have_library('pthread')
17
+ have_library('objc') if IS_DARWIN
18
+ $CXXFLAGS += " -Wall" unless $CXXFLAGS.split.include? "-Wall"
19
+ $CXXFLAGS += " -g" unless $CXXFLAGS.split.include? "-g"
20
+ $CXXFLAGS += " -rdynamic" unless $CXXFLAGS.split.include? "-rdynamic"
21
+ $CXXFLAGS += " -fPIC" unless $CXXFLAGS.split.include? "-rdynamic" or IS_DARWIN
22
+ $CXXFLAGS += " -std=c++20"
23
+ $CXXFLAGS += " -fpermissive"
24
+ $CXXFLAGS += " -fno-rtti"
25
+ $CXXFLAGS += " -fno-exceptions"
26
+ $CXXFLAGS += " -fno-strict-aliasing"
27
+ #$CXXFLAGS += " -DV8_COMPRESS_POINTERS"
28
+ $CXXFLAGS += " -fvisibility=hidden "
29
+
30
+ # __declspec gets used by clang via ruby 3.x headers...
31
+ $CXXFLAGS += " -fms-extensions"
32
+
33
+ $CXXFLAGS += " -Wno-reserved-user-defined-literal" if IS_DARWIN
34
+
35
+ if IS_DARWIN
36
+ $LDFLAGS.insert(0, " -stdlib=libc++ ")
37
+ else
38
+ $LDFLAGS.insert(0, " -lstdc++ ")
39
+ end
40
+
41
+ # check for missing symbols at link time
42
+ # $LDFLAGS += " -Wl,--no-undefined " unless IS_DARWIN
43
+ # $LDFLAGS += " -Wl,-undefined,error " if IS_DARWIN
44
+
45
+ if ENV['CXX']
46
+ puts "SETTING CXX"
47
+ CONFIG['CXX'] = ENV['CXX']
48
+ end
49
+
50
+ CONFIG['LDSHARED'] = '$(CXX) -shared' unless IS_DARWIN
51
+ if CONFIG['warnflags']
52
+ CONFIG['warnflags'].gsub!('-Wdeclaration-after-statement', '')
53
+ CONFIG['warnflags'].gsub!('-Wimplicit-function-declaration', '')
54
+ end
55
+
56
+ if enable_config('debug') || enable_config('asan')
57
+ CONFIG['debugflags'] << ' -ggdb3 -O0'
58
+ end
59
+
60
+ Libv8::Node.configure_makefile
61
+
62
+ # --exclude-libs is only for i386 PE and ELF targeted ports
63
+ append_ldflags("-Wl,--exclude-libs=ALL ")
64
+
65
+ if enable_config('asan')
66
+ $CXXFLAGS.insert(0, " -fsanitize=address ")
67
+ $LDFLAGS.insert(0, " -fsanitize=address ")
68
+ end
69
+
70
+ # there doesn't seem to be a CPP macro for this in Ruby 2.6:
71
+ if RUBY_ENGINE == 'ruby'
72
+ $CPPFLAGS += ' -DENGINE_IS_CRUBY '
73
+ end
74
+
75
+ create_makefile 'mini_racer_extension'