File tree Expand file tree Collapse file tree 4 files changed +17
-18
lines changed Expand file tree Collapse file tree 4 files changed +17
-18
lines changed Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ def initialize(gem_name)
9999 #
100100 # @return [Hash<String, String>]
101101 def self . build_env_vars
102- ldflags = generate_ldflags
102+ ldflags = GoGem :: Util . generate_ldflags
103103 cflags = generate_cflags
104104
105105 # FIXME: Workaround for Ubuntu (GitHub Actions)
@@ -129,21 +129,6 @@ def self.generate_goflags
129129 end
130130 private_class_method :generate_goflags
131131
132- # @return [String]
133- def self . generate_ldflags
134- ldflags = "-L#{ RbConfig ::CONFIG [ "libdir" ] } -l#{ RbConfig ::CONFIG [ "RUBY_SO_NAME" ] } "
135-
136- case `#{ RbConfig ::CONFIG [ "CC" ] } --version` # rubocop:disable Lint/LiteralAsCondition
137- when /Free Software Foundation/
138- ldflags << " -Wl,--unresolved-symbols=ignore-all"
139- when /clang/
140- ldflags << " -undefined dynamic_lookup"
141- end
142-
143- ldflags
144- end
145- private_class_method :generate_ldflags
146-
147132 # @return [String]
148133 def self . generate_cflags
149134 [
Original file line number Diff line number Diff line change @@ -14,5 +14,19 @@ module Util
1414 def self . ruby_minor_version_build_tag ( ruby_version = RUBY_VERSION )
1515 "ruby_#{ ruby_version . to_f . to_s . gsub ( "." , "_" ) } "
1616 end
17+
18+ # @return [String]
19+ def self . generate_ldflags
20+ ldflags = "-L#{ RbConfig ::CONFIG [ "libdir" ] } -l#{ RbConfig ::CONFIG [ "RUBY_SO_NAME" ] } "
21+
22+ case `#{ RbConfig ::CONFIG [ "CC" ] } --version` # rubocop:disable Lint/LiteralAsCondition
23+ when /Free Software Foundation/
24+ ldflags << " -Wl,--unresolved-symbols=ignore-all"
25+ when /clang/
26+ ldflags << " -undefined dynamic_lookup"
27+ end
28+
29+ ldflags
30+ end
1731 end
1832end
Original file line number Diff line number Diff line change @@ -32,8 +32,6 @@ module GoGem
3232
3333 def self.generate_goflags : () -> String
3434
35- def self.generate_ldflags : () -> String
36-
3735 def self.generate_cflags : () -> String
3836
3937 private
Original file line number Diff line number Diff line change 11module GoGem
22 module Util
33 def self.ruby_minor_version_build_tag : (?String ruby_version) -> String
4+
5+ def self.generate_ldflags : () -> String
46 end
57end
You can’t perform that action at this time.
0 commit comments