2013-08-30 15:42:39 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2013-09-15 19:57:10 +00:00
|
|
|
class JavaRequirement < Requirement
|
|
|
|
fatal true
|
|
|
|
|
|
|
|
def self.jdk_home
|
|
|
|
[
|
|
|
|
`/usr/libexec/java_home`.chomp,
|
|
|
|
ENV['JAVA_HOME']
|
2013-12-09 19:44:45 +00:00
|
|
|
].find { |dir| dir && File.exist?("#{dir}/bin/javac") && File.exist?("#{dir}/include") }
|
2013-09-15 19:57:10 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
satisfy :build_env => false do
|
|
|
|
self.class.jdk_home
|
|
|
|
end
|
|
|
|
|
|
|
|
def message; <<-EOS.undent
|
|
|
|
Could not find a JDK (i.e. not a JRE)
|
|
|
|
|
|
|
|
Do one of the following:
|
|
|
|
- install a JDK that is detected with /usr/libexec/java_home
|
|
|
|
- set the JAVA_HOME environment variable
|
|
|
|
- specify --without-java
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-08-30 15:42:39 +00:00
|
|
|
class Hamsterdb < Formula
|
|
|
|
homepage 'http://hamsterdb.com'
|
2014-05-06 13:32:13 +00:00
|
|
|
url "http://hamsterdb.com/dl/hamsterdb-2.1.7.tar.gz"
|
|
|
|
sha1 "4ce5a0004e7f1fee28fcec0ee9c5478be5aad25c"
|
2013-08-30 15:42:39 +00:00
|
|
|
|
2013-09-15 19:57:10 +00:00
|
|
|
option 'without-java', 'Do not build the Java wrapper'
|
|
|
|
option 'without-remote', 'Disable access to remote databases'
|
|
|
|
|
2013-09-20 15:15:56 +00:00
|
|
|
head do
|
|
|
|
url 'https://github.com/cruppstahl/hamsterdb.git', :branch => 'topic/next'
|
|
|
|
|
2013-11-13 17:01:29 +00:00
|
|
|
depends_on 'autoconf' => :build
|
2013-09-20 15:15:56 +00:00
|
|
|
depends_on 'automake' => :build
|
|
|
|
depends_on 'libtool' => :build
|
|
|
|
end
|
|
|
|
|
2013-08-30 15:42:39 +00:00
|
|
|
depends_on 'boost'
|
|
|
|
depends_on 'gnutls'
|
2013-09-15 19:57:10 +00:00
|
|
|
depends_on JavaRequirement if build.with? 'java'
|
2013-08-30 15:42:39 +00:00
|
|
|
|
|
|
|
if build.with? 'remote'
|
|
|
|
depends_on 'protobuf'
|
|
|
|
depends_on 'libuv'
|
|
|
|
end
|
|
|
|
|
|
|
|
def install
|
2013-09-15 19:57:10 +00:00
|
|
|
system '/bin/sh', 'bootstrap.sh' if build.head?
|
2013-08-30 15:42:39 +00:00
|
|
|
|
|
|
|
features = []
|
|
|
|
features << '--disable-remote' if build.without? 'remote'
|
|
|
|
|
2013-09-15 19:57:10 +00:00
|
|
|
if build.with? 'java'
|
|
|
|
features << "JDK=#{JavaRequirement.jdk_home}"
|
|
|
|
else
|
|
|
|
features << '--disable-java'
|
|
|
|
end
|
|
|
|
|
2013-08-30 15:42:39 +00:00
|
|
|
system "./configure", "--disable-debug", "--disable-dependency-tracking",
|
|
|
|
"--prefix=#{prefix}",
|
|
|
|
*features
|
|
|
|
system "make", "install"
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
system "#{bin}/ham_info -h"
|
|
|
|
end
|
|
|
|
end
|