Skip to content

Commit 2b5abbd

Browse files
committed
Use create_go_makefile testdata
1 parent ecd104b commit 2b5abbd

File tree

1 file changed

+2
-26
lines changed

1 file changed

+2
-26
lines changed

ruby/testdata/example/ext/example/extconf.rb

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,14 @@
33
require "mkmf"
44

55
############ Appended for go native extension
6-
find_executable("go")
7-
8-
# rubocop:disable Style/GlobalVars
9-
$objs = []
10-
def $objs.empty?; false; end
11-
# rubocop:enable Style/GlobalVars
12-
6+
require "go_gem/mkmf"
137
############ Appended for go native extension
148

159
# Makes all symbols private by default to avoid unintended conflict
1610
# with other gems. To explicitly export symbols you can use RUBY_FUNC_EXPORTED
1711
# selectively, or entirely remove this flag.
1812
append_cflags("-fvisibility=hidden")
1913

20-
create_makefile("example/example")
21-
2214
############ Appended for go native extension
23-
case `#{CONFIG["CC"]} --version` # rubocop:disable Lint/LiteralAsCondition
24-
when /Free Software Foundation/
25-
ldflags = "-Wl,--unresolved-symbols=ignore-all"
26-
when /clang/
27-
ldflags = "-undefined dynamic_lookup"
28-
end
29-
30-
current_dir = File.expand_path(".")
31-
32-
File.open("Makefile", "a") do |f|
33-
f.write <<~MAKEFILE.gsub(/^ {8}/, "\t")
34-
$(DLLIB): Makefile $(srcdir)/*.go
35-
cd $(srcdir); \
36-
CGO_CFLAGS='$(INCFLAGS)' CGO_LDFLAGS='#{ldflags}' \
37-
go build -p 4 -buildmode=c-shared -o #{current_dir}/$(DLLIB)
38-
MAKEFILE
39-
end
15+
create_go_makefile("example/example")
4016
############ Appended for go native extension

0 commit comments

Comments
 (0)