homebrew-core/Formula/ice.rb
2017-10-20 14:10:54 +01:00

87 lines
3 KiB
Ruby

class Ice < Formula
desc "Comprehensive RPC framework"
homepage "https://zeroc.com"
url "https://github.com/zeroc-ice/ice/archive/v3.7.0.tar.gz"
sha256 "809fff14a88a7de1364c846cec771d0d12c72572914e6cc4fb0b2c1861c4a1ee"
revision 1
bottle do
cellar :any
sha256 "12c868b7c154912199a6d30b43cbd01dfdf8b40c84e2a617a12c7c1b566511a4" => :high_sierra
sha256 "61278509d486649a63866a88cc398b623a4bfe42bb12f91361748de62cea33f8" => :sierra
sha256 "57bfd40f9d453215b197b5043de07554de9848c69ffdaa8909781bdf792b4b1f" => :el_capitan
end
# Xcode 9 support
patch do
url "https://github.com/zeroc-ice/ice/commit/3a55ebb51b8914b60d308a0535d9abf97567138d.patch?full_index=1"
sha256 "d95e76acebdae69edf3622f5141ea32bbbd5844be7c29d88e6e985d14a5d5dd4"
end
#
# NOTE: we don't build slice2py, slice2js, slice2rb by default to prevent clashes with
# the translators installed by the PyPI/GEM/npm packages.
#
option "with-additional-compilers", "Build additional Slice compilers (slice2py, slice2js, slice2rb)"
option "with-java", "Build Ice for Java and the IceGrid GUI app"
option "without-xcode-sdk", "Build without the Xcode SDK for iOS development (includes static libs)"
depends_on "mcpp"
depends_on "lmdb"
depends_on :java => ["1.8+", :optional]
depends_on :macos => :mavericks
def install
# Ensure Gradle uses a writable directory even in sandbox mode
ENV["GRADLE_USER_HOME"] = "#{buildpath}/.gradle"
args = [
"prefix=#{prefix}",
"V=1",
"MCPP_HOME=#{Formula["mcpp"].opt_prefix}",
"LMDB_HOME=#{Formula["lmdb"].opt_prefix}",
"CONFIGS=shared cpp11-shared #{build.with?("xcode-sdk") ? "xcodesdk cpp11-xcodesdk" : ""}",
"PLATFORMS=all",
"SKIP=slice2confluence #{build.without?("additional-compilers") ? "slice2py slice2rb slice2js" : ""}",
"LANGUAGES=cpp objective-c #{build.with?("java") ? "java java-compat" : ""}",
]
system "make", "install", *args
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