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
9
9
#
10
10
# @param target [String]
11
11
# @param srcprefix [String,nil]
12
+ # @param go_build_args [String,nil] Arguments passed to `go build`
12
13
#
13
14
# @example
14
15
# require "mkmf"
@@ -17,7 +18,10 @@ module Mkmf
17
18
# # Use create_go_makefile instead of create_makefile
18
19
# # create_makefile("example/example")
19
20
# 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 )
21
25
find_executable ( "go" )
22
26
23
27
# rubocop:disable Style/GlobalVars
@@ -38,7 +42,7 @@ def $objs.empty?; false; end
38
42
$(DLLIB): Makefile $(srcdir)/*.go
39
43
cd $(srcdir); \
40
44
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 }
42
46
MAKEFILE
43
47
end
44
48
end
Original file line number Diff line number Diff line change @@ -2,6 +2,6 @@ module GoGem
2
2
module Mkmf
3
3
$objs: Array[untyped ]
4
4
5
- def create_go_makefile : (String target, String? srcprefix ) -> void
5
+ def create_go_makefile : (String target, ?srcprefix: String?, ?go_build_args: String? ) -> void
6
6
end
7
7
end
Original file line number Diff line number Diff line change 8
8
@temp_dir = Dir . mktmpdir
9
9
10
10
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'" )
12
12
end
13
13
end
14
14
You can’t perform that action at this time.
0 commit comments