57 lines
1.9 KiB
Ruby
57 lines
1.9 KiB
Ruby
class Libfido2 < Formula
|
|
desc "Provides library functionality for FIDO U2F & FIDO 2.0, including USB"
|
|
homepage "https://developers.yubico.com/libfido2/"
|
|
url "https://github.com/Yubico/libfido2/archive/1.5.0.tar.gz"
|
|
sha256 "5990f923c9390fe1e6a00ba5d1d1f74030e7344b855e971d9fb7223e70ff3122"
|
|
license "BSD-2-Clause"
|
|
revision 1
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "892cb19ff972bd6e118e7d8eb82ccec51ba55227717277935c7b9a5187aadae0" => :big_sur
|
|
sha256 "3160d880a6c2175777523c26a82629500ea2cea52aabc54d31b868c15ad823c2" => :catalina
|
|
sha256 "ff215921abe2965e55f66bab26eaa5cc6b6d822d0b9068f0a6e85b3e2a071586" => :mojave
|
|
sha256 "018430b7f86e69a66fa01c1400054e5e05b7cbf44a95622909b9c010f313c736" => :high_sierra
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "mandoc" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "libcbor"
|
|
depends_on "openssl@1.1"
|
|
|
|
def install
|
|
mkdir "build" do
|
|
system "cmake", "..", *std_cmake_args
|
|
system "make"
|
|
system "make", "man_symlink_html"
|
|
system "make", "man_symlink"
|
|
system "make", "install"
|
|
end
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.c").write <<-EOF
|
|
#include <stddef.h>
|
|
#include <stdio.h>
|
|
#include <fido.h>
|
|
int main(void) {
|
|
fido_init(FIDO_DEBUG);
|
|
// Attempt to enumerate up to five FIDO/U2F devices. Five is an arbitrary number.
|
|
size_t max_devices = 5;
|
|
fido_dev_info_t *devlist;
|
|
if ((devlist = fido_dev_info_new(max_devices)) == NULL)
|
|
return 1;
|
|
size_t found_devices = 0;
|
|
int error;
|
|
if ((error = fido_dev_info_manifest(devlist, max_devices, &found_devices)) == FIDO_OK)
|
|
printf("FIDO/U2F devices found: %s\\n", found_devices ? "Some" : "None");
|
|
fido_dev_info_free(&devlist, max_devices);
|
|
}
|
|
EOF
|
|
system ENV.cc, "-std=c99", "test.c", "-I#{include}", "-I#{Formula["openssl@1.1"].include}", "-o", "test",
|
|
"-L#{lib}", "-lfido2"
|
|
system "./test"
|
|
end
|
|
end
|