class Bde < Formula desc "Basic Development Environment: foundational C++ libraries used at Bloomberg" homepage "https://github.com/bloomberg/bde" url "https://github.com/bloomberg/bde/archive/3.61.0.0.tar.gz" sha256 "46dcdcf06f3cf582170848721dd6d8ca9c993f9cfa34445103d3cee34a5d6dda" license "Apache-2.0" revision 1 livecheck do url :stable regex(/^v?(\d+(?:\.\d+)+)$/i) end bottle do sha256 cellar: :any, arm64_monterey: "68d135bc723147e17579541ad3e89a8a176c87cc6b04136321622dc07a8d6a39" sha256 cellar: :any, arm64_big_sur: "2b2d2c0e1a9439c13c7f5cc5a0c3066b8c84a884c25d02790e1519f617563140" sha256 cellar: :any, monterey: "dc3a4b7f935f65892ff0f6ab01030805b194bcf445d6bac5764d02d7a2013292" sha256 cellar: :any, big_sur: "b67cceb437125529fcc53d7025b45691dd45feecc1878f30cd9e87d325a4a458" sha256 cellar: :any, catalina: "8f96d15c8dbe7b0e37f83675371d24e9f9428250d459534d2f0c3483c7e3c945" sha256 cellar: :any_skip_relocation, x86_64_linux: "de9fb5dc040eca7698710fb9091cdd7e2da5d0ec7708d27d0ecaeb641eb42af8" end depends_on "cmake" => :build depends_on "pkg-config" => :build depends_on "python@3.10" => :build depends_on "pcre2" resource "bde-tools" do url "https://github.com/bloomberg/bde-tools/archive/3.61.0.0.tar.gz" sha256 "7d66eb149c7e59021467c386ba5c6149a8923e836c6a61b815651b3cac019a7d" end # Backport support for Apple Silicon. Remove in the next release patch do on_arm do url "https://github.com/bloomberg/bde/commit/39a52e09c83eec761874be2260b692b715117fae.patch?full_index=1" sha256 "d3721d8a297687ddd2003386845aaa6ec3f8664ab81551b1ef581fe65ad1cb96" end end def install buildpath.install resource("bde-tools") # Use brewed pcre2 instead of bundled sources inreplace "project.cmake", "${listDir}/thirdparty/pcre2\n", "" inreplace "groups/bdl/group/bdl.dep", "pcre2", "libpcre2-posix" inreplace "groups/bdl/bdlpcre/bdlpcre_regex.h", "#include ", "#include " toolchain_file = "cmake/toolchains/#{OS.kernel_name.downcase}/default.cmake" args = std_cmake_args + %W[ -DBUILD_BITNESS=64 -DUFID=opt_exc_mt_64_shr -DCMAKE_MODULE_PATH=cmake -DCMAKE_INSTALL_RPATH=#{rpath} -DCMAKE_TOOLCHAIN_FILE=#{toolchain_file} -DPYTHON_EXECUTABLE=#{which("python3.10")} ] system "cmake", "-S", ".", "-B", "build", *args system "cmake", "--build", "build" system "cmake", "--install", "build" # CMake install step does not conform to FHS lib.install Dir[bin/"so/64/*"] lib.install lib/"opt_exc_mt_shr/cmake" end test do # bde tests are incredibly performance intensive # test below does a simple sanity check for linking against bsl. (testpath/"test.cpp").write <<~EOS #include #include int main() { using namespace BloombergLP; bsl::string string(bslma::Default::globalAllocator()); return 0; } EOS system ENV.cxx, "-I#{include}", "test.cpp", "-L#{lib}", "-lbsl", "-o", "test" system "./test" end end