homebrew-core/Formula/s6.rb
2018-01-04 08:03:20 -08:00

91 lines
2.8 KiB
Ruby

class S6 < Formula
desc "Small & secure supervision software suite"
homepage "https://skarnet.org/software/s6/"
stable do
url "https://skarnet.org/software/s6/s6-2.7.0.0.tar.gz"
sha256 "6617cbf82c73273c67c6102a1a5c48449ef65ffbe8d0db6a587b7f0078dc6e13"
resource "skalibs" do
url "https://skarnet.org/software/skalibs/skalibs-2.6.3.0.tar.gz"
sha256 "81d63a1918189036e9cc679d9b327d36a6056bba89132f35bb1c45b50ceb7226"
end
resource "execline" do
url "https://skarnet.org/software/execline/execline-2.3.0.4.tar.gz"
sha256 "e4bb8fc8f20cca96f4bac9f0f74ebce5081b4b687bb11c79c843faf12507a64b"
end
end
bottle do
sha256 "d86576c3f1a5de27e7ad20890b4feb37b85c4499f227f2bfafb3f9858ba8af8c" => :high_sierra
sha256 "ad3b91fffc60e2bd5f2e7b6bf281fb8500b229594d30b821b7050097abf3d1e0" => :sierra
sha256 "4051fe376e02606a46220436a90d20f0fc910556a1bde778bd15d3b23187d3a7" => :el_capitan
end
head do
url "git://git.skarnet.org/s6"
resource "skalibs" do
url "git://git.skarnet.org/skalibs"
end
resource "execline" do
url "git://git.skarnet.org/execline"
end
end
def install
resources.each { |r| r.stage(buildpath/r.name) }
build_dir = buildpath/"build"
cd "skalibs" do
system "./configure", "--disable-shared", "--prefix=#{build_dir}", "--libdir=#{build_dir}/lib"
system "make", "install"
end
cd "execline" do
system "./configure",
"--prefix=#{build_dir}",
"--bindir=#{libexec}/execline",
"--with-include=#{build_dir}/include",
"--with-lib=#{build_dir}/lib",
"--with-sysdeps=#{build_dir}/lib/skalibs/sysdeps",
"--disable-shared"
system "make", "install"
end
system "./configure",
"--prefix=#{prefix}",
"--libdir=#{build_dir}/lib",
"--includedir=#{build_dir}/include",
"--with-include=#{build_dir}/include",
"--with-lib=#{build_dir}/lib",
"--with-lib=#{build_dir}/lib/execline",
"--with-sysdeps=#{build_dir}/lib/skalibs/sysdeps",
"--disable-static",
"--disable-shared"
system "make", "install"
# Some S6 tools expect execline binaries to be on the path
bin.env_script_all_files(libexec/"bin", :PATH => "#{libexec}/execline:$PATH")
sbin.env_script_all_files(libexec/"sbin", :PATH => "#{libexec}/execline:$PATH")
(bin/"execlineb").write_env_script libexec/"execline/execlineb", :PATH => "#{libexec}/execline:$PATH"
end
test do
# Test execline
test_script = testpath/"test.eb"
test_script.write <<~EOS
import PATH
if { [ ! -z ${PATH} ] }
true
EOS
system "#{bin}/execlineb", test_script
# Test s6
(testpath/"log").mkpath
pipe_output("#{bin}/s6-log #{testpath}/log", "Test input\n")
assert_equal "Test input\n", File.read(testpath/"log/current")
end
end