[LONG] Re: Way to Run Circle on dos

From: Chris Warren (chris@calligrafix.co.uk)
Date: 01/04/97


Joshua L Morris wrote:
> 
> On Fri, 3 Jan 1997 10:39:17 -0800 (PST) Daniel Koepke
> <dkoepke@california.com> writes:
> >Install a real os...or if you don't want to do that, Circle wil
> >compile on Windows 95 [notice the subtle way in which I've
> >implied Win95 is not a real OS...oops, there goes the whole
> >idea of being indirect].
> 
> I have Moved it Over to to my Other computer witch Has Win95 installed on
> it....
> I also Relized that I would need Vissule C to Run it.  One Porgram that I
> don't.....
> If I was wandering can I use another compiler on it?

Yes you can, I made a readme on how to use GCC for Win95 to compile
it... I sent it to Jeremy but haven't heard a word since!

Here is the doc... anyways...

Chris

---8<---

             Compiling CircleMud 3 using Minimalist GCC Windows32
             ----------------------------------------------------
                           It works and it's free!
             ----------------------------------------------------
             Chris Warren <chris@calligrafix.co.uk> - December 96

!!!!NOTE!!!!-This document is written with Patchlevel 11 in mind.-!!!!NOTE!!!!


Contents
-----------------------------------------------------------------------------
   1.....................Introduction
   2.....................Obtaining and Installing the Compiler
   3.....................Changes needed to the code.
   4.....................The new Makefile
   5.....................The new conf.h





Introduction
-----------------------------------------------------------------------------
So you want to compile CircleMud to run under Windows 95 or Windows NT and
you don't want or can't afford Microsoft's compiler. This is the situation
is was in. Luckily I had heard of the Cygnus GNU project to port all GNU
software over to the Win32 platform, and also Minimalist GCC Win32 (MINGW32)
which is a configuration that allows you to compile to native standalone
Win32 code with out the dependancy of cygwin.dll. This readme will show you
how to alter the code to allow this comfiguration to compile it successfully.

If you get stuck, find a mistake in this document or generally just want to
chat then contact me at chris@calligrafix.co.uk

Oh, and one last thing. Two of the utilities will not compile. They are
autowiz (as MINGW32 does not support signals correctly at the moment) and sign
which needs a bit if alteration to get sockets to work correctly.





Obtaining and Installing the Compiler
-----------------------------------------------------------------------------
Luckily there is a good web page available which shows clearly how to install
MINGW32 and how to use it... It is written by the author of MINGW32 and is
available at the following URL:

         http://www.fu.is.saga-u.ac.jp/~colin/mingw32.html

One file that the above does not mention is Make, which is in archive five.
It is not necessary but useful. If you want it extract it to your \usr\bin
directory.



Changes to the code
-----------------------------------------------------------------------------
Only three files need altered. Just add the lines that have a + next to
them. Line numbers are only a guide, but should be almost correct!

comm.c
======
Line 17-22:
   #ifdef CIRCLE_WINDOWS           /* Includes for Win32 */
 + #ifndef CIRCLE_MINGW32          /* but not if compiling using GNU */
   #include <direct.h>
   #include <mmsystem.h>
 + #endif
   #else                           /* Includes for UNIX */


comm.h
======
Line 48-52:
   #if defined(__COMM_C__) && defined(__GNUC__)
 + #ifndef CIRCLE_MINGW32
   #ifndef accept
      int accept();
   #endif

Line 122-126:
   #ifndef write
      int write();
   #endif
 + #endif /* CIRCLE_MINGW32 */
   #endif /* __COMM_C__ */


sysdep.h
========
Line 72-77: (This can go almost anywhere in the file!)
 + #ifdef CIRCLE_MINGW32
 + # define byte int               /* Really silly that byte is undefined */
 + # include <windows.h>
 + # include <windows32/defines.h>
 + # include <windows32/messages.h>
 + #endif

Line 163-168:
   #ifdef CIRCLE_WINDOWS   /* Definitions for Win32 */
 + #ifndef CIRCLE_MINGW32  /* but not for GNU       */
   #define FD_SETSIZE 1024
   #include <winsock.h>
 + #endif
   typedef SOCKET socket_t;

