Skip to content

Commit

Permalink
libfido2 1.3.0 (new formula)
Browse files Browse the repository at this point in the history
(This is a revival of PR #46072, which is now used by OpenSSH.)

Thanks the the authors of voro++.rb for the solution to moving the
directory containing the manual pages.

Co-authored-by: Alexander Lent <[email protected]>
  • Loading branch information
Gianluca Varisco and xanderlent committed Feb 20, 2020
1 parent 8b84e89 commit 0194ed8
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions Formula/libfido2.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
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.3.0.tar.gz"
sha256 "0b2e3671c4c5d42fd5604a08e45f89f49592b97cf66d7d3bfbc7e6a4d5a0fec7"
depends_on "cmake" => :build
depends_on "mandoc" => :build
depends_on "pkg-config" => :build
depends_on "libcbor"
depends_on "[email protected]"

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
mv prefix/"man", share/"man"
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)
return 1;
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["[email protected]"].include}", "-o", "test", "-L#{lib}", "-lfido2"
system "./test"
end
end

0 comments on commit 0194ed8

Please sign in to comment.