summary refs log tree commit diff
path: root/pkgs/development/libraries
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2016-11-13 22:48:52 +0100
committerDaiderd Jordan <daiderd@gmail.com>2016-11-13 23:02:00 +0100
commitb82ad1ba7695e92421e168c26d1915c00f4374ce (patch)
tree6492125286bc870ec305fa719b7cba5d2e676622 /pkgs/development/libraries
parentc7d1925b6eb805acbeba9e9324969bf67965d350 (diff)
downloadnixpkgs-b82ad1ba7695e92421e168c26d1915c00f4374ce.tar
nixpkgs-b82ad1ba7695e92421e168c26d1915c00f4374ce.tar.gz
nixpkgs-b82ad1ba7695e92421e168c26d1915c00f4374ce.tar.bz2
nixpkgs-b82ad1ba7695e92421e168c26d1915c00f4374ce.tar.lz
nixpkgs-b82ad1ba7695e92421e168c26d1915c00f4374ce.tar.xz
nixpkgs-b82ad1ba7695e92421e168c26d1915c00f4374ce.tar.zst
nixpkgs-b82ad1ba7695e92421e168c26d1915c00f4374ce.zip
db: fix all versions with libc++3.8
Diffstat (limited to 'pkgs/development/libraries')
-rw-r--r--pkgs/development/libraries/db/clang-4.8.patch138
-rw-r--r--pkgs/development/libraries/db/clang-5.3.patch4
-rw-r--r--pkgs/development/libraries/db/clang-6.0.patch136
-rw-r--r--pkgs/development/libraries/db/cygwin-4.4.patch21
-rw-r--r--pkgs/development/libraries/db/cygwin-4.5.patch22
-rw-r--r--pkgs/development/libraries/db/db-4.8.nix7
-rw-r--r--pkgs/development/libraries/db/db-5.3.nix5
-rw-r--r--pkgs/development/libraries/db/db-6.0.nix2
-rw-r--r--pkgs/development/libraries/db/generic.nix10
-rw-r--r--pkgs/development/libraries/db/register-race-fix.patch47
10 files changed, 286 insertions, 106 deletions
diff --git a/pkgs/development/libraries/db/clang-4.8.patch b/pkgs/development/libraries/db/clang-4.8.patch
index c53160a8297..bbb77891497 100644
--- a/pkgs/development/libraries/db/clang-4.8.patch
+++ b/pkgs/development/libraries/db/clang-4.8.patch
@@ -1,13 +1,22 @@
 diff --git a/dbinc/atomic.h b/dbinc/atomic.h
-index 0034dcc..fa7ba93 100644
+index 0034dcc..160c8ea 100644
 --- a/dbinc/atomic.h
 +++ b/dbinc/atomic.h