Line 268-280:
   #ifndef fwrite
      size_t fwrite();
   #endif
   
 + #ifndef CIRCLE_MINGW32  /* Must be a bug in the compiler: will try to Redefine these ignoring the ifndef */
   #ifndef getpid          
      pid_t getpid();
   #endif

   #ifndef gettimeofday
      int gettimeofday();
   #endif
 + #endif






Changes to the Makefile
-----------------------------------------------------------------------------
Due to some small flaws configure will not produce a makefile. So copy the
text between the markers into a file called Makefile in your source directory.

!!!NOTE!!! Make sure TABS are preserved as ASCII char 9 not a bunch of spaces!

---BEGIN Makefile MARKER---

# CircleMUD 3.0 Makefile for MINGW32 GNU GCC
# By Chris Warren - Dec 1996 - Based on makefile.in

# C compiler to use
CC = GCC

# Any special flags you want to pass to the compiler
MYFLAGS = -c 

#flags for profiling (see hacker.doc for more information)
PROFILE = 

MAKE = MAKE

LIBS = -lkernel32 -luser32 -lgdi32 -lshell32 -lwsock32 -Wl,--subsystem,console

##############################################################################
# Do Not Modify Anything Below This Line (unless you know what you're doing) #
##############################################################################

CFLAGS = $(MYFLAGS) $(PROFILE)

OBJFILES = comm.o act.comm.o act.informative.o act.movement.o act.item.o \
	act.offensive.o act.other.o act.social.o act.wizard.o ban.o boards.o \
	castle.o class.o config.o constants.o db.o fight.o graph.o handler.o \
	house.o interpreter.o limits.o magic.o mail.o mobact.o modify.o \
	objsave.o olc.o shop.o spec_assign.o spec_procs.o spell_parser.o \
	spells.o utils.o weather.o random.o

default: .accepted
	$(MAKE) ../bin/circle

.accepted:
#	@./licheck @MORE@

utils: .accepted	
	# I am currently having problems getting all the utilities to compile....
	# Currently autowiz and sign don't compile.
	#$(MAKE) ../bin/autowiz
	$(MAKE) ../bin/delobjs
	$(MAKE) ../bin/listrent
	$(MAKE) ../bin/mudpasswd
	$(MAKE) ../bin/play2to3
	$(MAKE) ../bin/purgeplay
	$(MAKE) ../bin/shopconv
	$(MAKE) ../bin/showplay
	#$(MAKE) ../bin/sign
	$(MAKE) ../bin/split
	$(MAKE) ../bin/wld2html

all: .accepted
	$(MAKE) ../bin/circle
	$(MAKE) utils

circle:
	$(MAKE) ../bin/circle
autowiz:
	$(MAKE) ../bin/autowiz
delobjs:
	$(MAKE) ../bin/delobjs
listrent:
	$(MAKE) ../bin/listrent
mudpasswd:
	$(MAKE) ../bin/mudpasswd
play2to3:
	$(MAKE) ../bin/play2to3
purgeplay:
	$(MAKE) ../bin/purgeplay
shopconv:
	$(MAKE) ../bin/shopconv
showplay:
	$(MAKE) ../bin/showplay
sign:
	$(MAKE) ../bin/sign
split:
	$(MAKE) ../bin/split
wld2html:
	$(MAKE) ../bin/wld2html


../bin/autowiz: util/autowiz.c conf.h sysdep.h structs.h utils.h db.h
	$(CC) $(CFLAGS) -o util/autowiz.o util/autowiz.c
	$(CC) -o ../bin/autowiz.exe util/autowiz.o $(LIBS)

../bin/delobjs: util/delobjs.c conf.h sysdep.h structs.h
	$(CC) $(CFLAGS) -o util/delobjs.o util/delobjs.c
	$(CC) -o ../bin/delobjs.exe util/delobjs.o $(LIBS)

