Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(homebrew): fix boost linking #3296

Merged
merged 1 commit into from
Oct 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
build(homebrew): fix boost linking
  • Loading branch information
ReenigneArcher committed Oct 12, 2024
commit 2e8070802f63ac816420ba59674a98cf12f2abd6
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
Loading