homebrew-core/Formula/ice.rb

109 lines
3.3 KiB
Ruby

class Ice < Formula
desc "Comprehensive RPC framework"
homepage "https://zeroc.com"
url "https://github.com/zeroc-ice/ice/archive/v3.7.7.tar.gz"
sha256 "3aef143a44a664f3101cfe02fd13356c739c922e353ef0c186895b5843a312ae"
license "GPL-2.0-only"
livecheck do
url :stable
strategy :github_latest
end
bottle do
sha256 cellar: :any, arm64_monterey: "84a1443177a249485c5145eb66c5340b695c10f0fa4adc4e1774f8ef93cee8d0"
sha256 cellar: :any, arm64_big_sur: "9c35f817128b493f9440a792c64eb0deb4cd1a98041957023dd738101f12a60a"
sha256 cellar: :any, monterey: "2ba70590d88f2ef43bc58f74e53b6ec3962824ea44722add7e103da9b44fd07c"
sha256 cellar: :any, big_sur: "bb488143d325598a93be666428349ea4198825d34750ec072b321e16ee1804fb"
sha256 cellar: :any, catalina: "6b500bcedbd8382f7aeadd47a98238a753da9ebf0109bb150c2d0eea6387bd8e"
sha256 cellar: :any_skip_relocation, x86_64_linux: "ea59f20451a871f4a35d13bf0b104075dede25e36b306083018c5faa7599b1fd"
end
depends_on "lmdb"
depends_on "mcpp"
uses_from_macos "bzip2"
uses_from_macos "expat"
uses_from_macos "libedit"
on_linux do
depends_on "openssl@3"
end
def install
args = [
"prefix=#{prefix}",
"V=1",
"USR_DIR_INSTALL=yes", # ensure slice and man files are installed to share
"MCPP_HOME=#{Formula["mcpp"].opt_prefix}",
"LMDB_HOME=#{Formula["lmdb"].opt_prefix}",
"CONFIGS=shared cpp11-shared xcodesdk cpp11-xcodesdk",
"PLATFORMS=all",
"SKIP=slice2confluence",
"LANGUAGES=cpp objective-c",
]
# Fails with Xcode < 12.5
inreplace "cpp/include/Ice/Object.h", /^#.+"-Wdeprecated-copy-dtor"+/, "" if MacOS.version <= :catalina
system "make", "install", *args
# We install these binaries to libexec because they conflict with those
# installed along with the ice packages from PyPI, RubyGems and npm.
(libexec/"bin").mkpath
%w[slice2py slice2rb slice2js].each do |r|
mv bin/r, libexec/"bin"
end
end
def caveats
<<~EOS
slice2py, slice2js and slice2rb were installed in:
#{opt_libexec}/bin
You may wish to add this directory to your PATH.
EOS
end
test do
(testpath/"Hello.ice").write <<~EOS
module Test
{
interface Hello
{
void sayHello();
}
}
EOS
port = free_port
(testpath/"Test.cpp").write <<~EOS
#include <Ice/Ice.h>
#include <Hello.h>
class HelloI : public Test::Hello
{
public:
virtual void sayHello(const Ice::Current&) override {}
};
int main(int argc, char* argv[])
{
Ice::CommunicatorHolder ich(argc, argv);
auto adapter = ich->createObjectAdapterWithEndpoints("Hello", "default -h 127.0.0.1 -p #{port}");
adapter->add(std::make_shared<HelloI>(), Ice::stringToIdentity("hello"));
adapter->activate();
return 0;
}
EOS
system bin/"slice2cpp", "Hello.ice"
system ENV.cxx, "-DICE_CPP11_MAPPING", "-std=c++11", "-c", "-I#{include}", "-I.", "Hello.cpp"
system ENV.cxx, "-DICE_CPP11_MAPPING", "-std=c++11", "-c", "-I#{include}", "-I.", "Test.cpp"
system ENV.cxx, "-L#{lib}", "-o", "test", "Test.o", "Hello.o", "-lIce++11", "-pthread"
system "./test"
end
end