Skip to content

Commit

Permalink
build(homebrew): fix boost linking (#3296)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher authored Oct 12, 2024
1 parent 50261bf commit 25ed2d5
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions packaging/sunshine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class @PROJECT_NAME@ < Formula
end

option "with-docs", "Enable docs"
option "with-dynamic-boost", "Dynamically link Boost libraries"
option "without-dynamic-boost", "Statically link Boost libraries" # default option
option "with-static-boost", "Enable static link of Boost libraries"
option "without-static-boost", "Disable static link of Boost libraries" # default option

depends_on "cmake" => :build
depends_on "doxygen" => :build
Expand All @@ -35,6 +35,7 @@ class @PROJECT_NAME@ < Formula
depends_on "miniupnpc"
depends_on "openssl"
depends_on "opus"
depends_on "boost" => :recommended
depends_on "icu4c" => :recommended

on_linux do
Expand Down Expand Up @@ -84,24 +85,24 @@ def install
args << "-DBUILD_DOCS=OFF"
end

if build.without? "dynamic-boost"
if build.without? "static-boost"
args << "-DBOOST_USE_STATIC=OFF"
ohai "Disabled statically linking Boost libraries"
else
args << "-DBOOST_USE_STATIC=ON"
ohai "Statically linking Boost libraries"
ohai "Enabled statically linking Boost libraries"

unless Formula["icu4c"].any_version_installed?
odie <<~EOS
icu4c must be installed to link against static Boost libraries,
either install icu4c or use brew install sunshine --with-dynamic-boost instead
either install icu4c or use brew install sunshine --with-static-boost instead
EOS
end
ENV.append "CXXFLAGS", "-I#{Formula["icu4c"].opt_include}"
icu4c_lib_path = Formula["icu4c"].opt_lib.to_s
ENV.append "LDFLAGS", "-L#{icu4c_lib_path}"
ENV["LIBRARY_PATH"] = icu4c_lib_path
ohai "Linking against ICU libraries at: #{icu4c_lib_path}"
else
args << "-DBOOST_USE_STATIC=OFF"
ohai "Dynamically linking Boost libraries"
end

system "cmake", "-S", ".", "-B", "build", *std_cmake_args, *args
Expand Down

0 comments on commit 25ed2d5

Please sign in to comment.