pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Make databases/db4 go on NetBSD/aarch64



The following patch adds support for db4 mutexes on aarch64, allowing the package to build with the default options.

Considering that the package doesn’t build as-is without manual intervention, I didn’t bother bumping PKGREVISION, but I will do so if the powers that be feel it’s appropriate.

Any comments before I check it in?

Thx.

Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/databases/db4/distinfo,v
retrieving revision 1.46
diff -u -p -r1.46 distinfo
--- distinfo	8 Sep 2016 16:10:24 -0000	1.46
+++ distinfo	14 Feb 2019 06:56:21 -0000
@@ -5,9 +5,10 @@ RMD160 (db-4.8.30.tar.gz) = dd2fcd4c9b85
 SHA512 (db-4.8.30.tar.gz) = d1a3c52b0ab54ae3fd6792e6396c9f74d25f36b2eb9e853b67ef9c872508a58c784c7818108d06d184f59601b70cc877916e67dfea6f0ee1ca2b07468c1041f1
 Size (db-4.8.30.tar.gz) = 22887305 bytes
 SHA1 (patch-aa) = 1004feec022eefbf3fd57b6d9af99edc5a2bf17a
-SHA1 (patch-ab) = 961c4ef5ad84739bd7eae57f407b89f42864b66e
+SHA1 (patch-ab) = 397dcb7e7bd0cb0f266cd460b9d76c8339118bc5
 SHA1 (patch-ac) = 045a3b83b9c6c164382ec546b06ae248620552cf
-SHA1 (patch-ae) = 43e574154de93dba60392b09d6ebddbca1036849
+SHA1 (patch-ae) = e47582c71470386a5226408e4d1db31adccadc29
+SHA1 (patch-af) = d9706895e538468f3b442fde3e8d6c9caceaaf4f
 SHA1 (patch-db__sql_sqlite_sqliteInt.h) = 7e5579d6c55c8163e35718bdecbce079b1efde3e
 SHA1 (patch-dbinc_atomic.h) = d68db1b7e07b35ec070a18f0195b9f3b386114dd
 SHA1 (patch-dist_s__sig) = d891a6fabd27a07776bdaa21843563638ecb89f2
Index: patches/patch-ab
===================================================================
RCS file: /cvsroot/pkgsrc/databases/db4/patches/patch-ab,v
retrieving revision 1.25
diff -u -p -r1.25 patch-ab
--- patches/patch-ab	7 Jun 2014 08:19:14 -0000	1.25
+++ patches/patch-ab	14 Feb 2019 06:56:21 -0000
@@ -173,3 +173,46 @@ $NetBSD: patch-ab,v 1.25 2014/06/07 08:1
  	hp*)		_JNI_INC_SUBDIRS="hp-ux";;
  	linux*)		_JNI_INC_SUBDIRS="linux genunix";;
  	osf*)		_JNI_INC_SUBDIRS="alpha";;
+@@ -19567,6 +19609,31 @@ fi
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+ 
++# AARCH64/gcc: Linux
++if test "$db_cv_mutex" = no; then
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++
++int
++main ()
++{
++
++#if defined(__aarch64__) && defined(__GNUC__)
++	exit(0);
++#else
++	FAIL TO COMPILE/LINK
++#endif
++
++  ;
++  return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++  db_cv_mutex=AARCH64/gcc-assembly
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++fi
++
+ # MIPS/gcc: Linux
+ if test "$db_cv_mutex" = no; then
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+@@ -19862,6 +19929,10 @@ ARM/gcc-assembly)	ADDITIONAL_OBJS="mut_t
+ 			$as_echo "#define HAVE_MUTEX_ARM_GCC_ASSEMBLY 1" >>confdefs.h
+ 
+ 			;;
++AARCH64/gcc-assembly)	ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
++			$as_echo "#define HAVE_MUTEX_AARCH64_GCC_ASSEMBLY 1" >>confdefs.h
++
++			;;
+ HP/msem_init)		ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
+ 			$as_echo "#define HAVE_MUTEX_HPPA_MSEM_INIT 1" >>confdefs.h
+ 
Index: patches/patch-ae
===================================================================
RCS file: /cvsroot/pkgsrc/databases/db4/patches/patch-ae,v
retrieving revision 1.1
diff -u -p -r1.1 patch-ae
--- patches/patch-ae	28 Sep 2010 11:08:29 -0000	1.1
+++ patches/patch-ae	14 Feb 2019 06:56:21 -0000
@@ -1,10 +1,55 @@
 $NetBSD: patch-ae,v 1.1 2010/09/28 11:08:29 obache Exp $
 
+* adds support for mutexes on aarch64
 * fixes build failure on MIPS arch with -mips1.
 
 --- dbinc/mutex_int.h.orig	2010-04-12 20:25:22.000000000 +0000
 +++ dbinc/mutex_int.h
-@@ -778,10 +778,14 @@ MUTEX_SET(tsl_t *tsl) {
+@@ -491,6 +491,43 @@ typedef unsigned char tsl_t;
+ #endif
+ 
+ /*********************************************************************
++ * AARCH64/gcc assembly.
++ *********************************************************************/
++
++#ifdef HAVE_MUTEX_AARCH64_GCC_ASSEMBLY
++typedef unsigned int tsl_t;
++
++#ifdef LOAD_ACTUAL_MUTEX_CODE
++static inline int
++MUTEX_SET(tsl_t *tsl) {
++	register tsl_t *__l = tsl;
++	register tsl_t __r;
++	__asm__ volatile(
++		"1:	ldxr	%w0,[%1]\n"
++		"	cbnz	%w0,2f\n"
++		"	stxr	%w0,%w2,[%1]\n"
++		"	cbnz	%w0,1b\n"
++		"	dmb	st\n"
++		"2:"
++		: "=&r"(__r)
++		: "r"(__l), "r"(1)
++		: "memory");
++
++	return !__r;
++}
++
++static inline int
++MUTEX_UNSET(tsl_t *tsl) {
++	__asm__ volatile(
++		"	dsb	sy\n" ::: "memory");
++	return *tsl = 0;
++}
++
++#define	MUTEX_INIT(tsl)		(MUTEX_UNSET(tsl), 0)
++#endif
++#endif
++
++/*********************************************************************
+  * HPPA/gcc assembly.
+  *********************************************************************/
+ #ifdef HAVE_MUTEX_HPPA_GCC_ASSEMBLY
+@@ -778,10 +815,14 @@ MUTEX_SET(tsl_t *tsl) {
  static inline void
  MUTEX_UNSET(tsl_t *tsl) {
  	__asm__ volatile(
Index: patches/patch-af
===================================================================
RCS file: patches/patch-af
diff -N patches/patch-af
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-af	14 Feb 2019 06:56:21 -0000
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- dist/config.hin.orig	2010-04-12 20:25:23.000000000 +0000
++++ dist/config.hin
+@@ -212,6 +212,9 @@
+ /* Define to 1 to use the GCC compiler and ARM assembly language mutexes. */
+ #undef HAVE_MUTEX_ARM_GCC_ASSEMBLY
+ 
++/* Define to 1 to use the GCC compiler and AARCH64 assembly language mutexes. */
++#undef HAVE_MUTEX_AARCH64_GCC_ASSEMBLY
++
+ /* Define to 1 to use the Apple/Darwin _spin_lock_try mutexes. */
+ #undef HAVE_MUTEX_DARWIN_SPIN_LOCK_TRY
+ 
-- thorpej



Home | Main Index | Thread Index | Old Index