rename berkeley-db4 => berkeley-db@4

This commit is contained in:
Gastón I. Silva 2017-02-13 03:19:59 -08:00 committed by Mike McQuaid
parent ef1f3f5081
commit 55e73bd2d5
2 changed files with 44 additions and 9 deletions

View file

@ -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__
@ -52,13 +86,13 @@ index 0034dcc..50b8b74 100644
+ __atomic_compare_exchange_db((p), (o), (n))
static inline int __atomic_inc(db_atomic_t *p)
{
int temp;
int temp;
@@ -176,7 +176,7 @@ static inline int __atomic_dec(db_atomic_t *p)
* http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html
* which configure could be changed to use.
*/
-static inline int __atomic_compare_exchange(
+static inline int __atomic_compare_exchange_db(
db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval)
db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval)
{
atomic_value_t was;
atomic_value_t was;

View file

@ -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",