ftp1.sony.co.jpで配布しているMule2.1用のパッチをEmacs 19.34ベースの
Mule2.3 alpha01に当てるために手直しと追加をしました。

   % ./configure mips-sony-newsos6 ...

でいいのですが、setup-newsos6に雛形を作ってあります。
Wnn6とAthenaを使うようになっています。適当に変えてください。

  % ./setup-newsos6

NEWS-OS Release 6.xでMule based on 19.34をコンパイルするとき、XtをDSOに
すると、フレームを閉じると落ちてしまいます。Solaris 2.5.xと同じようにス
タティックリンクするようにしてあります。これで落ちなくなりました。:-)


hiraga@meis.sony.co.jp


diff -urP mule-2.3-19.34-alpha01/configure mule-2.3-19.34-alpha01-newsos6/configure
--- mule-2.3-19.34-alpha01/configure	Thu Oct 24 10:04:55 1996
+++ mule-2.3-19.34-alpha01-newsos6/configure	Mon Mar 17 15:58:43 1997
@@ -1435,6 +1435,9 @@
   mips-sony-bsd* | mips-sony-newsos4* | mips-sony-news4*)
     machine=news-risc opsys=bsd4-3
   ;;
+  mips-sony-svr4* | mips-sony-newsos6* | mips-sony-news6*)
+    machine=news-risc opsys=newsos6
+  ;;
   mips-sony-news* )
     machine=news-risc opsys=newsos5
   ;;
diff -urP mule-2.3-19.34-alpha01/configure.in mule-2.3-19.34-alpha01-newsos6/configure.in
--- mule-2.3-19.34-alpha01/configure.in	Thu Oct 24 10:04:56 1996
+++ mule-2.3-19.34-alpha01-newsos6/configure.in	Mon Mar 17 15:58:43 1997
@@ -756,6 +756,9 @@
   mips-sony-bsd* | mips-sony-newsos4* | mips-sony-news4*)
     machine=news-risc opsys=bsd4-3
   ;;
+  mips-sony-svr4* | mips-sony-newsos6* | mips-sony-news6*)
+    machine=news-risc opsys=newsos6
+  ;;
   mips-sony-news* )
     machine=news-risc opsys=newsos5
   ;;
diff -urP mule-2.3-19.34-alpha01/setup-newsos6 mule-2.3-19.34-alpha01-newsos6/setup-newsos6
--- mule-2.3-19.34-alpha01/setup-newsos6	Thu Jan  1 09:00:00 1970
+++ mule-2.3-19.34-alpha01-newsos6/setup-newsos6	Mon Mar 17 15:59:01 1997
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+./configure mips-sony-newsos6 \
+      --with-gcc=no \
+      --with-pop \
+      --with-mcpath \
+      --with-terminal-face \
+      --with-wnn6 \
+      --with-wnn-includes=/usr/local/include/wnn6 \
+      --with-x \
+      --with-x-toolkit=yes \
+      --mandir=/usr/local/man/C
diff -urP mule-2.3-19.34-alpha01/setup-newsos6.x11r6 mule-2.3-19.34-alpha01-newsos6/setup-newsos6.x11r6
--- mule-2.3-19.34-alpha01/setup-newsos6.x11r6	Thu Jan  1 09:00:00 1970
+++ mule-2.3-19.34-alpha01-newsos6/setup-newsos6.x11r6	Mon Mar 17 15:59:01 1997
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+./configure mips-sony-newsos6 \
+      --with-gcc=no \
+      --with-pop \
+      --with-mcpath \
+      --with-terminal-face \
+      --with-wnn6 \
+      --with-wnn-includes=/usr/local/include/wnn6 \
+      --with-x \
+      --with-x-toolkit=yes \
+      --x-include=/usr/X11R6/include \
+      --x-libraries=/usr/X11R6/lib \
+      --mandir=/usr/local/man/C
diff -urP mule-2.3-19.34-alpha01/src/m/news-risc.h mule-2.3-19.34-alpha01-newsos6/src/m/news-risc.h
--- mule-2.3-19.34-alpha01/src/m/news-risc.h	Thu Oct 24 10:10:20 1996
+++ mule-2.3-19.34-alpha01-newsos6/src/m/news-risc.h	Mon Mar 17 15:59:59 1997
@@ -1,5 +1,51 @@
 /* news-risc.h is for the "RISC News".  */
 
