File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,32 @@ module Mkmf
8
8
# @param target [String]
9
9
# @param srcprefix [String,nil]
10
10
def create_go_makefile ( target , srcprefix = nil )
11
+ find_executable ( "go" )
12
+
13
+ # rubocop:disable Style/GlobalVars
14
+ $objs = [ ]
15
+ def $objs. empty? ; false ; end
16
+ # rubocop:enable Style/GlobalVars
17
+
11
18
create_makefile ( target , srcprefix )
19
+
20
+ case `#{ CONFIG [ "CC" ] } --version` # rubocop:disable Lint/LiteralAsCondition
21
+ when /Free Software Foundation/
22
+ ldflags = "-Wl,--unresolved-symbols=ignore-all"
23
+ when /clang/
24
+ ldflags = "-undefined dynamic_lookup"
25
+ end
26
+
27
+ current_dir = File . expand_path ( "." )
28
+
29
+ File . open ( "Makefile" , "a" ) do |f |
30
+ f . write <<~MAKEFILE . gsub ( /^ {8}/ , "\t " )
31
+ $(DLLIB): Makefile $(srcdir)/*.go
32
+ cd $(srcdir); \
33
+ CGO_CFLAGS='$(INCFLAGS)' CGO_LDFLAGS='#{ ldflags } ' \
34
+ go build -p 4 -buildmode=c-shared -o #{ current_dir } /$(DLLIB)
35
+ MAKEFILE
36
+ end
12
37
end
13
38
end
14
39
end
You can’t perform that action at this time.
0 commit comments