Skip to content

Commit f2de830

Browse files
committed
nits: Move to generate_cflags
1 parent bcc6704 commit f2de830

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

_gem/lib/go_gem/rake_task.rb

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,6 @@ def self.build_env_vars
102102
ldflags = GoGem::Util.generate_ldflags
103103
cflags = generate_cflags
104104

105-
# FIXME: Workaround for Ubuntu (GitHub Actions)
106-
if RUBY_PLATFORM =~ /linux/i
107-
cflags.gsub!("-Wno-self-assign", "")
108-
cflags.gsub!("-Wno-parentheses-equality", "")
109-
cflags.gsub!("-Wno-constant-logical-operand", "")
110-
cflags.gsub!("-Wsuggest-attribute=format", "")
111-
cflags.gsub!("-Wold-style-definition", "")
112-
cflags.gsub!("-Wsuggest-attribute=noreturn", "")
113-
end
114-
115-
# FIXME: Workaround for Alpine
116-
cflags.gsub!("-Wpointer-arith", "") if RUBY_PLATFORM =~ /linux-musl/i
117-
118105
ld_library_path = RbConfig::CONFIG["libdir"].to_s
119106

120107
{
@@ -133,11 +120,27 @@ def self.generate_goflags
133120

134121
# @return [String]
135122
def self.generate_cflags
136-
[
137-
RbConfig::CONFIG["CFLAGS"],
138-
"-I#{RbConfig::CONFIG["rubyarchhdrdir"]}",
139-
"-I#{RbConfig::CONFIG["rubyhdrdir"]}",
140-
].join(" ")
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
141144
end
142145
private_class_method :generate_cflags
143146

0 commit comments

Comments
 (0)