Skip to content

Commit d427f0d

Browse files
Move GCC dependency and usage to Linux only
GCC is now only required on Linux for building and testing, and related environment variables and gcov usage are set conditionally for Linux. This avoids unnecessary GCC dependency and configuration on non-Linux platforms.
1 parent 866ba16 commit d427f0d

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

packaging/sunshine.rb

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class Sunshine < Formula
3131

3232
depends_on "cmake" => :build
3333
depends_on "doxygen" => :build
34-
depends_on GCC_FORMULA => [:build, :test]
3534
depends_on "graphviz" => :build
3635
depends_on "node" => :build
3736
depends_on "pkgconf" => :build
@@ -48,6 +47,7 @@ class Sunshine < Formula
4847
end
4948

5049
on_linux do
50+
depends_on GCC_FORMULA => [:build, :test]
5151
depends_on "avahi"
5252
depends_on "gnu-which"
5353
depends_on "libayatana-appindicator"
@@ -85,10 +85,12 @@ def install
8585
ENV["BUILD_VERSION"] = "@BUILD_VERSION@"
8686
ENV["COMMIT"] = "@GITHUB_COMMIT@"
8787

88-
# Use GCC because gcov from llvm cannot handle our paths
89-
gcc_path = Formula[GCC_FORMULA]
90-
ENV["CC"] = "#{gcc_path.opt_bin}/gcc-#{GCC_VERSION}"
91-
ENV["CXX"] = "#{gcc_path.opt_bin}/g++-#{GCC_VERSION}"
88+
if OS.linux?
89+
# Use GCC because gcov from llvm cannot handle our paths
90+
gcc_path = Formula[GCC_FORMULA]
91+
ENV["CC"] = "#{gcc_path.opt_bin}/gcc-#{GCC_VERSION}"
92+
ENV["CXX"] = "#{gcc_path.opt_bin}/g++-#{GCC_VERSION}"
93+
end
9294

9395
args = %W[
9496
-DBUILD_WERROR=ON
@@ -192,8 +194,12 @@ def caveats
192194
# Change to the source directory for gcovr to work properly
193195
cd "#{buildpath}/build" do
194196
# Use GCC version to match what was used during compilation
195-
gcc_path = Formula[GCC_FORMULA]
196-
gcov_executable = "#{gcc_path.opt_bin}/gcov-#{GCC_VERSION}"
197+
if OS.linux?
198+
gcc_path = Formula[GCC_FORMULA]
199+
gcov_executable = "#{gcc_path.opt_bin}/gcov-#{GCC_VERSION}"
200+
else
201+
gcov_executable = "gcov"
202+
end
197203

198204
system "gcovr", ".",
199205
"-r", "../src",

0 commit comments

Comments
 (0)