class Libvorbis < Formula desc "Vorbis General Audio Compression Codec" homepage "https://xiph.org/vorbis/" url "https://downloads.xiph.org/releases/vorbis/libvorbis-1.3.7.tar.xz", using: :homebrew_curl mirror "https://ftp.osuosl.org/pub/xiph/releases/vorbis/libvorbis-1.3.7.tar.xz" sha256 "b33cc4934322bcbf6efcbacf49e3ca01aadbea4114ec9589d1b1e9d20f72954b" license "BSD-3-Clause" livecheck do url "https://ftp.osuosl.org/pub/xiph/releases/vorbis/?C=M&O=D" regex(/href=.*?libvorbis[._-]v?(\d+(?:\.\d+)+)\.t/i) end head do url "https://gitlab.xiph.org/xiph/vorbis.git", branch: "master" depends_on "autoconf" => :build depends_on "automake" => :build depends_on "libtool" => :build end depends_on "pkg-config" => :build depends_on "libogg" resource("oggfile") do url "https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg" sha256 "f57b56d8aae4c847cf01224fb45293610d801cfdac43d932b5eeab1cd318182a" end def install system "./autogen.sh" if build.head? inreplace "configure", " -force_cpusubtype_ALL", "" system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}" system "make", "install" end test do (testpath/"test.c").write <<~EOS #include #include #include "vorbis/vorbisfile.h" int main (void) { OggVorbis_File vf; assert (ov_open_callbacks (stdin, &vf, NULL, 0, OV_CALLBACKS_NOCLOSE) >= 0); vorbis_info *vi = ov_info (&vf, -1); printf("Bitstream is %d channel, %ldHz\\n", vi->channels, vi->rate); printf("Encoded by: %s\\n", ov_comment(&vf,-1)->vendor); return 0; } EOS testpath.install resource("oggfile") system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lvorbisfile", "-o", "test" assert_match "2 channel, 44100Hz\nEncoded by: Lavf59.27.100", shell_output("./test < Example.ogg") end end