aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/lmdb.rb
blob: 7f70f220f3b2c3fb43b3e4e6efa9d24148836826 (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
require 'formula'

class Lmdb < Formula
  homepage 'http://symas.com/mdb/'
  url 'ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/openldap-2.4.35.tgz'
  sha1 'db02243150b050baac6a8ea4145ad73a1f6d2266'

  head 'git://git.openldap.org/openldap.git', :branch => 'mdb.master'

  def install
    # .so -> .dylib
    inreplace 'libraries/liblmdb/Makefile', ".so", ".dylib"

    # fix non-POSIX `cp` multiple source files
    inreplace 'libraries/liblmdb/Makefile' do |s|
      s.gsub! 'cp $(IPROGS) $(DESTDIR)$(prefix)/bin',
              'for f in $(IPROGS); do cp $$f $(DESTDIR)$(prefix)/bin/; done'
      s.gsub! 'cp $(ILIBS) $(DESTDIR)$(prefix)/lib',
              'for f in $(ILIBS); do cp $$f $(DESTDIR)$(prefix)/lib/; done'
      s.gsub! 'cp $(IHDRS) $(DESTDIR)$(prefix)/include',
              'for f in $(IHDRS); do cp $$f $(DESTDIR)$(prefix)/include/; done'
      # also fix the /share/man/man path as well
      s.gsub! 'cp $(IDOCS) $(DESTDIR)$(prefix)/man/man1',
              'for f in $(IDOCS); do cp $$f $(DESTDIR)$(prefix)/share/man/; done'
    end

    man.mkpath
    bin.mkpath
    lib.mkpath
    include.mkpath

    cd 'libraries/liblmdb' do
      system "make", "install", "prefix=#{prefix}"
    end
  end
end