+@@ -70,7 +70,7 @@ typedef struct {
+  * These have no memory barriers; the caller must include them when necessary.
+  */
+ #define	atomic_read(p)		((p)->value)
+-#define	atomic_init(p, val)	((p)->value = (val))
++#define	atomic_init_db(p, val)	((p)->value = (val))
+ 
+ #ifdef HAVE_ATOMIC_SUPPORT
+ 
 @@ -144,7 +144,7 @@ typedef LONG volatile *interlocked_val;
  #define	atomic_inc(env, p)	__atomic_inc(p)
  #define	atomic_dec(env, p)	__atomic_dec(p)
  #define	atomic_compare_exchange(env, p, o, n)	\
 -	__atomic_compare_exchange((p), (o), (n))
-+	__db_atomic_compare_exchange((p), (o), (n))
++	__atomic_compare_exchange_int((p), (o), (n))
  static inline int __atomic_inc(db_atomic_t *p)
  {
  	int	temp;
@@ -16,7 +25,130 @@ index 0034dcc..fa7ba93 100644
   * which configure could be changed to use.
   */
 -static inline int __atomic_compare_exchange(
-+static inline int __db_atomic_compare_exchange(
++static inline int __atomic_compare_exchange_int(
  	db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval)
  {
  	atomic_value_t was;
+@@ -206,7 +206,7 @@ static inline int __atomic_compare_exchange(
+ #define	atomic_dec(env, p)	(--(p)->value)
+ #define	atomic_compare_exchange(env, p, oldval, newval)		\
+ 	(DB_ASSERT(env, atomic_read(p) == (oldval)),		\
+-	atomic_init(p, (newval)), 1)
++	atomic_init_db(p, (newval)), 1)
+ #else
+ #define atomic_inc(env, p)	__atomic_inc(env, p)
+ #define atomic_dec(env, p)	__atomic_dec(env, p)
+diff --git a/dbinc/db.in b/dbinc/db.in
+index 9fc6712..7428e0a 100644
+--- a/dbinc/db.in
++++ b/dbinc/db.in
+@@ -2413,7 +2413,7 @@ typedef struct {
+ #define	fetch(a)	__db_dbm_fetch@DB_VERSION_UNIQUE_NAME@(a)
+ #define	firstkey	__db_dbm_firstkey@DB_VERSION_UNIQUE_NAME@
+ #define	nextkey(a)	__db_dbm_nextkey@DB_VERSION_UNIQUE_NAME@(a)
+-#define	store(a, b)	__db_dbm_store@DB_VERSION_UNIQUE_NAME@(a, b)
++#define	store_db(a, b)	__db_dbm_store@DB_VERSION_UNIQUE_NAME@(a, b)
+ 
+ /*******************************************************
+  * Hsearch historic interface.
+diff --git a/mp/mp_fget.c b/mp/mp_fget.c
+index 5fdee5a..0b75f57 100644
+--- a/mp/mp_fget.c
++++ b/mp/mp_fget.c
+@@ -617,7 +617,7 @@ alloc:		/* Allocate a new buffer header and data space. */
+ 
+ 		/* Initialize enough so we can call __memp_bhfree. */
+ 		alloc_bhp->flags = 0;
+-		atomic_init(&alloc_bhp->ref, 1);
++		atomic_init_db(&alloc_bhp->ref, 1);
+ #ifdef DIAGNOSTIC
+ 		if ((uintptr_t)alloc_bhp->buf & (sizeof(size_t) - 1)) {
+ 			__db_errx(env,
+@@ -911,7 +911,7 @@ alloc:		/* Allocate a new buffer header and data space. */
+ 			MVCC_MPROTECT(bhp->buf, mfp->stat.st_pagesize,
+ 			    PROT_READ);
+ 
+-		atomic_init(&alloc_bhp->ref, 1);
++		atomic_init_db(&alloc_bhp->ref, 1);
+ 		MUTEX_LOCK(env, alloc_bhp->mtx_buf);
+ 		alloc_bhp->priority = bhp->priority;
+ 		alloc_bhp->pgno = bhp->pgno;
+diff --git a/mp/mp_mvcc.c b/mp/mp_mvcc.c
+index 34467d2..f05aa0c 100644
+--- a/mp/mp_mvcc.c
++++ b/mp/mp_mvcc.c
+@@ -276,7 +276,7 @@ __memp_bh_freeze(dbmp, infop, hp, bhp, need_frozenp)
+ #else
+ 	memcpy(frozen_bhp, bhp, SSZA(BH, buf));
+ #endif
+-	atomic_init(&frozen_bhp->ref, 0);
++	atomic_init_db(&frozen_bhp->ref, 0);
+ 	if (mutex != MUTEX_INVALID)
+ 		frozen_bhp->mtx_buf = mutex;
+ 	else if ((ret = __mutex_alloc(env, MTX_MPOOL_BH,
+@@ -428,7 +428,7 @@ __memp_bh_thaw(dbmp, infop, hp, frozen_bhp, alloc_bhp)
+ #endif
+ 		alloc_bhp->mtx_buf = mutex;
+ 		MUTEX_LOCK(env, alloc_bhp->mtx_buf);
+-		atomic_init(&alloc_bhp->ref, 1);
++		atomic_init_db(&alloc_bhp->ref, 1);
+ 		F_CLR(alloc_bhp, BH_FROZEN);
+ 	}
+ 
+diff --git a/mp/mp_region.c b/mp/mp_region.c
+index e6cece9..ddbe906 100644
+--- a/mp/mp_region.c
++++ b/mp/mp_region.c
+@@ -224,7 +224,7 @@ __memp_init(env, dbmp, reginfo_off, htab_buckets, max_nreg)
+ 			     MTX_MPOOL_FILE_BUCKET, 0, &htab[i].mtx_hash)) != 0)
+ 				return (ret);
+ 			SH_TAILQ_INIT(&htab[i].hash_bucket);
+-			atomic_init(&htab[i].hash_page_dirty, 0);
++			atomic_init_db(&htab[i].hash_page_dirty, 0);
+ 		}
+ 
+ 		/*
+@@ -269,7 +269,7 @@ __memp_init(env, dbmp, reginfo_off, htab_buckets, max_nreg)
+ 		hp->mtx_hash = (mtx_base == MUTEX_INVALID) ? MUTEX_INVALID :
+ 		    mtx_base + i;
+ 		SH_TAILQ_INIT(&hp->hash_bucket);
+-		atomic_init(&hp->hash_page_dirty, 0);
++		atomic_init_db(&hp->hash_page_dirty, 0);
+ #ifdef HAVE_STATISTICS
+ 		hp->hash_io_wait = 0;
+ 		hp->hash_frozen = hp->hash_thawed = hp->hash_frozen_freed = 0;
+diff --git a/mutex/mut_method.c b/mutex/mut_method.c
+index 2588763..5c6d516 100644
+--- a/mutex/mut_method.c
++++ b/mutex/mut_method.c
+@@ -426,7 +426,7 @@ atomic_compare_exchange(env, v, oldval, newval)
+ 	MUTEX_LOCK(env, mtx);
+ 	ret = atomic_read(v) == oldval;
+ 	if (ret)
+-		atomic_init(v, newval);
++		atomic_init_db(v, newval);
+ 	MUTEX_UNLOCK(env, mtx);
+ 
+ 	return (ret);
+diff --git a/mutex/mut_tas.c b/mutex/mut_tas.c
+index f3922e0..e40fcdf 100644
+--- a/mutex/mut_tas.c
++++ b/mutex/mut_tas.c
+@@ -46,7 +46,7 @@ __db_tas_mutex_init(env, mutex, flags)
+ 
+ #ifdef HAVE_SHARED_LATCHES
+ 	if (F_ISSET(mutexp, DB_MUTEX_SHARED))
+-		atomic_init(&mutexp->sharecount, 0);
++		atomic_init_db(&mutexp->sharecount, 0);
+ 	else
+ #endif
+ 	if (MUTEX_INIT(&mutexp->tas)) {
+@@ -486,7 +486,7 @@ __db_tas_mutex_unlock(env, mutex)
+ 			F_CLR(mutexp, DB_MUTEX_LOCKED);
+ 			/* Flush flag update before zeroing count */
+ 			MEMBAR_EXIT();
+-			atomic_init(&mutexp->sharecount, 0);
++			atomic_init_db(&mutexp->sharecount, 0);
+ 		} else {
+ 			DB_ASSERT(env, sharecount > 0);
+ 			MEMBAR_EXIT();
diff --git a/pkgs/development/libraries/db/clang-5.3.patch b/pkgs/development/libraries/db/clang-5.3.patch
index 0a0993da13e..1cfb13ca8e6 100644
--- a/pkgs/development/libraries/db/clang-5.3.patch
+++ b/pkgs/development/libraries/db/clang-5.3.patch
@@ -16,7 +16,7 @@ index 6a858f7..9f338dc 100644
  #define	atomic_dec(env, p)	__atomic_dec(p)
  #define	atomic_compare_exchange(env, p, o, n)	\
 -	__atomic_compare_exchange((p), (o), (n))
-+	__atomic_compare_exchange_db((p), (o), (n))
++	__atomic_compare_exchange_int((p), (o), (n))
  static inline int __atomic_inc(db_atomic_t *p)
  {
  	int	temp;
@@ -25,7 +25,7 @@ index 6a858f7..9f338dc 100644
   * which configure could be changed to use.
   */
 -static inline int __atomic_compare_exchange(
-+static inline int __atomic_compare_exchange_db(
++static inline int __atomic_compare_exchange_int(
  	db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval)
  {
  	atomic_value_t was;
diff --git a/pkgs/development/libraries/db/clang-6.0.patch b/pkgs/development/libraries/db/clang-6.0.patch
new file mode 100644
index 00000000000..5c1e8f506c4
--- /dev/null
+++ b/pkgs/development/libraries/db/clang-6.0.patch
@@ -0,0 +1,136 @@
+diff --git a/src/dbinc/atomic.h b/src/dbinc/atomic.h
+index e4420aa..4799b5f 100644
+--- a/src/dbinc/atomic.h
++++ b/src/dbinc/atomic.h
+@@ -70,7 +70,7 @@ typedef struct {
+  * These have no memory barriers; the caller must include them when necessary.
+  */
+ #define	atomic_read(p)		((p)->value)
+-#define	atomic_init(p, val)	((p)->value = (val))
++#define	atomic_init_db(p, val)	((p)->value = (val))
+ 
+ #ifdef HAVE_ATOMIC_SUPPORT
+ 
+@@ -225,7 +225,7 @@ static inline int __atomic_compare_exchange_int(
+ #define	atomic_dec(env, p)	(--(p)->value)
+ #define	atomic_compare_exchange(env, p, oldval, newval)		\
+ 	(DB_ASSERT(env, atomic_read(p) == (oldval)),		\
+-	atomic_init(p, (newval)), 1)
++	atomic_init_db(p, (newval)), 1)
+ #else
+ #define	atomic_inc(env, p)	__atomic_inc_int(env, p)
+ #define	atomic_dec(env, p)	__atomic_dec_int(env, p)
+diff --git a/src/dbinc/db.in b/src/dbinc/db.in
+index 3c2ad9b..3e46f02 100644
+--- a/src/dbinc/db.in
++++ b/src/dbinc/db.in
+@@ -2999,7 +2999,7 @@ typedef struct {
+ #define	fetch(a)	__db_dbm_fetch@DB_VERSION_UNIQUE_NAME@(a)
+ #define	firstkey	__db_dbm_firstkey@DB_VERSION_UNIQUE_NAME@
+ #define	nextkey(a)	__db_dbm_nextkey@DB_VERSION_UNIQUE_NAME@(a)
+-#define	store(a, b)	__db_dbm_store@DB_VERSION_UNIQUE_NAME@(a, b)
++#define	store_db(a, b)	__db_dbm_store@DB_VERSION_UNIQUE_NAME@(a, b)
+ 
+ /*******************************************************
+  * Hsearch historic interface.
+diff --git a/src/mp/mp_fget.c b/src/mp/mp_fget.c
+index 59fe9fe..fa4ced7 100644
+--- a/src/mp/mp_fget.c
++++ b/src/mp/mp_fget.c
+@@ -654,7 +654,7 @@ alloc:		/* Allocate a new buffer header and data space. */
+ 
+ 		/* Initialize enough so we can call __memp_bhfree. */
+ 		alloc_bhp->flags = 0;
+-		atomic_init(&alloc_bhp->ref, 1);
++		atomic_init_db(&alloc_bhp->ref, 1);
+ #ifdef DIAGNOSTIC
+ 		if ((uintptr_t)alloc_bhp->buf & (sizeof(size_t) - 1)) {
+ 			__db_errx(env, DB_STR("3025",
+@@ -969,7 +969,7 @@ alloc:		/* Allocate a new buffer header and data space. */
+ 			MVCC_MPROTECT(bhp->buf, mfp->pagesize,
+ 			    PROT_READ);
+ 
+-		atomic_init(&alloc_bhp->ref, 1);
++		atomic_init_db(&alloc_bhp->ref, 1);
+ 		MUTEX_LOCK(env, alloc_bhp->mtx_buf);
+ 		alloc_bhp->priority = bhp->priority;
+ 		alloc_bhp->pgno = bhp->pgno;
+diff --git a/src/mp/mp_mvcc.c b/src/mp/mp_mvcc.c
+index 83c4d72..0a47202 100644
+--- a/src/mp/mp_mvcc.c
++++ b/src/mp/mp_mvcc.c
+@@ -281,7 +281,7 @@ __memp_bh_freeze(dbmp, infop, hp, bhp, need_frozenp)
+ #else
+ 	memcpy(frozen_bhp, bhp, SSZA(BH, buf));
+ #endif
+-	atomic_init(&frozen_bhp->ref, 0);
++	atomic_init_db(&frozen_bhp->ref, 0);
+ 	if (mutex != MUTEX_INVALID)
+ 		frozen_bhp->mtx_buf = mutex;
+ 	else if ((ret = __mutex_alloc(env, MTX_MPOOL_BH,
+@@ -440,7 +440,7 @@ __memp_bh_thaw(dbmp, infop, hp, frozen_bhp, alloc_bhp)
+ #endif
+ 		alloc_bhp->mtx_buf = mutex;
+ 		MUTEX_LOCK(env, alloc_bhp->mtx_buf);
+-		atomic_init(&alloc_bhp->ref, 1);
++		atomic_init_db(&alloc_bhp->ref, 1);
+ 		F_CLR(alloc_bhp, BH_FROZEN);
+ 	}
+ 
+diff --git a/src/mp/mp_region.c b/src/mp/mp_region.c
+index 4d95e4f..e97459c 100644
+--- a/src/mp/mp_region.c
++++ b/src/mp/mp_region.c
+@@ -278,7 +278,7 @@ __memp_init(env, dbmp, reginfo_off, htab_buckets, max_nreg)
+ 			     MTX_MPOOL_FILE_BUCKET, 0, &htab[i].mtx_hash)) != 0)
+ 				return (ret);
+ 			SH_TAILQ_INIT(&htab[i].hash_bucket);
+-			atomic_init(&htab[i].hash_page_dirty, 0);
++			atomic_init_db(&htab[i].hash_page_dirty, 0);
+ 		}
+ 
+ 		mtx_base = mtx_prev = MUTEX_INVALID;
+@@ -332,7 +332,7 @@ no_prealloc:
+ 		    DB_MUTEX_SHARED, &hp->mtx_hash)) != 0)
+ 			return (ret);
+ 		SH_TAILQ_INIT(&hp->hash_bucket);
+-		atomic_init(&hp->hash_page_dirty, 0);
++		atomic_init_db(&hp->hash_page_dirty, 0);
+ #ifdef HAVE_STATISTICS
+ 		hp->hash_io_wait = 0;
+ 		hp->hash_frozen = hp->hash_thawed = hp->hash_frozen_freed = 0;
+diff --git a/src/mutex/mut_method.c b/src/mutex/mut_method.c
+index 72b34de..a9f9868 100644
+--- a/src/mutex/mut_method.c
++++ b/src/mutex/mut_method.c
+@@ -501,7 +501,7 @@ __atomic_compare_exchange_int(env, v, oldval, newval)
+ 	MUTEX_LOCK(env, mtx);
+ 	ret = atomic_read(v) == oldval;
+ 	if (ret)
+-		atomic_init(v, newval);
++		atomic_init_db(v, newval);
+ 	MUTEX_UNLOCK(env, mtx);
+ 
+ 	return (ret);
+diff --git a/src/mutex/mut_tas.c b/src/mutex/mut_tas.c
+index 7899c4b..d9420fa 100644
+--- a/src/mutex/mut_tas.c
++++ b/src/mutex/mut_tas.c
+@@ -47,7 +47,7 @@ __db_tas_mutex_init(env, mutex, flags)
+ 
+ #ifdef HAVE_SHARED_LATCHES
+ 	if (F_ISSET(mutexp, DB_MUTEX_SHARED))
+-		atomic_init(&mutexp->sharecount, 0);
++		atomic_init_db(&mutexp->sharecount, 0);
+ 	else
+ #endif
+ 	if (MUTEX_INIT(&mutexp->tas)) {
+@@ -643,7 +643,7 @@ was_not_locked:
+ 			F_CLR(mutexp, DB_MUTEX_LOCKED);
+ 			/* Flush flag update before zeroing count */
+ 			MEMBAR_EXIT();
+-			atomic_init(&mutexp->sharecount, 0);
++			atomic_init_db(&mutexp->sharecount, 0);
+ 		} else {
+ 			DB_ASSERT(env, sharecount > 0);
+ 			MEMBAR_EXIT();
diff --git a/pkgs/development/libraries/db/cygwin-4.4.patch b/pkgs/development/libraries/db/cygwin-4.4.patch
deleted file mode 100644
index 3f9d658b5da..00000000000
--- a/pkgs/development/libraries/db/cygwin-4.4.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-diff -rc db-4.4.20.NC-old/os/os_flock.c db-4.4.20.NC/os/os_flock.c
-*** db-4.4.20.NC-old/os/os_flock.c	Mon Jun 20 16:59:01 2005
---- db-4.4.20.NC/os/os_flock.c	Wed Jun  7 17:01:49 2006
-***************
-*** 36,41 ****
---- 36,50 ----
-  
-  	DB_ASSERT(F_ISSET(fhp, DB_FH_OPENED) && fhp->fd != -1);
-  
-+ #ifdef __CYGWIN__
-+ 	/*
-+ 	 * Windows file locking interferes with read/write operations, so we
-+ 	 * map the ranges to an area past the end of the file.
-+ 	 */
-+ 	DB_ASSERT(offset < (off_t) 1 << 62);
-+ 	offset += (off_t) 1 << 62;
-+ #endif
-+ 
-  #ifdef HAVE_FCNTL
-  	fl.l_start = offset;
-  	fl.l_len = 1;
diff --git a/pkgs/development/libraries/db/cygwin-4.5.patch b/pkgs/development/libraries/db/cygwin-4.5.patch
deleted file mode 100644
index 3f0ee78a708..00000000000
--- a/pkgs/development/libraries/db/cygwin-4.5.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-diff -rc db-4.5.20-orig/os/os_flock.c db-4.5.20/os/os_flock.c
-*** db-4.5.20-orig/os/os_flock.c	2006-10-13 12:36:12.000000000 +0200
---- db-4.5.20/os/os_flock.c	2006-10-13 12:40:11.000000000 +0200
-***************
-*** 30,35 ****
---- 30,44 ----
-  
-  	DB_ASSERT(dbenv, F_ISSET(fhp, DB_FH_OPENED) && fhp->fd != -1);
-  
-+ #ifdef __CYGWIN__
-+ 	/*
-+ 	 * Windows file locking interferes with read/write operations, so we
-+ 	 * map the ranges to an area past the end of the file.
-+ 	 */
-+ 	DB_ASSERT(dbenv, offset < (off_t) 1 << 62);
-+ 	offset += (off_t) 1 << 62;
-+ #endif
-+ 
-  	fl.l_start = offset;
-  	fl.l_len = 1;
-  	fl.l_type = acquire ? F_WRLCK : F_UNLCK;
-Only in db-4.5.20/os: os_flock.c~
diff --git a/pkgs/development/libraries/db/db-4.8.nix b/pkgs/development/libraries/db/db-4.8.nix
index 40869a865ae..bce91e5a940 100644
--- a/pkgs/development/libraries/db/db-4.8.nix
+++ b/pkgs/development/libraries/db/db-4.8.nix
@@ -2,8 +2,9 @@
 
 import ./generic.nix (args // rec {
   version = "4.8.30";
-  extraPatches = [ ./clang-4.8.patch ];
   sha256 = "0ampbl2f0hb1nix195kz1syrqqxpmvnvnfvphambj7xjrl3iljg0";
-  branch = "4.8";
-  drvArgs = { hardeningDisable = [ "format" ]; };
+  extraPatches = [ ./clang-4.8.patch ];
+
+  drvArgs.hardeningDisable = [ "format" ];
+  drvArgs.doCheck = false;
 })
diff --git a/pkgs/development/libraries/db/db-5.3.nix b/pkgs/development/libraries/db/db-5.3.nix
index 91adfa24b58..d1d3c953fc9 100644
--- a/pkgs/development/libraries/db/db-5.3.nix
+++ b/pkgs/development/libraries/db/db-5.3.nix
@@ -3,9 +3,6 @@
 import ./generic.nix (args // rec {
   version = "5.3.28";
   sha256 = "0a1n5hbl7027fbz5lm0vp0zzfp1hmxnz14wx3zl9563h83br5ag0";
-  branch = "5.3";
-  # https://community.oracle.com/thread/3952592
-  # this patch renames some sybols that conflict with libc++-3.8
-  # symbols: atomic_compare_exchange, atomic_init, store
+  license = stdenv.lib.licenses.agpl3;
   extraPatches = [ ./clang-5.3.patch ];
 })
diff --git a/pkgs/development/libraries/db/db-6.0.nix b/pkgs/development/libraries/db/db-6.0.nix
index 716cad9ab07..b7c5667b883 100644
--- a/pkgs/development/libraries/db/db-6.0.nix
+++ b/pkgs/development/libraries/db/db-6.0.nix
@@ -4,5 +4,5 @@ import ./generic.nix (args // rec {
   version = "6.0.20";
   sha256 = "00r2aaglq625y8r9xd5vw2y070plp88f1mb2gbq3kqsl7128lsl0";
   license = stdenv.lib.licenses.agpl3;
-  branch = "6.0";
+  extraPatches = [ ./clang-6.0.patch ];
 })
diff --git a/pkgs/development/libraries/db/generic.nix b/pkgs/development/libraries/db/generic.nix
index fdc828effdf..a6f9c676bba 100644
--- a/pkgs/development/libraries/db/generic.nix
+++ b/pkgs/development/libraries/db/generic.nix
@@ -4,9 +4,8 @@
 
 # Options from inherited versions
 , version, sha256
-, extraPatches ? [ ]
+, patchSrc ? "src", extraPatches ? [ ]
 , license ? stdenv.lib.licenses.sleepycat
-, branch ? null
 , drvArgs ? {}
 }:
 
@@ -36,11 +35,16 @@ stdenv.mkDerivation (rec {
     rm -rf $out/docs
   '';
 
+  doCheck = true;
+
+  checkPhase = ''
+    make examples_c examples_cxx
+  '';
+
   meta = with stdenv.lib; {
     homepage = "http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/index.html";
     description = "Berkeley DB";
     license = license;
     platforms = platforms.unix;
-    branch = branch;
   };
 } // drvArgs)
diff --git a/pkgs/development/libraries/db/register-race-fix.patch b/pkgs/development/libraries/db/register-race-fix.patch
deleted file mode 100644
index bb05c966e5b..00000000000
--- a/pkgs/development/libraries/db/register-race-fix.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-diff -rc db-4.5.20-orig/env/env_register.c db-4.5.20/env/env_register.c
-*** db-4.5.20-orig/env/env_register.c	2006-09-09 16:29:04.000000000 +0200
---- db-4.5.20/env/env_register.c	2007-05-16 21:13:27.000000000 +0200
-***************
-*** 255,260 ****
---- 255,262 ----
-  			buf[nr - 1] = '\0';
-  		}
-  
-+                 //sleep(3);
-+ 
-  		pos = (off_t)lcnt * PID_LEN;
-  		if (REGISTRY_LOCK(dbenv, pos, 1) == 0) {
-  			if ((ret = REGISTRY_UNLOCK(dbenv, pos)) != 0)
-***************
-*** 361,366 ****
---- 363,392 ----
-  	if (recovery_failed)
-  		goto err;
-  
-+         //sleep(5);
-+ 
-+         /*
-+          * Acquire an exclusive lock to prevent a race like this:
-+          *
-+          * 1) Process X is about to exit and process Y is just
-+          *    starting.
-+          * 2) Process Y reads X's slot.
-+          * 3) Process X clears its slot.
-+          * 4) Process Y sees that X's slot isn't cleared yet (since it
-+          *    just read the old value).
-+          * 5) Process X closes the registry, releases the lock on its
-+          *    slot.
-+          * 6) Process Y tries to acquire X's slot and succeeds, so it
-+          *    concludes that X died and recovery is needed.
-+          *
-+          * A more efficient solution to this problem would be to let
-+          * __envreg_add acquire the lock on a slot first, and *then*
-+          * read the slot (instead of the other way around).  Then we
-+          * wouldn't need the exclusive lock here.
-+          */
-+ 	if ((ret = REGISTRY_EXCL_LOCK(dbenv, 0)) != 0)
-+ 		goto err;
-+ 
-  	/*
-  	 * Why isn't an exclusive lock necessary to discard a DB_ENV handle?
-  	 *