class LibtorrentRasterbar < Formula desc "C++ bittorrent library by Rasterbar Software" homepage "http://www.libtorrent.org/" url "https://github.com/arvidn/libtorrent/releases/download/libtorrent-1_0_6/libtorrent-rasterbar-1.0.6.tar.gz" mirror "https://mirrors.kernel.org/debian/pool/main/libt/libtorrent-rasterbar/libtorrent-rasterbar_1.0.6.orig.tar.gz" sha256 "c97de804b77f44591801631aca3869567671df2d3e2afe7f5453d8db2478fd61" bottle do cellar :any sha256 "ffffb9a24e44a90e9f1cc91d272ac82fef5f9f2df0fd11e9c257951f00de916e" => :yosemite sha256 "5acb2f68de06a26e26f79c56c79933afdfb1dd8df6d98c365dc7827405e44d61" => :mavericks sha256 "a8e66623af264107d46ce7b32bbec075fa5d5a93767183311675bb7f83f3b379" => :mountain_lion end head do url "https://github.com/arvidn/libtorrent.git" depends_on "automake" => :build depends_on "autoconf" => :build depends_on "libtool" => :build end depends_on "pkg-config" => :build depends_on "openssl" depends_on :python => :optional depends_on "geoip" => :optional depends_on "boost" depends_on "boost-python" if build.with? "python" def install args = ["--disable-debug", "--disable-dependency-tracking", "--disable-silent-rules", "--enable-encryption", "--prefix=#{prefix}", "--with-boost=#{Formula["boost"].opt_prefix}"] # Build python bindings requires forcing usage of the mt version of boost_python. if build.with? "python" args << "--enable-python-binding" args << "--with-boost-python=boost_python-mt" end if build.with? "geoip" args << "--enable-geoip" args << "--with-libgeoip" end if build.head? system "./bootstrap.sh", *args else system "./configure", *args end system "make", "install" libexec.install "examples" end test do system ENV.cxx, "-L#{lib}", "-ltorrent-rasterbar", "-I#{Formula["boost"].include}/boost", "-lboost_system", libexec/"examples/make_torrent.cpp", "-o", "test" system "./test", test_fixtures("test.mp3"), "-o", "test.torrent" File.exist? testpath/"test.torrent" end end