../bin/listrent: util/listrent.c conf.h sysdep.h structs.h
	$(CC) $(CFLAGS) -o util/listrent.o util/listrent.c
	$(CC) -o ../bin/listrent.exe util/listrent.o $(LIBS)

../bin/mudpasswd: util/mudpasswd.c conf.h sysdep.h structs.h utils.h
	$(CC) $(CFLAGS) -o util/mudpasswd.o util/mudpasswd.c
	$(CC) -o ../bin/mudpasswd.exe util/mudpasswd.o $(LIBS)

../bin/play2to3: util/play2to3.c
	$(CC) $(CFLAGS) -o util/play2to3.o util/play2to3.c
	$(CC) -o ../bin/play2to3.exe util/play2to3.o $(LIBS)

../bin/purgeplay: util/purgeplay.c conf.h sysdep.h structs.h utils.h
	$(CC) $(CFLAGS) -o util/purgeplay.o util/purgeplay.c
	$(CC) -o ../bin/purgeplay.exe util/purgeplay.o $(LIBS)

../bin/shopconv: util/shopconv.c conf.h sysdep.h structs.h db.h utils.h shop.h
	$(CC) $(CFLAGS) -o util/shopconv.o util/shopconv.c
	$(CC) -o ../bin/shopconv.exe util/shopconv.o $(LIBS)

../bin/showplay: util/showplay.c conf.h sysdep.h structs.h
	$(CC) $(CFLAGS) -o util/showplay.o util/showplay.c
	$(CC) -o ../bin/showplay.exe util/showplay.o $(LIBS)

../bin/sign: util/sign.c conf.h sysdep.h
	$(CC) $(CFLAGS) -o util/sign.o util/sign.c
	$(CC) -o ../bin/sign.exe util/sign.o $(LIBS)

../bin/split: util/split.c
	$(CC) $(CFLAGS) -o util/split.o util/split.c
	$(CC) -o ../bin/split.exe util/split.o $(LIBS)

../bin/wld2html: util/wld2html.c
	$(CC) $(CFLAGS) -o util/wld2html.o util/wld2html.c
	$(CC) -o ../bin/wld2html.exe util/wld2html.o $(LIBS)

../bin/circle : $(OBJFILES)
	$(CC) -o ../bin/circle.exe $(PROFILE) $(OBJFILES) $(LIBS)
clean:
	del *.o

# Dependencies for the object files (automagically generated with
# gcc -MM)

act.comm.o: act.comm.c conf.h sysdep.h structs.h utils.h comm.h interpreter.h \
  handler.h db.h screen.h
	$(CC) -c $(CFLAGS) act.comm.c
act.informative.o: act.informative.c conf.h sysdep.h structs.h utils.h comm.h \
  interpreter.h handler.h db.h spells.h screen.h
	$(CC) -c $(CFLAGS) act.informative.c
act.item.o: act.item.c conf.h sysdep.h structs.h utils.h comm.h interpreter.h \
  handler.h db.h spells.h
	$(CC) -c $(CFLAGS) act.item.c
act.movement.o: act.movement.c conf.h sysdep.h structs.h utils.h comm.h \
  interpreter.h handler.h db.h spells.h house.h
	$(CC) -c $(CFLAGS) act.movement.c
act.offensive.o: act.offensive.c conf.h sysdep.h structs.h utils.h comm.h \
  interpreter.h handler.h db.h spells.h
	$(CC) -c $(CFLAGS) act.offensive.c
act.other.o: act.other.c conf.h sysdep.h structs.h utils.h comm.h interpreter.h \
  handler.h db.h spells.h screen.h house.h
	$(CC) -c $(CFLAGS) act.other.c
act.social.o: act.social.c conf.h sysdep.h structs.h utils.h comm.h \
  interpreter.h handler.h db.h spells.h
	$(CC) -c $(CFLAGS) act.social.c
act.wizard.o: act.wizard.c conf.h sysdep.h structs.h utils.h comm.h \
  interpreter.h handler.h db.h spells.h house.h screen.h
	$(CC) -c $(CFLAGS) act.wizard.c
