about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/db
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-08-08 16:04:42 +0000
committerAlyssa Ross <hi@alyssa.is>2023-08-13 06:35:37 +0000
commit12aaa58dac35800b5b7d77f81cf2a87c21ee55da (patch)
treebe0add9e5c22a85d20b5d78206aa74f956eb2a1b /nixpkgs/pkgs/development/libraries/db
parent45892a5591202f75a1c2f1ca7c62a92c7566e3c5 (diff)
parent5a8e9243812ba528000995b294292d3b5e120947 (diff)
downloadnixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar
nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.gz
nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.bz2
nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.lz
nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.xz
nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.zst
nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.zip
Merge branch 'nixos-unstable' of https://github.com/NixOS/nixpkgs
Conflicts:
	nixpkgs/pkgs/applications/window-managers/sway/default.nix
	nixpkgs/pkgs/build-support/go/module.nix
	nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix
	nixpkgs/pkgs/development/libraries/mesa/default.nix
	nixpkgs/pkgs/servers/dict/dictd-db.nix

Link: https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/issues/391
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/db')
-rw-r--r--nixpkgs/pkgs/development/libraries/db/clang-4.8.patch64
-rw-r--r--nixpkgs/pkgs/development/libraries/db/clang-5.3.patch108
-rw-r--r--nixpkgs/pkgs/development/libraries/db/darwin-mutexes-4.8.patch55
-rw-r--r--nixpkgs/pkgs/development/libraries/db/darwin-mutexes.patch42
-rw-r--r--nixpkgs/pkgs/development/libraries/db/db-4.8.nix8
-rw-r--r--nixpkgs/pkgs/development/libraries/db/db-5.3.nix8
-rw-r--r--nixpkgs/pkgs/development/libraries/db/db-6.0.nix8
-rw-r--r--nixpkgs/pkgs/development/libraries/db/db-6.2.nix8
-rw-r--r--nixpkgs/pkgs/development/libraries/db/generic.nix40
9 files changed, 332 insertions, 9 deletions
diff --git a/nixpkgs/pkgs/development/libraries/db/clang-4.8.patch b/nixpkgs/pkgs/development/libraries/db/clang-4.8.patch
index aa46b8500b5a..0aff87682037 100644
--- a/nixpkgs/pkgs/development/libraries/db/clang-4.8.patch
+++ b/nixpkgs/pkgs/development/libraries/db/clang-4.8.patch
@@ -139,3 +139,67 @@ index f3922e0..e40fcdf 100644
  		} else {
  			DB_ASSERT(env, sharecount > 0);
  			MEMBAR_EXIT();
+diff -ur a/dist/aclocal/clock.m4 b/dist/aclocal/clock.m4
+--- a/dist/aclocal/clock.m4	1969-12-31 19:00:01.000000000 -0500
++++ b/dist/aclocal/clock.m4	2023-06-05 19:14:02.007080500 -0400
+@@ -21,6 +21,7 @@
+ AC_CACHE_CHECK([for clock_gettime monotonic clock], db_cv_clock_monotonic, [
+ AC_TRY_RUN([
+ #include <sys/time.h>
++int
+ main() {
+ 	struct timespec t;
+ 	return (clock_gettime(CLOCK_MONOTONIC, &t) != 0);
+diff -ur a/dist/aclocal/mutex.m4 b/dist/aclocal/mutex.m4
+--- a/dist/aclocal/mutex.m4	1969-12-31 19:00:01.000000000 -0500
++++ b/dist/aclocal/mutex.m4	2023-06-05 19:14:47.214158196 -0400
+@@ -4,6 +4,7 @@
+ AC_DEFUN(AM_PTHREADS_SHARED, [
+ AC_TRY_RUN([
+ #include <pthread.h>
++int
+ main() {
+ 	pthread_cond_t cond;
+ 	pthread_mutex_t mutex;
+@@ -46,6 +47,7 @@
+ AC_DEFUN(AM_PTHREADS_PRIVATE, [
+ AC_TRY_RUN([
+ #include <pthread.h>
++int
+ main() {
+ 	pthread_cond_t cond;
+ 	pthread_mutex_t mutex;
+diff -ur a/dist/aclocal/sequence.m4 b/dist/aclocal/sequence.m4
+--- a/dist/aclocal/sequence.m4	1969-12-31 19:00:01.000000000 -0500
++++ b/dist/aclocal/sequence.m4	2023-06-05 19:14:02.007869956 -0400
+@@ -43,6 +43,9 @@
+ 	# test, which won't test for the appropriate printf format strings.
+ 	if test "$db_cv_build_sequence" = "yes"; then
+ 		AC_TRY_RUN([
++		#include <string.h>
++		#include <stdio.h>
++		int
+ 		main() {
+ 			$db_cv_seq_type l;
+ 			unsigned $db_cv_seq_type u;
+@@ -59,7 +62,9 @@
+				return (1);
+ 			return (0);
+ 		}],, [db_cv_build_sequence="no"],
+-		AC_TRY_LINK(,[
++		AC_TRY_LINK([
++			#include <string.h>
++			#include <stdio.h>],[
+ 			$db_cv_seq_type l;
+ 			unsigned $db_cv_seq_type u;
+ 			char buf@<:@100@:>@;
+diff -ur a/dist/RELEASE b/dist/RELEASE
+--- a/dist/RELEASE	1969-12-31 19:00:01.000000000 -0500
++++ b/dist/RELEASE	2023-07-02 17:32:34.703953049 -0400
+@@ -7,5 +7,5 @@
+ 
+ DB_VERSION_UNIQUE_NAME=`printf "_%d%03d" $DB_VERSION_MAJOR $DB_VERSION_MINOR`
+ 
+-DB_RELEASE_DATE=`date "+%B %e, %Y"`
++DB_RELEASE_DATE="April  9, 2010"
+ DB_VERSION_STRING="Berkeley DB $DB_VERSION: ($DB_RELEASE_DATE)"
diff --git a/nixpkgs/pkgs/development/libraries/db/clang-5.3.patch b/nixpkgs/pkgs/development/libraries/db/clang-5.3.patch
index caf19ffeb92b..823a71d6532f 100644
--- a/nixpkgs/pkgs/development/libraries/db/clang-5.3.patch
+++ b/nixpkgs/pkgs/development/libraries/db/clang-5.3.patch
@@ -139,3 +139,111 @@ index 106b161..fc4de9d 100644
  		} else {
  			DB_ASSERT(env, sharecount > 0);
  			MEMBAR_EXIT();
+diff -ur a/dist/aclocal/clock.m4 b/dist/aclocal/clock.m4
+--- a/dist/aclocal/clock.m4	1969-12-31 19:00:01.000000000 -0500
++++ b/dist/aclocal/clock.m4	2023-06-05 19:14:02.007080500 -0400
+@@ -21,6 +21,7 @@
+ AC_CACHE_CHECK([for clock_gettime monotonic clock], db_cv_clock_monotonic, [
+ AC_TRY_RUN([
+ #include <sys/time.h>
++int
+ main() {
+ 	struct timespec t;
+ 	return (clock_gettime(CLOCK_MONOTONIC, &t) != 0);
+diff -ur a/dist/aclocal/mmap.m4 b/dist/aclocal/mmap.m4
+--- a/dist/aclocal/mmap.m4	1969-12-31 19:00:01.000000000 -0500
++++ b/dist/aclocal/mmap.m4	2023-06-05 19:14:02.007323624 -0400
+@@ -29,6 +29,8 @@
+      * system to system.
+      */
+     #include <stdio.h>
++    #include <stdlib.h>
++    #include <unistd.h>
+     #include <string.h>
+     #include <sys/types.h>
+     #include <sys/stat.h>
+@@ -42,12 +44,13 @@
+     #define MAP_FAILED (-1)
+     #endif
+
+-    int catch_sig(sig)
++    void catch_sig(sig)
+ 	    int sig;
+     {
+ 	    exit(1);
+     }
+
++    int
+     main() {
+ 	    const char *underlying;
+ 	    unsigned gapsize;
+@@ -88,8 +91,8 @@
+ 		    return (4);
+ 	    }
+
+-	    (void) signal(SIGSEGV, catch_sig);
+-	    (void) signal(SIGBUS, catch_sig);
++	    (void) signal(SIGSEGV, &catch_sig);
++	    (void) signal(SIGBUS, &catch_sig);
+
+ 	    for (i = sizeof(buf); i < total_size; i += gapsize)
+ 		    base[i] = 'A';
+diff -ur a/dist/aclocal/mutex.m4 b/dist/aclocal/mutex.m4
+--- a/dist/aclocal/mutex.m4	1969-12-31 19:00:01.000000000 -0500
++++ b/dist/aclocal/mutex.m4	2023-06-05 19:14:47.214158196 -0400
+@@ -5,6 +5,7 @@
+ AC_TRY_RUN([
+ #include <stdlib.h>
+ #include <pthread.h>
++int
+ main() {
+ 	pthread_cond_t cond;
+ 	pthread_mutex_t mutex;
+@@ -49,6 +50,7 @@
+ AC_TRY_RUN([
+ #include <stdlib.h>
+ #include <pthread.h>
++int
+ main() {
+ 	pthread_cond_t cond;
+ 	pthread_mutex_t mutex;
+@@ -89,6 +91,7 @@
+ AC_TRY_RUN([
+ #include <stdlib.h>
+ #include <pthread.h>
++int
+ main() {
+ 	pthread_cond_t cond;
+ 	pthread_condattr_t condattr;
+@@ -110,6 +113,7 @@
+ AC_TRY_RUN([
+ #include <stdlib.h>
+ #include <pthread.h>
++int
+ main() {
+ 	pthread_rwlock_t rwlock;
+ 	pthread_rwlockattr_t rwlockattr;
+diff -ur a/dist/aclocal/sequence.m4 b/dist/aclocal/sequence.m4
+--- a/dist/aclocal/sequence.m4	1969-12-31 19:00:01.000000000 -0500
++++ b/dist/aclocal/sequence.m4	2023-06-05 19:14:02.007869956 -0400
+@@ -43,6 +43,9 @@
+ 	# test, which won't test for the appropriate printf format strings.
+ 	if test "$db_cv_build_sequence" = "yes"; then
+ 		AC_TRY_RUN([
++		#include <string.h>
++		#include <stdio.h>
++		int
+ 		main() {
+ 			$db_cv_seq_type l;
+ 			unsigned $db_cv_seq_type u;
+@@ -59,7 +62,9 @@
+				return (1);
+ 			return (0);
+ 		}],, [db_cv_build_sequence="no"],
+-		AC_TRY_LINK(,[
++		AC_TRY_LINK([
++			#include <string.h>
++			#include <stdio.h>],[
+ 			$db_cv_seq_type l;
+ 			unsigned $db_cv_seq_type u;
+ 			char buf@<:@100@:>@;
diff --git a/nixpkgs/pkgs/development/libraries/db/darwin-mutexes-4.8.patch b/nixpkgs/pkgs/development/libraries/db/darwin-mutexes-4.8.patch
new file mode 100644
index 000000000000..09d5b814f161
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/db/darwin-mutexes-4.8.patch
@@ -0,0 +1,55 @@
+diff -ur a/dist/aclocal/mutex.m4 b/dist/aclocal/mutex.m4
+--- a/dist/aclocal/mutex.m4	1969-12-31 19:00:01.000000000 -0500
++++ b/dist/aclocal/mutex.m4	2023-06-05 19:14:47.214158196 -0400
+@@ -372,10 +376,11 @@
+ 
+ # _spin_lock_try/_spin_unlock: Apple/Darwin
+ if test "$db_cv_mutex" = no; then
+-AC_TRY_LINK(,[
+-	int x;
+-	_spin_lock_try(&x);
+-	_spin_unlock(&x);
++AC_TRY_LINK([
++#include <os/lock.h>],[
++	os_unfair_lock x = OS_UNFAIR_LOCK_INIT;
++	bool _ = os_unfair_lock_trylock(&x);
++	os_unfair_lock_unlock(&x);
+ ], [db_cv_mutex=Darwin/_spin_lock_try])
+ fi
+ 
+diff -ur a/dbinc/mutex_int.h b/dbinc/mutex_int.h
+--- a/dbinc/mutex_int.h	1969-12-31 19:00:01.000000000 -0500
++++ b/dbinc/mutex_int.h	2023-06-05 19:15:37.510514745 -0400
+@@ -154,14 +154,13 @@
+  * Apple/Darwin library functions.
+  *********************************************************************/
+ #ifdef HAVE_MUTEX_DARWIN_SPIN_LOCK_TRY
+-typedef u_int32_t tsl_t;
++#include <os/lock.h>
++typedef os_unfair_lock tsl_t;
+ 
+ #ifdef LOAD_ACTUAL_MUTEX_CODE
+-extern int _spin_lock_try(tsl_t *);
+-extern void _spin_unlock(tsl_t *);
+-#define	MUTEX_SET(tsl)          _spin_lock_try(tsl)
+-#define	MUTEX_UNSET(tsl)        _spin_unlock(tsl)
+-#define	MUTEX_INIT(tsl)         (MUTEX_UNSET(tsl), 0)
++#define	MUTEX_SET(tsl)          os_unfair_lock_trylock(tsl)
++#define	MUTEX_UNSET(tsl)        os_unfair_lock_unlock(tsl)
++#define	MUTEX_INIT(tsl)         ({ *(tsl) = OS_UNFAIR_LOCK_INIT; tsl; })
+ #endif
+ #endif
+ 
+diff -ur a/dbinc/mutex_int.h b/dbinc/mutex_int.h
+--- a/dbinc_auto/mutex_ext.h	1969-12-31 19:00:01.000000000 -0500
++++ b/dbinc_auto/mutex_ext.h	2023-07-01 22:38:20.749201366 -0400
+@@ -34,6 +34,9 @@
+ #if !defined(HAVE_ATOMIC_SUPPORT) && defined(HAVE_MUTEX_SUPPORT)
+ atomic_value_t __atomic_dec __P((ENV *, db_atomic_t *));
+ #endif
++#if !defined(HAVE_ATOMIC_SUPPORT) && defined(HAVE_MUTEX_SUPPORT)
++int atomic_compare_exchange __P((ENV *, db_atomic_t *, atomic_value_t, atomic_value_t));
++#endif
+ int __db_pthread_mutex_init __P((ENV *, db_mutex_t, u_int32_t));
+ int __db_pthread_mutex_lock __P((ENV *, db_mutex_t));
+ #if defined(HAVE_SHARED_LATCHES)
diff --git a/nixpkgs/pkgs/development/libraries/db/darwin-mutexes.patch b/nixpkgs/pkgs/development/libraries/db/darwin-mutexes.patch
new file mode 100644
index 000000000000..c0616fda7f7f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/db/darwin-mutexes.patch
@@ -0,0 +1,42 @@
+diff -ur a/dist/aclocal/mutex.m4 b/dist/aclocal/mutex.m4
+--- a/dist/aclocal/mutex.m4	1969-12-31 19:00:01.000000000 -0500
++++ b/dist/aclocal/mutex.m4	2023-06-05 19:14:47.214158196 -0400
+@@ -441,10 +445,11 @@
+ 
+ # _spin_lock_try/_spin_unlock: Apple/Darwin
+ if test "$db_cv_mutex" = no; then
+-AC_TRY_LINK(,[
+-	int x;
+-	_spin_lock_try(&x);
+-	_spin_unlock(&x);
++AC_TRY_LINK([
++#include <os/lock.h>],[
++	os_unfair_lock x = OS_UNFAIR_LOCK_INIT;
++	bool _ = os_unfair_lock_trylock(&x);
++	os_unfair_lock_unlock(&x);
+ ], [db_cv_mutex=Darwin/_spin_lock_try])
+ fi
+ 
+diff -ur a/src/dbinc/mutex_int.h b/src/dbinc/mutex_int.h
+--- a/src/dbinc/mutex_int.h	1969-12-31 19:00:01.000000000 -0500
++++ b/src/dbinc/mutex_int.h	2023-06-05 19:15:37.510514745 -0400
+@@ -154,14 +154,13 @@
+  * Apple/Darwin library functions.
+  *********************************************************************/
+ #ifdef HAVE_MUTEX_DARWIN_SPIN_LOCK_TRY
+-typedef u_int32_t tsl_t;
++#include <os/lock.h>
++typedef os_unfair_lock tsl_t;
+ 
+ #ifdef LOAD_ACTUAL_MUTEX_CODE
+-extern int _spin_lock_try(tsl_t *);
+-extern void _spin_unlock(tsl_t *);
+-#define	MUTEX_SET(tsl)          _spin_lock_try(tsl)
+-#define	MUTEX_UNSET(tsl)        _spin_unlock(tsl)
+-#define	MUTEX_INIT(tsl)         (MUTEX_UNSET(tsl), 0)
++#define	MUTEX_SET(tsl)          os_unfair_lock_trylock(tsl)
++#define	MUTEX_UNSET(tsl)        os_unfair_lock_unlock(tsl)
++#define	MUTEX_INIT(tsl)         ({ *(tsl) = OS_UNFAIR_LOCK_INIT; tsl; })
+ #endif
+ #endif
+
diff --git a/nixpkgs/pkgs/development/libraries/db/db-4.8.nix b/nixpkgs/pkgs/development/libraries/db/db-4.8.nix
index 5cf9200a9ab9..81705374381e 100644
--- a/nixpkgs/pkgs/development/libraries/db/db-4.8.nix
+++ b/nixpkgs/pkgs/development/libraries/db/db-4.8.nix
@@ -1,9 +1,13 @@
-{ lib, stdenv, fetchurl, ... } @ args:
+{ lib, stdenv, fetchurl, autoreconfHook, ... } @ args:
 
 import ./generic.nix (args // {
   version = "4.8.30";
   sha256 = "0ampbl2f0hb1nix195kz1syrqqxpmvnvnfvphambj7xjrl3iljg0";
-  extraPatches = [ ./clang-4.8.patch ./CVE-2017-10140-4.8-cwd-db_config.patch ];
+  extraPatches = [
+    ./clang-4.8.patch
+    ./CVE-2017-10140-4.8-cwd-db_config.patch
+    ./darwin-mutexes-4.8.patch
+  ];
 
   drvArgs.hardeningDisable = [ "format" ];
   drvArgs.doCheck = false;
diff --git a/nixpkgs/pkgs/development/libraries/db/db-5.3.nix b/nixpkgs/pkgs/development/libraries/db/db-5.3.nix
index 0bb5c4cd6a4a..2362cc9eecb0 100644
--- a/nixpkgs/pkgs/development/libraries/db/db-5.3.nix
+++ b/nixpkgs/pkgs/development/libraries/db/db-5.3.nix
@@ -1,7 +1,11 @@
-{ lib, stdenv, fetchurl, ... } @ args:
+{ lib, stdenv, fetchurl, autoreconfHook, ... } @ args:
 
 import ./generic.nix (args // {
   version = "5.3.28";
   sha256 = "0a1n5hbl7027fbz5lm0vp0zzfp1hmxnz14wx3zl9563h83br5ag0";
-  extraPatches = [ ./clang-5.3.patch ./CVE-2017-10140-cwd-db_config.patch ];
+  extraPatches = [
+    ./clang-5.3.patch
+    ./CVE-2017-10140-cwd-db_config.patch
+    ./darwin-mutexes.patch
+  ];
 })
diff --git a/nixpkgs/pkgs/development/libraries/db/db-6.0.nix b/nixpkgs/pkgs/development/libraries/db/db-6.0.nix
index 49935dd2399b..94c8d8976131 100644
--- a/nixpkgs/pkgs/development/libraries/db/db-6.0.nix
+++ b/nixpkgs/pkgs/development/libraries/db/db-6.0.nix
@@ -1,8 +1,12 @@
-{ lib, stdenv, fetchurl, ... } @ args:
+{ lib, stdenv, fetchurl, autoreconfHook, ... } @ args:
 
 import ./generic.nix (args // {
   version = "6.0.20";
   sha256 = "00r2aaglq625y8r9xd5vw2y070plp88f1mb2gbq3kqsl7128lsl0";
   license = lib.licenses.agpl3;
-  extraPatches = [ ./clang-6.0.patch ./CVE-2017-10140-cwd-db_config.patch ];
+  extraPatches = [
+    ./clang-6.0.patch
+    ./CVE-2017-10140-cwd-db_config.patch
+    ./darwin-mutexes.patch
+  ];
 })
diff --git a/nixpkgs/pkgs/development/libraries/db/db-6.2.nix b/nixpkgs/pkgs/development/libraries/db/db-6.2.nix
index b2c0fd7ac8fc..e526555b06e1 100644
--- a/nixpkgs/pkgs/development/libraries/db/db-6.2.nix
+++ b/nixpkgs/pkgs/development/libraries/db/db-6.2.nix
@@ -1,8 +1,12 @@
-{ lib, stdenv, fetchurl, ... } @ args:
+{ lib, stdenv, fetchurl, autoreconfHook, ... } @ args:
 
 import ./generic.nix (args // {
   version = "6.2.23";
   sha256 = "1isxx4jfmnh913jzhp8hhfngbk6dsg46f4kjpvvc56maj64jqqa7";
   license = lib.licenses.agpl3;
-  extraPatches = [ ./clang-6.0.patch ./CVE-2017-10140-cwd-db_config.patch ];
+  extraPatches = [
+    ./clang-6.0.patch
+    ./CVE-2017-10140-cwd-db_config.patch
+    ./darwin-mutexes.patch
+  ];
 })
diff --git a/nixpkgs/pkgs/development/libraries/db/generic.nix b/nixpkgs/pkgs/development/libraries/db/generic.nix
index 59df0e8469cb..d715c1ffc8b1 100644
--- a/nixpkgs/pkgs/development/libraries/db/generic.nix
+++ b/nixpkgs/pkgs/development/libraries/db/generic.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl
+{ lib, stdenv, fetchurl, autoreconfHook
 , cxxSupport ? true
 , compat185 ? true
 , dbmSupport ? false
@@ -19,10 +19,48 @@ stdenv.mkDerivation (rec {
     sha256 = sha256;
   };
 
+  # The provided configure script features `main` returning implicit `int`, which causes
+  # configure checks to work incorrectly with clang 16.
+  nativeBuildInputs = [ autoreconfHook ];
+
   patches = extraPatches;
 
   outputs = [ "bin" "out" "dev" ];
 
+  # Required when regenerated the configure script to make sure the vendored macros are found.
+  autoreconfFlags = [ "-fi" "-Iaclocal" "-Iaclocal_java" ];
+
+  preAutoreconf = ''
+    pushd dist
+    # Upstream’s `dist/s_config` cats everything into `aclocal.m4`, but that doesn’t work with
+    # autoreconfHook, so cat `config.m4` to another file. Otherwise, it won’t be found by `aclocal`.
+    cat aclocal/config.m4 >> aclocal/options.m4
+  '';
+
+  # This isn’t pretty. The version information is kept separate from the configure script.
+  # After the configure script is regenerated, the version information has to be replaced with the
+  # contents of `dist/RELEASE`.
+  postAutoreconf = ''
+    (
+      declare -a vars=(
+        "DB_VERSION_FAMILY"
+        "DB_VERSION_RELEASE"
+        "DB_VERSION_MAJOR"
+        "DB_VERSION_MINOR"
+        "DB_VERSION_PATCH"
+        "DB_VERSION_STRING"
+        "DB_VERSION_FULL_STRING"
+        "DB_VERSION_UNIQUE_NAME"
+        "DB_VERSION"
+      )
+      source RELEASE
+      for var in "''${vars[@]}"; do
+        sed -e "s/__EDIT_''${var}__/''${!var}/g" -i configure
+      done
+    )
+    popd
+  '';
+
   configureFlags =
     [
       (if cxxSupport then "--enable-cxx" else "--disable-cxx")