require "formula" class Qca < Formula desc "Qt Cryptographic Architecture (QCA)" homepage "http://delta.affinix.com/qca/" url "http://delta.affinix.com/download/qca/2.0/qca-2.1.0.tar.gz" sha1 "2b582b3ccc7e6098cd14d6f52a829ae1539e9cc8" head "git://anongit.kde.org/qca.git" bottle do revision 1 sha1 "356114a1ff4876b5027c679e05dbbca7a577bbfb" => :yosemite sha1 "96c63fea66bed56cb8c00dcaee425c774aea04db" => :mavericks sha1 "4c2620045877960f797c208b4c68e505fc02a39d" => :mountain_lion end option "with-api-docs", "Build API documentation" depends_on "cmake" => :build depends_on "pkg-config" => :build depends_on "qt" => :recommended depends_on "qt5" => :optional # Plugins (QCA needs at least one plugin to do anything useful) depends_on "openssl" # qca-ossl depends_on "botan" => :optional # qca-botan depends_on "libgcrypt" => :optional # qca-gcrypt depends_on "gnupg" => :optional # qca-gnupg depends_on "nss" => :optional # qca-nss depends_on "pkcs11-helper" => :optional # qca-pkcs11 if build.with? "api-docs" depends_on "graphviz" => :build depends_on "doxygen" => [:build, "with-graphviz"] end def install odie "Qt dependency must be defined" if build.without?("qt") && build.without?("qt5") args = std_cmake_args args << "-DQT4_BUILD=#{build.with?("qt5") ? "OFF" : "ON"}" args << "-DBUILD_TESTS=OFF" # Plugins (qca-ossl, qca-cyrus-sasl, qca-logger, qca-softstore always built) args << "-DWITH_botan_PLUGIN=#{build.with?("botan") ? "YES" : "NO"}" args << "-DWITH_gcrypt_PLUGIN=#{build.with?("libgcrypt") ? "YES" : "NO"}" args << "-DWITH_gnupg_PLUGIN=#{build.with?("gnupg") ? "YES" : "NO"}" args << "-DWITH_nss_PLUGIN=#{build.with?("nss") ? "YES" : "NO"}" args << "-DWITH_pkcs11_PLUGIN=#{build.with?("pkcs11-helper") ? "YES" : "NO"}" system "cmake", ".", *args system "make", "install" if build.with? "api-docs" system "make", "doc" doc.install "apidocs/html" end end test do system "#{bin}/qcatool", "--noprompt", "--newpass=", "key", "make", "rsa", "2048", "test.key" end end