+#ifdef NEWSOS6 /* NEWS-OS Release 6.X */
+
+#define SHORTBITS 16            /* Number of bits in a short */
+#define INTBITS 32              /* Number of bits in an int */
+#define LONGBITS 32             /* Number of bits in a long */
+
+#define WORDS_BIG_ENDIAN
+#define NO_ARG_ARRAY
+#undef WORD_MACHINE
+#define SIGN_EXTEND_CHAR(c) ((signed char)(c))
+
+#ifndef mips
+#define mips
+#endif
+
+#define NO_UNION_TYPE
+#define EXPLICIT_SIGN_EXTEND
+#define LOAD_AVE_TYPE long
+#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / 256.0)
+#undef KERNEL_FILE
+#define KERNEL_FILE "/stand/unix"
+#undef CANNOT_DUMP
+#define HAVE_ALLOCA
+#define NO_REMAP
+#undef NO_SOCK_SIGIO
+
+#define C_DEBUG_SWITCH -g3 -O2 -Olimit 3000
+#define LD_SWITCH_MACHINE -D 800000
+#define LIBS_TERMCAP -lcurses
+
+#define XUINT(a) (((unsigned)(a) << (INTBITS-VALBITS)) >> (INTBITS-VALBITS))
+#define XSET(var, type, ptr)                                            \
+  ((var) =                                                              \
+   ((int)(type) << VALBITS)                                             \
+   + (((unsigned) (ptr) << (INTBITS-VALBITS)) >> (INTBITS-VALBITS)))
+
+/* #define XSETINT(a, b)  XSET(a, XTYPE(a), b) */
+#define XSETUINT(a, b) XSET(a, XTYPE(a), b)
+#define XSETPNTR(a, b) XSET(a, XTYPE(a), b)
+#define XUNMARK(a)                                                      \
+  ((a) =                                                                \
+   (((unsigned)(a) << (INTBITS-GCTYPEBITS-VALBITS))                     \
+    >> (INTBITS-GCTYPEBITS-VALBITS)))
+
+#else /* __sony_news && _SYSTYPE_SYSV (NEWS-OS Release 6.x) */
+
 #include "mips.h"
 
 #ifdef NEWSOS5
@@ -50,3 +96,4 @@
 #define KERNEL_FILE "/vmunix"
 
 #endif /* not NEWSOS5 */
+#endif /* not NEWSOS6 */
diff -urP mule-2.3-19.34-alpha01/src/s/newsos6.h mule-2.3-19.34-alpha01-newsos6/src/s/newsos6.h
--- mule-2.3-19.34-alpha01/src/s/newsos6.h	Thu Jan  1 09:00:00 1970
+++ mule-2.3-19.34-alpha01-newsos6/src/s/newsos6.h	Mon Mar 17 15:59:31 1997
@@ -0,0 +1,44 @@
+/* Definitions file for GNU Emacs running on Sony's NEWS-OS 6.x
+   Copyright (C) 1992, 1994 Free Software Foundation, Inc.
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs; see the file COPYING.  If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+/* Use the SysVr4 file for at least base configuration. */
+
+#include "usg5-4-2.h"
+
+#define NEWSOS6
+#define HAVE_TEXT_START
+
+/* -lXimp is not needed in NEWS-OS 6.x */
+#undef LIB_MOTIF
+#define LIB_MOTIF -lXm
+
+/* A recent patch in unexelf.c should eliminate the need for this.  */
+/* Don't use the shared libraries for -lXt and -lXaw,
+   to work around a linker bug in NEWS-OS 6.1
+   (This also affects the other libraries used specifically for
+   the X toolkit, which may not be necessary.)  */
+#define LIBXT_STATIC
+
+#ifdef __GNUC__
+#define STATIC_OPTION -Xlinker -Bstatic
+#define DYNAMIC_OPTION -Xlinker -Bdynamic
+#else
+#define STATIC_OPTION -Bstatic
+#define DYNAMIC_OPTION -Bdynamic
+#endif
diff -urP mule-2.3-19.34-alpha01/src/unexelf.c mule-2.3-19.34-alpha01-newsos6/src/unexelf.c
--- mule-2.3-19.34-alpha01/src/unexelf.c	Thu Oct 24 10:09:47 1996
+++ mule-2.3-19.34-alpha01-newsos6/src/unexelf.c	Mon Mar 17 15:58:44 1997
@@ -422,6 +422,10 @@
 #include <fcntl.h>
 #include <elf.h>
 #include <sys/mman.h>
