homebrew-core/Formula/ice.rb

89 lines
2.6 KiB
Ruby

class Ice < Formula
desc "Comprehensive RPC framework"
homepage "https://zeroc.com"
url "https://github.com/zeroc-ice/ice/archive/v3.7.5.tar.gz"
sha256 "36bf45591a95e6ee7216153d45d8eca05ff00c1da35608f0c400e6ddc8049da9"
license "GPL-2.0-only"
livecheck do
url :stable
strategy :github_latest
end
bottle do
sha256 cellar: :any, arm64_big_sur: "9f6864341db930e3fec14ee0e108e2c71d268441d6890c76f57e873475daaf99"
sha256 cellar: :any, big_sur: "3a61df370da3e0ee676eaabe0470a0bc75296dc0dd3d4a62bd02e7a84829a50a"
sha256 cellar: :any, catalina: "ce6660264a1b883917ca7437e173ec954d5b552f9f1fcbda82ae3a8594668dd4"
sha256 cellar: :any, mojave: "d1b6db2cd443c0cf57990bea3651fefeca93e22a6542657967617560e483e78a"
end
depends_on "lmdb"
depends_on "mcpp"
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",
]
system "make", "install", *args
(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
(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 localhost -p 10000");
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"
system "./test"
end
end