[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

[MD:7196] Visual Studio 2005 での Meadow のビルド



藤井です。

前のパッチでは、ダンプに失敗することがありましたが、それに対する修正を
加えたパッチを添付しました。これでビルドはちゃんとできるようになったと
思います。興味のあるかたはお試しください。

# なお、パッチを当てたときに他の環境でのビルドに影響が出る問題は解決し
# てません。

From: "M.Fujii" <boochang@xxxxxxxxxxxx>
Subject: [MD:7195] Visual Studio 2005 での Meadow のビルド(途中経過)
Date: Sat, 11 Feb 2006 13:58:40 +0900 (JST)
> Visual Studio 2005 Pro (MSVC8)で Meadow のビルドをトライしてみました。
> ビルドは一応できようになりました。しかし、まだ一部動作に不具合があるよ
> うです。
> 
> 一応現時点のパッチを添付しますので、試してみたい人はビルドしてみてくだ
> さい。
> # ただし、パッチを当てると他の環境でビルドできなくなる恐れがありますの
> # で、ご注意ください。(まだそこまで調整できていません)
> 
> <<既知の不具合・注意点>>
> = ダンプ時に、temacs.exe -> emacs.exe のコピーが失敗することがあります。
>   成功してもタイムスタンプはデタラメな可能性が高いと思われます。
> = リビルドする場合は事前に src/obj-spd/i386/Meadow.exe を消す必要があり
>   ます。
> = copy-file() の第 4 引数が nil の場合、コピーに失敗することがあります。
> 
> 多分 time_t の 64bit 化の影響で問題が生じているものと思われます。

time_t を 32bit とするよう設定した上でビルドすると上記不具合は発生しな
くなりました。

<<パッチでの変更点>>
  [今回のパッチで追加]
  - _USE_32BIT_TIME_T の定義
  [前回のパッチでの変更]
  - libc.lib の代わりに libcmt.lib を使用
  - エラーとなるリンカオプションの削除
  - 一部のインライン関数を定義したファイル(*.inl)のインクルード抑制
  - USE_CRT_DLL の定義(src 以下のみ、nt, lib-src では定義しない)
  - "#define tzname _tzname" の箇所を ms-w32.h から各 C ソースに移動
  - 以下の関数定義の仮引数リストを ANSI C スタイルに
      = src/emacs.c: fatal_error_signal
      = src/regex.c: regerror
  - src/w32.c: _access の呼び出しを sys_access に変更

--
藤井 正行 / Masayuki FUJII
Index: src/makefile.mw32-in
===================================================================
--- src/makefile.mw32-in	(revision 4031)
+++ src/makefile.mw32-in	(working copy)
@@ -31,7 +31,7 @@
 # HAVE_CONFIG_H is required by some generic gnu sources stuck into
 # the emacs source tree.
 #
-LOCAL_FLAGS     = -Demacs=1 -DWINDOWSNT -DDOS_NT -DHAVE_CONFIG_H -I../nt/inc -D_UCHAR_T -DHAVE_NTGUI=1 $(EMACS_EXTRA_C_FLAGS)
+LOCAL_FLAGS     = -Demacs=1 -DWINDOWSNT -DDOS_NT -DHAVE_CONFIG_H -I../nt/inc -D_UCHAR_T -DHAVE_NTGUI=1 $(EMACS_EXTRA_C_FLAGS) -DUSE_CRT_DLL 
 
 TEMACS          = $(BLD)/temacs.exe
 EMACS           = $(BLD)/Meadow.exe
Index: src/w32.c
===================================================================
--- src/w32.c	(revision 4031)
+++ src/w32.c	(working copy)
@@ -21,6 +21,9 @@
 
    Geoff Voelker (voelker@xxxxxxxxxxxxxxxxx)                         7-29-94
 */
+#if _MSC_VER >= 1400
+#define _INC_UTIME_INL
+#endif
 #include <stddef.h> /* for offsetof */
 #include <stdlib.h>
 #include <stdio.h>
@@ -1099,6 +1102,9 @@
 	 read-only filesystem, like CD-ROM or a write-protected floppy.
 	 The only way to be really sure is to actually create a file and
 	 see if it succeeds.  But I think that's too much to ask.  */
+#if _MSC_VER >= 1400
+#define _access sys_access
+#endif
       if (tmp && _access (tmp, D_OK) == 0)
 	{
 	  char * var = alloca (strlen (tmp) + 8);
@@ -1106,6 +1112,9 @@
 	  _putenv (strdup (var));
 	  break;
 	}
+#if _MSC_VER >= 1400
+#undef _access
+#endif
     }
   if (i >= imax)
     cmd_error_internal
Index: src/regex.c
===================================================================
--- src/regex.c	(revision 4031)
+++ src/regex.c	(working copy)
@@ -6439,11 +6439,15 @@
    from either regcomp or regexec.   We don't use PREG here.  */
 
 size_t
+#if _MSC_VER >= 1400
+regerror (int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)
+#else
 regerror (errcode, preg, errbuf, errbuf_size)
     int errcode;
     const regex_t *preg;
     char *errbuf;
     size_t errbuf_size;
+#endif
 {
   const char *msg;
   size_t msg_size;
Index: src/s/ms-w32.h
===================================================================
--- src/s/ms-w32.h	(revision 4031)
+++ src/s/ms-w32.h	(working copy)
@@ -383,7 +383,9 @@
 #define strnicmp  _strnicmp
 #define stricmp   _stricmp
 #define tzset     _tzset
+#if !defined(_MSC_VER) || _MSC_VER < 1400
 #define tzname    _tzname
+#endif
 
 #ifdef HAVE_NTGUI
 #define abort	w32_abort
@@ -462,7 +464,13 @@
 #endif
 #include <malloc.h>
 
+#if _MSC_VER >= 1400
+#define _INC_STAT_INL
+#endif
 #include <sys/stat.h>
+#if _MSC_VER >= 1400
+#undef _INC_STAT_INL
+#endif
 
 /* Define for those source files that do not include enough NT
    system files.  */
Index: src/strftime.c
===================================================================
--- src/strftime.c	(revision 4031)
+++ src/strftime.c	(working copy)
@@ -56,7 +56,12 @@
 #ifndef USE_CRT_DLL
 extern char *tzname[];
 #endif
+#if _MSC_VER >= 1400
+#undef _tzname
+extern char *_tzname[];
+#define tzname _tzname
 #endif
+#endif
 
 /* Do multibyte processing if multibytes are supported, unless
    multibyte sequences are safe in formats.  Multibyte sequences are
Index: src/emacs.c
===================================================================
--- src/emacs.c	(revision 4031)
+++ src/emacs.c	(working copy)
@@ -397,9 +397,14 @@
 #endif /* SIGUSR2 */
 
 /* Handle bus errors, invalid instruction, etc.  */
+#if _MSC_VER >= 1400
 SIGTYPE
+fatal_error_signal (int sig)
+#else
+SIGTYPE
 fatal_error_signal (sig)
      int sig;
+#endif
 {
   SIGNAL_THREAD_CHECK (sig);
   fatal_error_code = sig;
Index: src/editfns.c
===================================================================
--- src/editfns.c	(revision 4031)
+++ src/editfns.c	(working copy)
@@ -71,6 +71,11 @@
 #ifndef USE_CRT_DLL
 extern char **environ;
 #endif
+#if _MSC_VER >= 1400
+#undef _tzname
+extern char *_tzname[];
+#define tzname _tzname
+#endif
 
 extern size_t emacs_strftimeu P_ ((char *, size_t, const char *,
 				   const struct tm *, int));
Index: nt/nmake.mw32.defs
===================================================================
--- nt/nmake.mw32.defs	(revision 4031)
+++ nt/nmake.mw32.defs	(working copy)
@@ -114,7 +114,7 @@
 RC_OUT		= -Fo
 RC_INCLUDE	= -i
 
-libc		= libc.lib
+libc		= libcmt.lib
 baselibs	=
 O		= obj
 A		= lib
@@ -152,7 +152,7 @@
 
 # see comments in allocate_heap in w32heap.c before changing any of the
 # -stack, -heap, or -base settings.
-TEMACS_EXTRA_LINK = -stack:0x00800000 -heap:0x00100000 -base:0x01000000 -debug:full -debugtype:both -pdb:$(BLD)\temacs.pdb -machine:$(ARCH) $(SUBSYSTEM_CONSOLE) -entry:mw32_start -map:$(BLD)\temacs.map $(EXTRA_LINK)
+TEMACS_EXTRA_LINK = -stack:0x00800000 -heap:0x00100000 -base:0x01000000 -debug:full -pdb:$(BLD)\temacs.pdb -machine:$(ARCH) $(SUBSYSTEM_CONSOLE) -entry:mw32_start -map:$(BLD)\temacs.map $(EXTRA_LINK)
 
 !ifdef NOOPT
 OBJDIR          = obj
@@ -190,14 +190,14 @@
 DEBUG_LINK =
 !else
 DEBUG_FLAG = -Zi
-DEBUG_LINK = -debug:full -debugtype:both
+DEBUG_LINK = -debug:full
 !endif
 
 !if "$(ARCH)" == "i386"
 !ifdef NOOPT
-ARCH_CFLAGS     = -nologo -D_X86_=1 -c -Zel -W2 -H63 -Od -G3d -Zi -Zp8 $(DEBUG_FLAG)
+ARCH_CFLAGS     = -nologo -D_X86_=1 -c -Zel -W2 -H63 -Od -G3d -Zi -Zp8 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE_GLOBALS -D_USE_32BIT_TIME_T $(DEBUG_FLAG)
 !else
-ARCH_CFLAGS     = -nologo -D_X86_=1 -c -Zel -W2 -H63 -O2 -Ob2 -GBdF -Zi -Zp8 $(DEBUG_FLAG)
+ARCH_CFLAGS     = -nologo -D_X86_=1 -c -Zel -W2 -H63 -O2 -Ob2 -GBdF -Zi -Zp8 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE_GLOBALS -D_USE_32BIT_TIME_T $(DEBUG_FLAG)
 !endif
 ARCH_LDFLAGS	= -align:0x1000 $(SYS_LDFLAGS)