Subject: pkg/6664: PostgreSQL pkg does not support m68k architecture
To: None <gnats-bugs@gnats.netbsd.org>
From: None <mochid@yo.rim.or.jp>
List: netbsd-bugs
Date: 12/28/1998 22:21:59
>Number:         6664
>Category:       pkg
>Synopsis:       PostgreSQL pkg does not support m68k architecture
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 28 05:35:01 1998
>Last-Modified:
>Originator:     MOCHIDA Shuji
>Organization:
personal
>Release:        NetBSD-current 1998-12-27
>Environment:

System: NetBSD gee 1.3.1 NetBSD 1.3.1 (GEE1-NOMIDI) #0: Sun Mar 29 22:15:37 JST 1998 mochid@gee:/mnt/NetBSD-1.3.1-source/usr/src/sys/arch/i386/compile/GEE1-NOMIDI i386

>Description:
	
   The patch below was done by NAKAJIMA Mutsuki<muc@tg-inet.co.jp> 
  to run PostgreSQL on m68k.
   This has been merged to PostgreSQL 6.5 (next release?) source tree.

   Though this patch is against 6.4, while in our pkgsrc is 6.3.2.


diff -crP postgresql-v6.4.org/src/include/utils/memutils.h postgresql-v6.4/src/include/utils/memutils.h
*** postgresql-v6.4.org/src/include/utils/memutils.h	Mon Sep  7 14:35:48 1998
--- postgresql-v6.4/src/include/utils/memutils.h	Sat Dec 26 05:51:30 1998
***************
*** 58,70 ****
  #define SHORTALIGN(LEN)\
  		(((long)(LEN) + (sizeof (short) - 1)) & ~(sizeof (short) - 1))
  
  #define INTALIGN(LEN)\
  		(((long)(LEN) + (sizeof (int) - 1)) & ~(sizeof (int) -1))
  
  /*
   *		LONGALIGN(LEN)	- length (or address) aligned for longs
   */
! #if defined(sun) && ! defined(sparc)
  #define LONGALIGN(LEN)	SHORTALIGN(LEN)
  #elif defined (__alpha)
  
--- 58,74 ----
  #define SHORTALIGN(LEN)\
  		(((long)(LEN) + (sizeof (short) - 1)) & ~(sizeof (short) - 1))
  
+ #if defined(m68k)
+ #define INTALIGN(LEN)	 SHORTALIGN(LEN)
+ #else
  #define INTALIGN(LEN)\
  		(((long)(LEN) + (sizeof (int) - 1)) & ~(sizeof (int) -1))
+ #endif
  
  /*
   *		LONGALIGN(LEN)	- length (or address) aligned for longs
   */
! #if (defined(sun) && ! defined(sparc)) || defined(m68k)
  #define LONGALIGN(LEN)	SHORTALIGN(LEN)
  #elif defined (__alpha)
  
***************
*** 81,87 ****
  		(((long)(LEN) + (sizeof (long) - 1)) & ~(sizeof (long) -1))
  #endif
  
! #if ! defined(sco)
  #define DOUBLEALIGN(LEN)\
  		(((long)(LEN) + (sizeof (double) - 1)) & ~(sizeof (double) -1))
  
--- 85,94 ----
  		(((long)(LEN) + (sizeof (long) - 1)) & ~(sizeof (long) -1))
  #endif
  
! #if defined(m68k)
! #define DOUBLEALIGN(LEN) SHORTALIGN(LEN)
! #define MAXALIGN(LEN)	 SHORTALIGN(LEN)
! #elif ! defined(sco)
  #define DOUBLEALIGN(LEN)\
  		(((long)(LEN) + (sizeof (double) - 1)) & ~(sizeof (double) -1))
  
diff -crP postgresql-v6.4.org/src/backend/storage/buffer/s_lock.c postgresql-v6.4/src/backend/storage/buffer/s_lock.c
*** postgresql-v6.4.org/src/backend/storage/buffer/s_lock.c	Sat Sep 19 02:18:39 1998
--- postgresql-v6.4/src/backend/storage/buffer/s_lock.c	Sat Dec 26 06:26:24 1998
***************
*** 117,122 ****
--- 117,141 ----
  
  #endif	 /* PPC */
  
+ #if defined(__m68k__)
+ static void
+ tas_dummy()	/* really means: extern int tas(slock_t **lock); */
+ {
+ 	__asm__("		\n\
+ .global		_tas		\n\
+ _tas:				\n\
+ 	movel   sp@(0x4),a0	\n\
+ 	tas a0@			\n\
+ 	beq _success		\n\
+ 	moveq   #-128,d0	\n\
+ 	rts			\n\
+ _success:			\n\
+ 	moveq   #0,d0		\n\
+ 	rts			\n\
+ 	");
+ }
+ 
+ #endif	 /* __m68k__ */
  
  
  #else							/* defined(__GNUC__) */


>How-To-Repeat:
	see pkgsrc/databases/postgresql/Makefile: NOT_FOR_ARCHS+= m68k
>Fix:
	update package to 6.4, and apply this patch

>Audit-Trail:
>Unformatted: