Skip to content

Instantly share code, notes, and snippets.

@sormy
Last active October 25, 2017 03:15
Show Gist options
  • Save sormy/587dd7652a6d2281d8eeb31df5adf085 to your computer and use it in GitHub Desktop.
Save sormy/587dd7652a6d2281d8eeb31df5adf085 to your computer and use it in GitHub Desktop.
rtorrent / libtorrent | 2017.10
class Libtorrent < Formula
homepage "https://github.com/rakshasa/libtorrent"
head "https://github.com/rakshasa/libtorrent.git"
url "https://github.com/rakshasa/libtorrent.git", :tag => "0.13.6"
version "0.13.6"
bottle :disable,
"Cannot be built with Clang so bottle depends on GCC at runtime."
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "pkg-config" => :build
#depends_on "cppunit" => :build
depends_on "pkg-config" => :build
depends_on "openssl"
option "with-sequential-download", "Build with sequential download"
if build.with? "sequential-download"
patch do
url "https://gist.githubusercontent.com/sormy/25404b53872e44f035cf204dfe14aae6/raw/ebbb4552075c311056442b7c84f723c5c1993d63/libtorrent-sequential-download.patch"
sha256 "def0d9eba8e0856e88f05d78f0046402cf49b17efbfc9594c12569df83d35787"
end
end
# https://github.com/Homebrew/homebrew/issues/24132
fails_with :clang do
cause "Causes segfaults at startup/at random."
end
def install
# Currently can't build against libc++; see:
# https://github.com/homebrew/homebrew/issues/23483
# https://github.com/rakshasa/libtorrent/issues/47
ENV.libstdcxx if ENV.compiler == :clang
if build.head?
inreplace "configure.ac", "PKG_CHECK_MODULES([CPPUNIT]", "#PKG_CHECK_MODULES([CPPUNIT]"
else
inreplace "configure.ac", "AM_PATH_CPPUNIT", "#AM_PATH_CPPUNIT"
end
system "sh", "autogen.sh"
system "./configure", "--prefix=#{prefix}",
"--disable-debug",
"--disable-dependency-tracking",
"--with-kqueue",
"--enable-ipv6"
system "make"
system "make", "install"
end
end
class Rtorrent < Formula
homepage "https://github.com/rakshasa/rtorrent"
head "https://github.com/rakshasa/rtorrent.git"
url "https://github.com/rakshasa/rtorrent.git", :tag => "0.9.6"
version "0.9.6"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "pkg-config" => :build
#depends_on "cppunit" => :build
depends_on "libtorrent"
depends_on "xmlrpc-c" => :optional
# https://github.com/Homebrew/homebrew/issues/24132
fails_with :clang do
cause "Causes segfaults at startup/at random."
end
def install
# Commented out since we're now marked as failing with clang - adamv
# ENV.libstdcxx if ENV.compiler == :clang
if build.head?
inreplace "configure.ac", "PKG_CHECK_MODULES([CPPUNIT]", "#PKG_CHECK_MODULES([CPPUNIT]"
else
inreplace "configure.ac", "AM_PATH_CPPUNIT", "#AM_PATH_CPPUNIT"
end
args = ["--disable-debug", "--disable-dependency-tracking", "--prefix=#{prefix}"]
args << "--with-xmlrpc-c" if build.with? "xmlrpc-c"
if MacOS.version <= :leopard
inreplace "configure" do |s|
s.gsub! ' pkg_cv_libcurl_LIBS=`$PKG_CONFIG --libs "libcurl >= 7.15.4" 2>/dev/null`',
' pkg_cv_libcurl_LIBS=`$PKG_CONFIG --libs "libcurl >= 7.15.4" | sed -e "s/-arch [^-]*/-arch $(uname -m) /" 2>/dev/null`'
end
end
system "sh", "autogen.sh"
system "./configure", *args
system "make"
system "make", "install"
doc.install "doc/rtorrent.rc"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment