Skip to content

Commit

Permalink
rename berkeley-db4 => berkeley-db@4
Browse files Browse the repository at this point in the history
  • Loading branch information
givanse authored and MikeMcQuaid committed Feb 14, 2017
1 parent ef1f3f5 commit 55e73bd
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 9 deletions.
52 changes: 43 additions & 9 deletions Formula/berkeley-db4.rb → Formula/berkeley-db@4.rb
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
Expand All @@ -22,10 +22,12 @@ def install
# 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
Expand All @@ -37,6 +39,38 @@ def install
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__
Expand All @@ -52,13 +86,13 @@ def install
+ __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;
1 change: 1 addition & 0 deletions formula_renames.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 55e73bd

Please sign in to comment.