class Opusfile < Formula desc "API for decoding and seeking in .opus files" homepage "https://www.opus-codec.org/" url "https://archive.mozilla.org/pub/opus/opusfile-0.9.tar.gz" sha256 "f75fb500e40b122775ac1a71ad80c4477698842a8fe9da4a1b4a1a9f16e4e979" bottle do cellar :any sha256 "71557f495eaf37e08c1987170d4b94a75e5a049fb41af7988bc53731d8500095" => :sierra sha256 "2ed73162c2ae71f702da1cdbf6f9c998834f3d727cb1a9e6e09f1d59cbe35d01" => :el_capitan sha256 "5b5023288476b08cb64389b002973565f84fd6ed58ece780e417770f33e3520d" => :yosemite end head do url "https://git.xiph.org/opusfile.git" depends_on "autoconf" => :build depends_on "automake" => :build depends_on "libtool" => :build end depends_on "pkg-config" => :build depends_on "libogg" depends_on "openssl" depends_on "opus" resource "music_48kbps.opus" do url "https://www.opus-codec.org/examples/samples/music_48kbps.opus" sha256 "64571f56bb973c078ec784472944aff0b88ba0c88456c95ff3eb86f5e0c1357d" end def install system "./autogen.sh" if build.head? system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}" system "make", "install" end test do (testpath/"test.c").write <<-EOS.undent #include #include int main(int argc, const char **argv) { int ret; OggOpusFile *of; of = op_open_file(argv[1], &ret); if (of == NULL) { fprintf(stderr, "Failed to open file '%s': %i\\n", argv[1], ret); return EXIT_FAILURE; } op_free(of); return EXIT_SUCCESS; } EOS system ENV.cc, "test.c", "-I#{Formula["opus"].include}/opus", "-L#{lib}", "-lopusfile", "-o", "test" resource("music_48kbps.opus").stage testpath system "./test", "music_48kbps.opus" end end