@@ -100,50 +100,18 @@ def initialize(gem_name)
100100 # @return [Hash<String, String>]
101101 def self . build_env_vars
102102 ldflags = GoGem ::Util . generate_ldflags
103- cflags = generate_cflags
103+ cflags = GoGem :: Util . generate_cflags
104104
105105 ld_library_path = RbConfig ::CONFIG [ "libdir" ] . to_s
106106
107107 {
108- "GOFLAGS" => generate_goflags ,
108+ "GOFLAGS" => GoGem :: Util . generate_goflags ,
109109 "CGO_CFLAGS" => cflags ,
110110 "CGO_LDFLAGS" => ldflags ,
111111 "LD_LIBRARY_PATH" => ld_library_path ,
112112 }
113113 end
114114
115- # @return [String]
116- def self . generate_goflags
117- "-tags=#{ GoGem ::Util . ruby_minor_version_build_tag } "
118- end
119- private_class_method :generate_goflags
120-
121- # @return [String]
122- def self . generate_cflags
123- cflags =
124- [
125- RbConfig ::CONFIG [ "CFLAGS" ] ,
126- "-I#{ RbConfig ::CONFIG [ "rubyarchhdrdir" ] } " ,
127- "-I#{ RbConfig ::CONFIG [ "rubyhdrdir" ] } " ,
128- ] . join ( " " )
129-
130- # FIXME: Workaround for Ubuntu (GitHub Actions)
131- if RUBY_PLATFORM =~ /linux/i
132- cflags . gsub! ( "-Wno-self-assign" , "" )
133- cflags . gsub! ( "-Wno-parentheses-equality" , "" )
134- cflags . gsub! ( "-Wno-constant-logical-operand" , "" )
135- cflags . gsub! ( "-Wsuggest-attribute=format" , "" )
136- cflags . gsub! ( "-Wold-style-definition" , "" )
137- cflags . gsub! ( "-Wsuggest-attribute=noreturn" , "" )
138- end
139-
140- # FIXME: Workaround for Alpine
141- cflags . gsub! ( "-Wpointer-arith" , "" ) if RUBY_PLATFORM =~ /linux-musl/i
142-
143- cflags . strip
144- end
145- private_class_method :generate_cflags
146-
147115 # @yield
148116 def within_target_dir
149117 Dir . chdir ( target_dir ) do # rubocop:disable Style/ExplicitBlockArgument
0 commit comments