+#if defined(__sony_news) && defined(_SYSTYPE_SYSV)
+#include <sys/elf_mips.h>
+#include <sym.h>
+#endif /* __sony_news && _SYSTYPE_SYSV */
 
 #ifndef emacs
 #define fatal(a, b, c) fprintf (stderr, a, b, c), exit (1)
@@ -523,6 +527,9 @@
   Elf32_Addr new_data2_addr;
 
   int n, nn, old_bss_index, old_data_index, new_data2_index;
+#if defined( __sony_news) && defined(_SYSTYPE_SYSV)
+  int old_sbss_index, old_mdebug_index;
+#endif /* __sony_news && _SYSTYPE_SYSV */
   struct stat stat_buf;
 
   /* Open the old file & map it into the address space. */
@@ -571,8 +578,51 @@
   if (old_bss_index == old_file_h->e_shnum)
     fatal ("Can't find .bss in %s.\n", old_name, 0);
 
+#if defined(__sony_news) && defined(_SYSTYPE_SYSV)
+  for (old_sbss_index = 1; old_sbss_index < (int) old_file_h->e_shnum;
+       old_sbss_index++)
+    {
+#ifdef DEBUG
+      fprintf (stderr, "Looking for .sbss - found %s\n",
+	       old_section_names + OLD_SECTION_H (old_sbss_index).sh_name);
+#endif
+      if (!strcmp (old_section_names + OLD_SECTION_H (old_sbss_index).sh_name,
+		   ".sbss"))
+	break;
+    }
+  if (old_sbss_index == old_file_h->e_shnum)
+    {
+      old_bss_addr = OLD_SECTION_H(old_bss_index).sh_addr;
+      old_bss_size = OLD_SECTION_H(old_bss_index).sh_size;
+      new_data2_offset = OLD_SECTION_H(old_bss_index).sh_offset;
+      new_data2_index = old_bss_index;
+    }
+  else
+    {
+      old_bss_addr = OLD_SECTION_H(old_sbss_index).sh_addr;
+      old_bss_size = OLD_SECTION_H(old_bss_index).sh_size
+	+ OLD_SECTION_H(old_sbss_index).sh_size;
+      new_data2_offset = OLD_SECTION_H(old_sbss_index).sh_offset;
+      new_data2_index = old_sbss_index;
+    }
+
+  for (old_mdebug_index = 1; old_mdebug_index < (int) old_file_h->e_shnum;
+       old_mdebug_index++)
+    {
+#ifdef DEBUG
+      fprintf (stderr, "Looking for .mdebug - found %s\n",
+	       old_section_names + OLD_SECTION_H (old_mdebug_index).sh_name);
+#endif
+      if (!strcmp (old_section_names + OLD_SECTION_H (old_mdebug_index).sh_name,
+		   ".mdebug"))
+	break;
+    }
+    if (old_mdebug_index == old_file_h->e_shnum)
+	old_mdebug_index = 0;
+#else /* !(__sony_news && _SYSTYPE_SYSV) */	    
   old_bss_addr = OLD_SECTION_H (old_bss_index).sh_addr;
   old_bss_size = OLD_SECTION_H (old_bss_index).sh_size;
+#endif /* !(__sony_news && _SYSTYPE_SYSV) */	    
 #if defined(emacs) || !defined(DEBUG)
   new_bss_addr = (Elf32_Addr) sbrk (0);
 #else
@@ -580,7 +630,9 @@
 #endif
   new_data2_addr = old_bss_addr;
   new_data2_size = new_bss_addr - old_bss_addr;
+#if !defined(__sony_news) || !defined(_SYSTYPE_SYSV)
   new_data2_offset = OLD_SECTION_H (old_bss_index).sh_offset;
+#endif /* !(__sony_news && _SYSTYPE_SYSV) */
 
 #ifdef DEBUG
   fprintf (stderr, "old_bss_index %d\n", old_bss_index);
@@ -665,7 +717,12 @@
       if ((OLD_SECTION_H (old_bss_index)).sh_addralign > alignment)
 	alignment = OLD_SECTION_H (old_bss_index).sh_addralign;
 
