Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions _gem/lib/go_gem/mkmf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module Mkmf
#
# @param target [String]
# @param srcprefix [String,nil]
# @param go_build_args [String,nil] Arguments passed to `go build`
#
# @example
# require "mkmf"
Expand All @@ -17,7 +18,10 @@ module Mkmf
# # Use create_go_makefile instead of create_makefile
# # create_makefile("example/example")
# create_go_makefile("example/example")
def create_go_makefile(target, srcprefix = nil)
#
# @example Pass debug flags to `go build`
# create_go_makefile("example/example", go_build_args: "-gcflags='all=-N -l'")
def create_go_makefile(target, srcprefix: nil, go_build_args: nil)
find_executable("go")

# rubocop:disable Style/GlobalVars
Expand All @@ -38,7 +42,7 @@ def $objs.empty?; false; end
$(DLLIB): Makefile $(srcdir)/*.go
cd $(srcdir); \
CGO_CFLAGS='$(INCFLAGS)' CGO_LDFLAGS='#{ldflags}' GOFLAGS='#{goflags}' \
go build -p 4 -buildmode=c-shared -o #{current_dir}/$(DLLIB)
go build -p 4 -buildmode=c-shared -o #{current_dir}/$(DLLIB) #{go_build_args}
MAKEFILE
end
end
Expand Down
2 changes: 1 addition & 1 deletion _gem/sig/go_gem/mkmf.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ module GoGem
module Mkmf
$objs: Array[untyped]

def create_go_makefile: (String target, String? srcprefix) -> void
def create_go_makefile: (String target, ?srcprefix: String?, ?go_build_args: String?) -> void
end
end
2 changes: 1 addition & 1 deletion _gem/spec/go_gem/mkmf_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@temp_dir = Dir.mktmpdir

Dir.chdir(@temp_dir) do
create_go_makefile("#{gem_name}/#{gem_name}")
create_go_makefile("#{gem_name}/#{gem_name}", go_build_args: "-gcflags='all=-N -l'")
end
end

Expand Down
Loading