ban.o: ban.c conf.h sysdep.h structs.h utils.h comm.h interpreter.h handler.h db.h
	$(CC) -c $(CFLAGS) ban.c
boards.o: boards.c conf.h sysdep.h structs.h utils.h comm.h db.h boards.h \
  interpreter.h handler.h
	$(CC) -c $(CFLAGS) boards.c
castle.o: castle.c conf.h sysdep.h structs.h utils.h comm.h interpreter.h \
  handler.h db.h spells.h
	$(CC) -c $(CFLAGS) castle.c
class.o: class.c conf.h sysdep.h structs.h db.h utils.h spells.h interpreter.h
	$(CC) -c $(CFLAGS) class.c
comm.o: comm.c conf.h sysdep.h structs.h utils.h comm.h interpreter.h handler.h \
  db.h house.h
	$(CC) -c $(CFLAGS) comm.c
config.o: config.c conf.h sysdep.h structs.h
	$(CC) -c $(CFLAGS) config.c
constants.o: constants.c conf.h sysdep.h structs.h
	$(CC) -c $(CFLAGS) constants.c
db.o: db.c conf.h sysdep.h structs.h utils.h db.h comm.h handler.h spells.h mail.h \
  interpreter.h house.h
	$(CC) -c $(CFLAGS) db.c
fight.o: fight.c conf.h sysdep.h structs.h utils.h comm.h handler.h interpreter.h \
  db.h spells.h screen.h
	$(CC) -c $(CFLAGS) fight.c
graph.o: graph.c conf.h sysdep.h structs.h utils.h comm.h interpreter.h handler.h \
  db.h spells.h
	$(CC) -c $(CFLAGS) graph.c
handler.o: handler.c conf.h sysdep.h structs.h utils.h comm.h db.h handler.h \
  interpreter.h spells.h
	$(CC) -c $(CFLAGS) handler.c
house.o: house.c conf.h sysdep.h structs.h comm.h handler.h db.h interpreter.h \
  utils.h house.h
	$(CC) -c $(CFLAGS) house.c
interpreter.o: interpreter.c conf.h sysdep.h structs.h comm.h interpreter.h db.h \
  utils.h spells.h handler.h mail.h screen.h
	$(CC) -c $(CFLAGS) interpreter.c
limits.o: limits.c conf.h sysdep.h structs.h utils.h spells.h comm.h db.h \
  handler.h
	$(CC) -c $(CFLAGS) limits.c
magic.o: magic.c conf.h sysdep.h structs.h utils.h comm.h spells.h handler.h db.h
	$(CC) -c $(CFLAGS) magic.c
mail.o: mail.c conf.h sysdep.h structs.h utils.h comm.h db.h interpreter.h \
  handler.h mail.h
	$(CC) -c $(CFLAGS) mail.c
mobact.o: mobact.c conf.h sysdep.h structs.h utils.h db.h comm.h interpreter.h \
  handler.h spells.h
	$(CC) -c $(CFLAGS) mobact.c
modify.o: modify.c conf.h sysdep.h structs.h utils.h interpreter.h handler.h db.h \
  comm.h spells.h mail.h boards.h
	$(CC) -c $(CFLAGS) modify.c
objsave.o: objsave.c conf.h sysdep.h structs.h comm.h handler.h db.h \
  interpreter.h utils.h spells.h
	$(CC) -c $(CFLAGS) objsave.c
olc.o: olc.c conf.h sysdep.h structs.h utils.h comm.h interpreter.h handler.h db.h \
  olc.h
	$(CC) -c $(CFLAGS) olc.c
random.o: random.c
	$(CC) -c $(CFLAGS) random.c
shop.o: shop.c conf.h sysdep.h structs.h comm.h handler.h db.h interpreter.h \
  utils.h shop.h
	$(CC) -c $(CFLAGS) shop.c
spec_assign.o: spec_assign.c conf.h sysdep.h structs.h db.h interpreter.h \
  utils.h
	$(CC) -c $(CFLAGS) spec_assign.c
spec_procs.o: spec_procs.c conf.h sysdep.h structs.h utils.h comm.h \
  interpreter.h handler.h db.h spells.h
	$(CC) -c $(CFLAGS) spec_procs.c