+#if defined(__sony_news) && defined(_SYSTYPE_SYSV)
+      if (NEW_PROGRAM_H (n).p_vaddr + NEW_PROGRAM_H (n).p_filesz >
+	  round_up(old_bss_addr, alignment))
+#else /* !(__sony_news && _SYSTYPE_SYSV) */
       if (NEW_PROGRAM_H (n).p_vaddr + NEW_PROGRAM_H (n).p_filesz > old_bss_addr)
+#endif /* !(__sony_news && _SYSTYPE_SYSV) */
 	fatal ("Program segment above .bss in %s\n", old_name, 0);
 
       if (NEW_PROGRAM_H (n).p_type == PT_LOAD
@@ -712,8 +769,15 @@
   for (n = 1, nn = 1; n < (int) old_file_h->e_shnum; n++, nn++)
     {
       caddr_t src;
+#if defined(__sony_news) && defined(_SYSTYPE_SYSV)
+      /* If it is (s)bss section, insert the new data2 section before it. */
+      /* new_data2_index is the index of either old_sbss or old_bss, that was
+	 chosen as a section for new_data2 */
+      if (n == new_data2_index)
+#else /* !(__sony_news && _SYSTYPE_SYSV) */
       /* If it is bss section, insert the new data2 section before it. */
       if (n == old_bss_index)
+#endif /* !(__sony_news && _SYSTYPE_SYSV) */
 	{
 	  /* Steal the data section header for this data2 section. */
 	  memcpy (&NEW_SECTION_H (nn), &OLD_SECTION_H (old_data_index),
@@ -737,9 +801,15 @@
       memcpy (&NEW_SECTION_H (nn), &OLD_SECTION_H (n),
 	      old_file_h->e_shentsize);
 
+#if defined(__sony_news) && defined(_SYSTYPE_SYSV)
+      /* The new bss and sbss section's size is zero, and its file offset
+	 and virtual address should be off by NEW_DATA2_SIZE. */
+      if (n == old_sbss_index || n == old_bss_index)
+#else /* !(__sony_news && _SYSTYPE_SYSV) */
       /* The new bss section's size is zero, and its file offset and virtual
 	 address should be off by NEW_DATA2_SIZE. */
       if (n == old_bss_index)
+#endif /* !(__sony_news && _SYSTYPE_SYSV) */
 	{
 	  /* NN should be `old_bss_index + 1' at this point. */
 	  NEW_SECTION_H (nn).sh_offset += new_data2_size;
@@ -803,6 +873,14 @@
 	  || !strcmp ((old_section_names + NEW_SECTION_H(n).sh_name),
 		      ".sdata")
 #endif
+#if defined(__sony_news) && defined(_SYSTYPE_SYSV)
+	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
+		      ".sdata")
+	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
+		      ".lit4")
+	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
+		      ".lit8")
+#endif /* __sony_news && _SYSTYPE_SYSV */
 	  || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
 		      ".data1"))
 	src = (caddr_t) OLD_SECTION_H (n).sh_addr;
@@ -812,6 +890,28 @@
       memcpy (NEW_SECTION_H (nn).sh_offset + new_base, src,
 	      NEW_SECTION_H (nn).sh_size);
 
+#if defined(__sony_news) && defined(_SYSTYPE_SYSV)
+      if (NEW_SECTION_H (nn).sh_type == SHT_MIPS_DEBUG && old_mdebug_index) 
+        {
+	  int diff = NEW_SECTION_H(nn).sh_offset 
+	 	- OLD_SECTION_H(old_mdebug_index).sh_offset;
+	  HDRR *phdr = (HDRR *)(NEW_SECTION_H (nn).sh_offset + new_base);
+
+	  if (diff) {
+	    phdr->cbLineOffset += diff;
+	    phdr->cbDnOffset   += diff;
+	    phdr->cbPdOffset   += diff;
+	    phdr->cbSymOffset  += diff;
+	    phdr->cbOptOffset  += diff;
+	    phdr->cbAuxOffset  += diff;
+	    phdr->cbSsOffset   += diff;
+	    phdr->cbSsExtOffset += diff;
+	    phdr->cbFdOffset   += diff;
+	    phdr->cbRfdOffset  += diff;
+	    phdr->cbExtOffset  += diff;
+	  }
+	}
+#endif /* __sony_news && _SYSTYPE_SYSV */
       /* If it is the symbol table, its st_shndx field needs to be patched.  */
       if (NEW_SECTION_H (nn).sh_type == SHT_SYMTAB
 	  || NEW_SECTION_H (nn).sh_type == SHT_DYNSYM)
