2015-08-15 10:33:11 +00:00
|
|
|
class Asio < Formula
|
|
|
|
desc "Cross-platform C++ Library for asynchronous programming"
|
2015-10-04 22:32:02 +00:00
|
|
|
homepage "https://think-async.com/Asio"
|
2016-11-06 06:50:36 +00:00
|
|
|
url "https://downloads.sourceforge.net/project/asio/asio/1.10.8%20%28Stable%29/asio-1.10.8.tar.bz2"
|
|
|
|
sha256 "26deedaebbed062141786db8cfce54e77f06588374d08cccf11c02de1da1ed49"
|
2017-01-04 16:17:47 +00:00
|
|
|
revision 1
|
2015-08-15 10:33:11 +00:00
|
|
|
head "https://github.com/chriskohlhoff/asio.git"
|
|
|
|
|
2015-10-03 15:58:06 +00:00
|
|
|
bottle do
|
2017-01-04 21:20:09 +00:00
|
|
|
cellar :any
|
|
|
|
sha256 "d4cb235f7e5f96448fc62695b97bd122ecdb736ba8690acd1dea58d6e839fe96" => :sierra
|
|
|
|
sha256 "0bf76623d1395bb82adead05534efce7dbfb57ebc369ce50d5c8c54cb5ced22a" => :el_capitan
|
|
|
|
sha256 "03448870924ff06ec9ae67c1db2bc656bc73fac49d25ea24be925d945e602378" => :yosemite
|
2015-10-03 15:58:06 +00:00
|
|
|
end
|
|
|
|
|
2015-08-15 10:33:11 +00:00
|
|
|
devel do
|
|
|
|
url "https://downloads.sourceforge.net/project/asio/asio/1.11.0%20%28Development%29/asio-1.11.0.tar.bz2"
|
|
|
|
sha256 "4f7e13260eea67412202638ec111cb5014f44bdebe96103279c60236874daa50"
|
|
|
|
end
|
|
|
|
|
|
|
|
option "with-boost-coroutine", "Use Boost.Coroutine to implement stackful coroutines"
|
|
|
|
option :cxx11
|
|
|
|
|
|
|
|
depends_on "autoconf" => :build
|
|
|
|
depends_on "automake" => :build
|
2017-01-04 16:17:47 +00:00
|
|
|
|
|
|
|
depends_on "boost" => :optional
|
|
|
|
depends_on "boost" if build.with?("boost-coroutine")
|
2015-08-15 10:33:11 +00:00
|
|
|
depends_on "openssl"
|
|
|
|
|
2017-01-04 16:17:47 +00:00
|
|
|
needs :cxx11 if build.without? "boost"
|
|
|
|
|
2015-08-15 10:33:11 +00:00
|
|
|
def install
|
2017-01-04 16:17:47 +00:00
|
|
|
ENV.cxx11 if build.cxx11? || build.without?("boost")
|
|
|
|
|
2015-08-15 10:33:11 +00:00
|
|
|
if build.head?
|
|
|
|
cd "asio"
|
|
|
|
system "./autogen.sh"
|
|
|
|
else
|
|
|
|
system "autoconf"
|
|
|
|
end
|
|
|
|
args = %W[
|
|
|
|
--disable-dependency-tracking
|
|
|
|
--disable-silent-rules
|
|
|
|
--prefix=#{prefix}
|
2017-01-04 16:17:47 +00:00
|
|
|
--with-boost=#{(build.with?("boost") || build.with?("boost-coroutine")) ? Formula["boost"].opt_include : "no"}
|
2015-08-15 10:33:11 +00:00
|
|
|
]
|
|
|
|
args << "--enable-boost-coroutine" if build.with? "boost-coroutine"
|
|
|
|
|
|
|
|
system "./configure", *args
|
|
|
|
system "make", "install"
|
|
|
|
pkgshare.install "src/examples"
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2017-01-04 16:17:47 +00:00
|
|
|
found = [pkgshare/"examples/cpp11/http/server/http_server",
|
|
|
|
pkgshare/"examples/cpp03/http/server/http_server"].select(&:exist?)
|
|
|
|
raise "no http_server example file found" if found.empty?
|
2015-08-15 10:33:11 +00:00
|
|
|
pid = fork do
|
2017-01-04 16:17:47 +00:00
|
|
|
exec found.first, "127.0.0.1", "8080", "."
|
2015-08-15 10:33:11 +00:00
|
|
|
end
|
|
|
|
sleep 1
|
|
|
|
begin
|
|
|
|
assert_match /404 Not Found/, shell_output("curl http://127.0.0.1:8080")
|
|
|
|
ensure
|
|
|
|
Process.kill 9, pid
|
|
|
|
Process.wait pid
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|