build(homebrew): fix boost linking (#3296)
Some checks failed
CI / GitHub Env Debug (push) Has been cancelled
CI / Setup Release (push) Has been cancelled
CI / Setup Flatpak Matrix (push) Has been cancelled
CI Docker / Check Dockerfiles (push) Has been cancelled
CodeQL / Get language matrix (push) Has been cancelled
Build GH-Pages / update_pages (push) Has been cancelled
CI / Linux Flatpak (push) Has been cancelled
CI / Linux ${{ matrix.type }} (--appimage-build, 22.04, AppImage) (push) Has been cancelled
CI / Homebrew (${{ matrix.os_name }}-${{ matrix.os_version }}${{ matrix.release == true && ' (Release)' || '' }}) (macos, 13) (push) Has been cancelled
CI / Homebrew (${{ matrix.os_name }}-${{ matrix.os_version }}${{ matrix.release == true && ' (Release)' || '' }}) (macos, 14) (push) Has been cancelled
CI / Homebrew (${{ matrix.os_name }}-${{ matrix.os_version }}${{ matrix.release == true && ' (Release)' || '' }}) (ubuntu, latest) (push) Has been cancelled
CI / Homebrew (${{ matrix.os_name }}-${{ matrix.os_version }}${{ matrix.release == true && ' (Release)' || '' }}) (ubuntu, latest, true) (push) Has been cancelled
CI / Macports (macOS-${{ matrix.os_version }}) (13, true) (push) Has been cancelled
CI / Macports (macOS-${{ matrix.os_version }}) (14) (push) Has been cancelled
CI / Windows (push) Has been cancelled
CI Docker / Setup Release (push) Has been cancelled
CI Docker / Docker${{ matrix.tag }} (push) Has been cancelled
CodeQL / Analyze (${{ matrix.name }}) (push) Has been cancelled

This commit is contained in:
ReenigneArcher 2024-10-12 13:08:38 -04:00 committed by GitHub
parent 50261bf5ee
commit 25ed2d5b4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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
@ -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
@ -84,14 +85,17 @@ class @PROJECT_NAME@ < Formula
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}"
@ -99,9 +103,6 @@ class @PROJECT_NAME@ < Formula
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