rename berkeley-db4 => berkeley-db@4
parent
ef1f3f5081
commit
55e73bd2d5
|
@ -1,4 +1,4 @@
|
|||
class BerkeleyDb4 < Formula
|
||||
class BerkeleyDbAT4 < Formula
|
||||
desc "High performance key/value database"
|
||||
homepage "https://www.oracle.com/technology/products/berkeley-db/index.html"
|
||||
url "http://download.oracle.com/berkeley-db/db-4.8.30.tar.gz"
|
||||
|
@ -13,7 +13,7 @@ class BerkeleyDb4 < Formula
|
|||
sha256 "04fc8d3b03381d87b3852ac1756dd144a10e7ac47444fa3e81dec0fc8ea33d25" => :mountain_lion
|
||||
end
|
||||
|
||||
keg_only "BDB 4.8.30 is provided for software that doesn't compile against newer versions."
|
||||
keg_only :versioned_formula
|
||||
|
||||
# Fix build under Xcode 4.6
|
||||
patch :DATA
|
||||
|
@ -22,10 +22,12 @@ class BerkeleyDb4 < Formula
|
|||
# BerkeleyDB dislikes parallel builds
|
||||
ENV.deparallelize
|
||||
|
||||
args = ["--disable-debug",
|
||||
"--prefix=#{prefix}",
|
||||
"--mandir=#{man}",
|
||||
"--enable-cxx"]
|
||||
args = %W[
|
||||
--disable-debug
|
||||
--prefix=#{prefix}
|
||||
--mandir=#{man}
|
||||
--enable-cxx
|
||||
]
|
||||
|
||||
# BerkeleyDB requires you to build everything from the build_unix subdirectory
|
||||
cd "build_unix" do
|
||||
|
@ -37,6 +39,38 @@ class BerkeleyDb4 < Formula
|
|||
mv prefix+"docs", doc
|
||||
end
|
||||
end
|
||||
|
||||
test do
|
||||
(testpath/"test.cpp").write <<-EOS.undent
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <db_cxx.h>
|
||||
int main() {
|
||||
Db db(NULL, 0);
|
||||
assert(db.open(NULL, "test.db", NULL, DB_BTREE, DB_CREATE, 0) == 0);
|
||||
|
||||
const char *project = "Homebrew";
|
||||
const char *stored_description = "The missing package manager for macOS";
|
||||
Dbt key(const_cast<char *>(project), strlen(project) + 1);
|
||||
Dbt stored_data(const_cast<char *>(stored_description), strlen(stored_description) + 1);
|
||||
assert(db.put(NULL, &key, &stored_data, DB_NOOVERWRITE) == 0);
|
||||
|
||||
Dbt returned_data;
|
||||
assert(db.get(NULL, &key, &returned_data, 0) == 0);
|
||||
assert(strcmp(stored_description, (const char *)(returned_data.get_data())) == 0);
|
||||
|
||||
assert(db.close(0) == 0);
|
||||
}
|
||||
EOS
|
||||
flags = %W[
|
||||
-I#{include}
|
||||
-L#{lib}
|
||||
-ldb_cxx
|
||||
]
|
||||
system ENV.cxx, "test.cpp", "-o", "test", *flags
|
||||
system "./test"
|
||||
assert (testpath/"test.db").exist?
|
||||
end
|
||||
end
|
||||
|
||||
__END__
|
|
@ -10,6 +10,7 @@
|
|||
"autoconf264": "autoconf@264",
|
||||
"automake112": "automake@112",
|
||||
"beanstalk": "beanstalkd",
|
||||
"berkeley-db4": "berkeley-db@4",
|
||||
"cloog-ppl015": "cloog@0.15",
|
||||
"cloog018": "cloog",
|
||||
"commonmark": "cmark",
|
||||
|
|
Loading…
Reference in New Issue