spell_parser.o: spell_parser.c conf.h sysdep.h structs.h utils.h interpreter.h \
  spells.h handler.h comm.h db.h
	$(CC) -c $(CFLAGS) spell_parser.c
spells.o: spells.c conf.h sysdep.h structs.h utils.h comm.h spells.h handler.h \
  db.h
	$(CC) -c $(CFLAGS) spells.c
utils.o: utils.c conf.h sysdep.h structs.h utils.h comm.h screen.h spells.h \
  handler.h
	$(CC) -c $(CFLAGS) utils.c
weather.o: weather.c conf.h sysdep.h structs.h utils.h comm.h handler.h \
  interpreter.h db.h
	$(CC) -c $(CFLAGS) weather.c

---END Makefile MARKER---


Changes to the Conf.h
-----------------------------------------------------------------------------
We have the same problem here as with the Makefile, so just copy the text
between the markers into a file in your source directory called conf.h

---BEGIN conf.h MARKER---

/* src/conf.h - Not generated by configure. Generated by hand for MINGW32  */
/* By Chris Warren - Dec 1996 - Based on conf.h.in */

/* Define to empty if the keyword does not work.  */
// #undef const

//#define POSIX_NONBLOCK_BROKEN

#define CIRCLE_MINGW32
#define CIRCLE_WINDOWS

/* Define if you have <sys/wait.h> that is POSIX.1 compatible.  */
// #define HAVE_SYS_WAIT_H 1

/* Define to `int' if <sys/types.h> doesn't define.  */
#define pid_t int

/* Define as the return type of signal handlers (int or void).  */
#define RETSIGTYPE void

/* Define to `unsigned' if <sys/types.h> doesn't define.  */
// #undef size_t

/* Define if you have the ANSI C header files.  */
// #undef STDC_HEADERS

/* Define if you can safely include both <sys/time.h> and <time.h>.  */
// #define TIME_WITH_SYS_TIME 1

/* Define if you have the crypt function.  */
// #undef HAVE_CRYPT

/* Define if you have the random function.  */
// #undef HAVE_RANDOM

/* Define if you have the <arpa/telnet.h> header file.  */
// #define HAVE_ARPA_TELNET_H 1

/* Define if you have the <assert.h> header file.  */
#define HAVE_ASSERT_H 1

/* Define if you have the <crypt.h> header file.  */
// #define HAVE_CRYPT_H 1

/* Define if you have the <errno.h> header file.  */
#define HAVE_ERRNO_H 1

/* Define if you have the <fcntl.h> header file.  */
#define HAVE_FCNTL_H 1

/* Define if you have the <limits.h> header file.  */
#define HAVE_LIMITS_H 1

/* Define if you have the <memory.h> header file.  */
#define HAVE_MEMORY_H 1

/* Define if you have the <net/errno.h> header file.  */
// #define HAVE_NET_ERRNO_H 1

/* Define if you have the <string.h> header file.  */
#define HAVE_STRING_H 1

/* Define if you have the <sys/fcntl.h> header file.  */
#define HAVE_SYS_FCNTL_H 1

/* Define if you have the <sys/select.h> header file.  */
// #define HAVE_SYS_SELECT_H 1

/* Define if you have the <sys/time.h> header file.  */
// #define HAVE_SYS_TIME_H 1

/* Define if you have the <sys/types.h> header file.  */
#define HAVE_SYS_TYPES_H 1

/* Define if you have the <unistd.h> header file.  */
#define HAVE_UNISTD_H 1

/* Define if you have the crypt library (-lcrypt).  */
// #undef HAVE_LIBCRYPT

/* Define if you have the malloc library (-lmalloc).  */
// #undef HAVE_LIBMALLOC

/* Define if you have the nsl library (-lnsl).  */
// #undef HAVE_LIBNSL

/* Define if you have the socket library (-lsocket).  */
// #undef HAVE_LIBSOCKET

---END conf.h MARKER---



This archive was generated by hypermail 2b30 : 12/18/00 PST