homebrew-core/Formula/upscaledb.rb
2018-08-27 07:59:21 +02:00

102 lines
3.1 KiB
Ruby

class Upscaledb < Formula
desc "Database for embedded devices"
homepage "https://upscaledb.com/"
revision 9
stable do
url "http://files.upscaledb.com/dl/upscaledb-2.2.0.tar.gz"
mirror "https://dl.bintray.com/homebrew/mirror/upscaledb-2.2.0.tar.gz"
sha256 "7d0d1ace47847a0f95a9138637fcaaf78b897ef682053e405e2c0865ecfd253e"
# Remove for > 2.2.2
# Upstream commit from 12 Feb 2018 "Fix compilation with Boost 1.66 (#110)"
patch do
url "https://github.com/cruppstahl/upscaledb/commit/01156f9a8.patch?full_index=1"
sha256 "e65b9f2b624b7cdad00c3c1444721cadd615688556d8f0bb389d15f5f5f4f430"
end
end
bottle do
cellar :any
sha256 "f86a6b8e06fd0536e0739c514d38bd4b273c9c4286da6ecbfa37bc1a88a961f6" => :mojave
sha256 "2642107106509f9073ffc0ad62f74ab039dacd48be389ea5ff3347dae3a65a5d" => :high_sierra
sha256 "43f48b9e6ff66ff42b6e83482aae98c463af219cf818976879903ad696a7367f" => :sierra
sha256 "3ae60c268a06e01345d3ac36e704a9033fd3365cd93369531ec3ac65f0a5583b" => :el_capitan
end
head do
url "https://github.com/cruppstahl/upscaledb.git"
depends_on "automake" => :build
depends_on "autoconf" => :build
depends_on "libtool" => :build
end
option "without-java", "Do not build the Java wrapper"
option "without-protobuf", "Disable access to remote databases"
deprecated_option "without-remote" => "without-protobuf"
depends_on "boost"
depends_on "gnutls"
depends_on "openssl"
depends_on :java => :recommended
depends_on "protobuf" => :recommended
resource "libuv" do
url "https://github.com/libuv/libuv/archive/v0.10.37.tar.gz"
sha256 "4c12bed4936dc16a20117adfc5bc18889fa73be8b6b083993862628469a1e931"
end
fails_with :clang do
build 503
cause "error: member access into incomplete type 'const std::type_info"
end
def install
# Fix collision with isset() in <sys/params.h>
# See https://github.com/Homebrew/homebrew-core/pull/4145
inreplace "./src/5upscaledb/upscaledb.cc",
"# include \"2protobuf/protocol.h\"",
"# include \"2protobuf/protocol.h\"\n#define isset(f, b) (((f) & (b)) == (b))"
system "./bootstrap.sh" if build.head?
args = %W[
--disable-debug
--disable-dependency-tracking
--prefix=#{prefix}
]
if build.with? "java"
args << "JDK=#{ENV["JAVA_HOME"]}"
else
args << "--disable-java"
end
if build.with? "protobuf"
resource("libuv").stage do
system "make", "libuv.dylib", "SO_LDFLAGS=-Wl,-install_name,#{libexec}/libuv/lib/libuv.dylib"
(libexec/"libuv/lib").install "libuv.dylib"
(libexec/"libuv").install "include"
end
ENV.prepend "LDFLAGS", "-L#{libexec}/libuv/lib"
ENV.prepend "CFLAGS", "-I#{libexec}/libuv/include"
ENV.prepend "CPPFLAGS", "-I#{libexec}/libuv/include"
else
args << "--disable-remote"
end
system "./configure", *args
system "make", "install"
pkgshare.install "samples"
end
test do
system ENV.cc, "-I#{include}", "-L#{lib}", "-lupscaledb",
pkgshare/"samples/db1.c", "-o", "test"
system "./test"
end
end