aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/rhash.rb
blob: b4e1089e1ced5e3f7bfc5aece0f0f66e6093ed24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
class Rhash < Formula
  homepage 'http://rhash.anz.ru/'
  url 'https://downloads.sourceforge.net/project/rhash/rhash/1.3.2/rhash-1.3.2-src.tar.gz'
  sha256 '074224f59fe69969108e1ebc23ee406a7f2eff95d9dc1c7aa8eaebb85c8142dd'

  bottle do
    cellar :any
    sha1 "cb5c136e11633ffb2bb28248e61ef468a724a6a5" => :mavericks
    sha1 "25acb04254d9b202a7a016e89b28898fed48d65a" => :mountain_lion
    sha1 "0ea791f790338589aea739b56948b126e5e75f1d" => :lion
  end

  # Upstream issue: https://github.com/rhash/RHash/pull/7
  # This patch will need to be in place permanently.
  patch :DATA

  def install
    # install target isn't parallel-safe
    ENV.j1

    system "make", "lib-static", "lib-shared", "all", "CC=#{ENV.cc}"

    system "make", "install-lib-static", "install-lib-shared", "install", "PREFIX=",
                              "DESTDIR=#{prefix}", "CC=#{ENV.cc}"
  end

  test do
    (testpath/"test").write("test")
    (testpath/"test.sha1").write("a94a8fe5ccb19ba61c4c0873d391e987982fbbd3 test")
    system "#{bin}/rhash", "-c", "test.sha1"
  end
end

__END__
--- a/librhash/Makefile	2014-04-20 14:20:22.000000000 +0200
+++ b/librhash/Makefile	2014-04-20 14:40:02.000000000 +0200
@@ -26,8 +26,8 @@
 INCDIR  = $(PREFIX)/include
 LIBDIR  = $(PREFIX)/lib
 LIBRARY = librhash.a
-SONAME  = librhash.so.0
-SOLINK  = librhash.so
+SONAME  = librhash.0.dylib
+SOLINK  = librhash.dylib
 TEST_TARGET = test_hashes
 TEST_SHARED = test_shared
 # Set variables according to GNU coding standard
@@ -176,8 +176,7 @@

 # shared and static libraries
 $(SONAME): $(SOURCES)
-	sed -n '1s/.*/{ global:/p; s/^RHASH_API.* \([a-z0-9_]\+\)(.*/  \1;/p; $$s/.*/local: *; };/p' $(LIB_HEADERS) > exports.sym
-	$(CC) -fpic $(ALLCFLAGS) -shared $(SOURCES) -Wl,--version-script,exports.sym,-soname,$(SONAME) $(LIBLDFLAGS) -o $@
+	$(CC) -fpic $(ALLCFLAGS) -dynamiclib $(SOURCES) $(LIBLDFLAGS) -Wl,-install_name,$(PREFIX)/lib/$@ -o $@
 	ln -s $(SONAME) $(SOLINK)
 # use 'nm -Cg --defined-only $@' to view exported symbols