hamsterdb: fix HEAD, add Java option

Closes Homebrew/homebrew#22573.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
master
Johnathan Conley 2013-09-15 14:57:10 -05:00 committed by Adam Vandenberg
parent 7890abb371
commit 2d45c20d9a
1 changed files with 36 additions and 10 deletions

View File

@ -1,10 +1,38 @@
require 'formula' require 'formula'
class JavaRequirement < Requirement
fatal true
def self.jdk_home
[
`/usr/libexec/java_home`.chomp,
ENV['JAVA_HOME']
].find { |dir| dir && File.exists?("#{dir}/bin/javac") && File.exists?("#{dir}/include") }
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
class Hamsterdb < Formula class Hamsterdb < Formula
homepage 'http://hamsterdb.com' homepage 'http://hamsterdb.com'
url 'http://hamsterdb.com/dl/hamsterdb-2.1.2.tar.gz' url 'http://hamsterdb.com/dl/hamsterdb-2.1.2.tar.gz'
sha256 '5d1adbd25aad38646c83b8db013dc02af563c2447bd79b25aeac6cc287d098b0' sha256 '5d1adbd25aad38646c83b8db013dc02af563c2447bd79b25aeac6cc287d098b0'
option 'without-java', 'Do not build the Java wrapper'
option 'without-remote', 'Disable access to remote databases'
head do head do
url 'https://github.com/cruppstahl/hamsterdb.git', :branch => 'topic/next' url 'https://github.com/cruppstahl/hamsterdb.git', :branch => 'topic/next'
@ -12,11 +40,9 @@ class Hamsterdb < Formula
depends_on 'libtool' => :build depends_on 'libtool' => :build
end end
option 'without-java', 'Do not build the Java wrapper'
option 'without-remote', 'Disable access to remote databases'
depends_on 'boost' depends_on 'boost'
depends_on 'gnutls' depends_on 'gnutls'
depends_on JavaRequirement if build.with? 'java'
if build.with? 'remote' if build.with? 'remote'
depends_on 'protobuf' depends_on 'protobuf'
@ -24,21 +50,21 @@ class Hamsterdb < Formula
end end
def install def install
system '/bin/sh', 'bootstrap.sh' if build.head?
if build.head?
inreplace 'bootstrap.sh', /^libtoolize/, 'glibtoolize'
system "./bootstrap.sh"
end
features = [] features = []
features << '--disable-java' if build.without? 'java'
features << '--disable-remote' if build.without? 'remote' features << '--disable-remote' if build.without? 'remote'
if build.with? 'java'
features << "JDK=#{JavaRequirement.jdk_home}"
else
features << '--disable-java'
end
system "./configure", "--disable-debug", "--disable-dependency-tracking", system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}", "--prefix=#{prefix}",
*features *features
system "make", "install" system "make", "install"
end end
test do test do