homebrew-core/Formula/wdc.rb
2019-12-26 17:27:56 +01:00

56 lines
2.1 KiB
Ruby

class Wdc < Formula
desc "WebDAV Client provides easy and convenient to work with WebDAV-servers"
homepage "https://cloudpolis.github.io/webdav-client-cpp"
url "https://github.com/CloudPolis/webdav-client-cpp/archive/v1.0.1.tar.gz"
sha256 "64b01de188032cb9e09f5060965bd90ed264e7c0b4ceb62bfc036d0caec9fd82"
revision 2
bottle do
cellar :any_skip_relocation
sha256 "ba175bbe8a5c6ba732b4fc93386315b1d616c651eea748d821021b970758cd0b" => :catalina
sha256 "8ea1fa726f01bca89007add6ef9560d14b3f5413df360dd5d6e9bb6f597402ce" => :mojave
sha256 "35868afa90ec0e1573fe41225a666cf66a2bb30629d06f8ca82da3a6117290fd" => :high_sierra
end
depends_on "cmake" => :build
depends_on "openssl@1.1"
depends_on "pugixml"
def install
pugixml = Formula["pugixml"]
ENV.prepend "CXXFLAGS", "-I#{pugixml.opt_include.children.first}"
system "cmake", ".", "-DPUGIXML_INCLUDE_DIR=#{pugixml.opt_include}",
"-DPUGIXML_LIBRARY=#{pugixml.opt_lib}", *std_cmake_args
system "make", "install"
end
test do
(testpath/"test.cpp").write <<~EOS
#include <webdav/client.hpp>
#include <cassert>
#include <string>
#include <memory>
#include <map>
int main(int argc, char *argv[]) {
std::map<std::string, std::string> options =
{
{"webdav_hostname", "https://webdav.example.com"},
{"webdav_login", "webdav_login"},
{"webdav_password", "webdav_password"}
};
std::shared_ptr<WebDAV::Client> client(WebDAV::Client::Init(options));
auto check_connection = client->check();
assert(!check_connection);
}
EOS
pugixml = Formula["pugixml"]
openssl = Formula["openssl@1.1"]
system ENV.cxx, "test.cpp", "-o", "test", "-lcurl", "-std=c++11",
"-L#{lib}", "-lwdc", "-I#{include}",
"-L#{openssl.opt_lib}", "-lssl", "-lcrypto",
"-I#{openssl.opt_include}",
"-L#{pugixml.opt_lib}", "-lpugixml",
"-I#{pugixml.opt_include}"
system "./test"
end
end