Skip to content

Commit d211df0

Browse files
committed
nits: Move to GoGem::Util.generate_cflags
1 parent 6f436b1 commit d211df0

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

_gem/lib/go_gem/rake_task.rb

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +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-
115105
ld_library_path = RbConfig::CONFIG["libdir"].to_s
116106

117107
{
@@ -130,11 +120,27 @@ def self.generate_goflags
130120

131121
# @return [String]
132122
def self.generate_cflags
133-
[
134-
RbConfig::CONFIG["CFLAGS"],
135-
"-I#{RbConfig::CONFIG["rubyarchhdrdir"]}",
136-
"-I#{RbConfig::CONFIG["rubyhdrdir"]}",
137-
].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
138144
end
139145
private_class_method :generate_cflags
140146

0 commit comments

Comments
 (0)