From 492084472ff05851ff5e1cbb5df4590d94c54ed7 Mon Sep 17 00:00:00 2001 From: ilovezfs Date: Thu, 12 May 2016 16:58:27 -0700 Subject: [PATCH] zpaq 7.13 (devel) - devel spec for the latest version - zpaq >7.05 does not yet have an OS X compatible Makefile, so adapt it - backport new Makefile to 7.05 - use upstream's test case Closes #1013. Signed-off-by: ilovezfs --- Formula/zpaq.rb | 72 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 57 insertions(+), 15 deletions(-) diff --git a/Formula/zpaq.rb b/Formula/zpaq.rb index c5fa738f6a..02c42d0f2d 100644 --- a/Formula/zpaq.rb +++ b/Formula/zpaq.rb @@ -1,12 +1,21 @@ class Zpaq < Formula desc "Incremental, journaling command-line archiver" homepage "http://mattmahoney.net/dc/zpaq.html" - url "http://mattmahoney.net/dc/zpaq705.zip" - sha256 "d8abe3e3620d4c6f3ddc1da149acffa4c24296fd9c74c9d7b62319e308b63334" - version "7.05" - + revision 1 head "https://github.com/zpaq/zpaq.git" + stable do + url "http://mattmahoney.net/dc/zpaq705.zip" + sha256 "d8abe3e3620d4c6f3ddc1da149acffa4c24296fd9c74c9d7b62319e308b63334" + version "7.05" + + # Should be removed once >7.05 ships as stable + resource "backport_makefile" do + url "http://mattmahoney.net/dc/zpaq713.zip" + sha256 "9120cf4fb1afdecea3ac4f690d7b0577f7cb004ca6b152856edd8ac444f0d919" + end + end + bottle do cellar :any_skip_relocation sha256 "f0998826effe4dae407d041c4143a39b3645dc46a82456b4e86ac88f106babd3" => :el_capitan @@ -15,20 +24,53 @@ class Zpaq < Formula sha256 "a2d2215b51cc18370f5ebe700160d1d7143ce5d680b2365a5adb4bb1622d06fc" => :mountain_lion end - def install - system "make" - include.install "libzpaq.h" - bin.install "zpaq" + devel do + url "http://mattmahoney.net/dc/zpaq713.zip" + sha256 "9120cf4fb1afdecea3ac4f690d7b0577f7cb004ca6b152856edd8ac444f0d919" + version "7.13" + end - system "pod2man", "zpaq.pod", "zpaq.1" - man1.install "zpaq.1" + resource "test" do + url "http://mattmahoney.net/dc/calgarytest2.zpaq" + sha256 "b110688939477bbe62263faff1ce488872c68c0352aa8e55779346f1bd1ed07e" + end + + def install + # Should be removed once >7.05 ships as stable + if build.stable? + resource("backport_makefile").stage do + buildpath.install "Makefile" + end + end + + # Makefile introduced for >7.05 has not yet been adapted for OS X + # Reported 12th May 2016 to mattmahoneyfl@gmail.com + inreplace "Makefile" do |s| + # Use OS X style dylib names + s.gsub! "libzpaq.so.0.1", "libzpaq.0.1.dylib" + s.gsub! "libzpaq.so", "libzpaq.dylib" + + # ld: unknown option: -soname + # ld: file not found: libzpaq.0.1.dylib + # use the correct arguments to compile a dylib + s.gsub! "-Wl,-soname,$(SONAME) -o $@ $<", + "-Wl -dynamiclib libzpaq.o zpaq.o -o $(SONAME)" + + # clang: error: no such file or directory: 'zpaq.o' + # libzpaq.0.1.dylib needs both libzpaq.o and zpaq.o + s.gsub! "$(SONAME): libzpaq.o", "$(SONAME): libzpaq.o zpaq.o" + + # OS X `install` command doesn't have `-t` + s.gsub! /(install -m.* )-t (.*) (.*)(\r)/, "\\1 \\3 \\2\\4" + end + + system "make" + system "make", "check" + system "make", "install", "PREFIX=#{prefix}" end test do - archive = testpath/"test.zpaq" - zpaq = bin/"zpaq" - system zpaq, "a", archive, "#{include}/libzpaq.h" - system zpaq, "l", archive - assert_equal "7kSt", archive.read(4) + resource("test").stage testpath + assert_match /all OK/, shell_output("#{bin}/zpaq x calgarytest2.zpaq 2>&1") end end