| class LibusbFlutter < Formula |
| desc "Library for USB device access" |
| homepage "https://libusb.info/" |
| |
| head do |
| url "https://flutter-mirrors.googlesource.com/libusb.git" |
| |
| depends_on "autoconf" => :build |
| depends_on "automake" => :build |
| depends_on "libtool" => :build |
| end |
| |
| def install |
| args = %W[--disable-dependency-tracking --prefix=#{prefix}] |
| |
| system "./autogen.sh" if build.head? |
| system "./configure", *args |
| system "make", "install" |
| pkgshare.install "examples" |
| end |
| |
| test do |
| cp_r (pkgshare/"examples"), testpath |
| cd "examples" do |
| system ENV.cc, "-lusb-1.0", "-L#{lib}", "-I#{include}/libusb-1.0", |
| "listdevs.c", "-o", "test" |
| system "./test" |
| end |
| end |
| end |