File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ module Mkmf
99 #
1010 # @param target [String]
1111 # @param srcprefix [String,nil]
12+ # @param go_build_args [String,nil] Arguments passed to `go build`
1213 #
1314 # @example
1415 # require "mkmf"
@@ -17,7 +18,10 @@ module Mkmf
1718 # # Use create_go_makefile instead of create_makefile
1819 # # create_makefile("example/example")
1920 # create_go_makefile("example/example")
20- def create_go_makefile ( target , srcprefix : nil )
21+ #
22+ # @example Pass debug flags to `go build`
23+ # create_go_makefile("example/example", go_build_args: "-gcflags='all=-N -l'")
24+ def create_go_makefile ( target , srcprefix : nil , go_build_args : nil )
2125 find_executable ( "go" )
2226
2327 # rubocop:disable Style/GlobalVars
@@ -38,7 +42,7 @@ def $objs.empty?; false; end
3842 $(DLLIB): Makefile $(srcdir)/*.go
3943 cd $(srcdir); \
4044 CGO_CFLAGS='$(INCFLAGS)' CGO_LDFLAGS='#{ ldflags } ' GOFLAGS='#{ goflags } ' \
41- go build -p 4 -buildmode=c-shared -o #{ current_dir } /$(DLLIB)
45+ go build -p 4 -buildmode=c-shared -o #{ current_dir } /$(DLLIB) #{ go_build_args }
4246 MAKEFILE
4347 end
4448 end
Original file line number Diff line number Diff line change @@ -2,6 +2,6 @@ module GoGem
22 module Mkmf
33 $objs: Array[untyped ]
44
5- def create_go_makefile : (String target, ?srcprefix: String?) -> void
5+ def create_go_makefile : (String target, ?srcprefix: String?, ?go_build_args: String? ) -> void
66 end
77end
Original file line number Diff line number Diff line change 88 @temp_dir = Dir . mktmpdir
99
1010 Dir . chdir ( @temp_dir ) do
11- create_go_makefile ( "#{ gem_name } /#{ gem_name } " )
11+ create_go_makefile ( "#{ gem_name } /#{ gem_name } " , go_build_args : "-gcflags='all=-N -l'" )
1212 end
1313 end
1414
You can’t perform that action at this time.
0 commit comments