[Home] [Downloads] [Search] [Help/forum]

Compiling PennMUSH


Source files

The Win32 and Unix source are currently maintained in the same source files, so that changes to the Unix version are automatically reflected for people compiling under Win32.

The differences needed for Win32 compilation are surrounded by:


	#ifdef WIN32

	... Win32 statements or declarations ...

	#endif


Source

The current source code of PennMUSH can be found at the site:

ftp://pennmush.tinymush.org/pub/DuneMUSH/Source/

The file name will look something like this:


pennmush-1.6.10p0.tar.gz

(This example is for PennMUSH 1.6.10 patchlevel 0)

Note that in order to compile the source you will need a C compiler. The one I used to compile the executable version is the Microsoft Visual C++ compiler, version 4.2.

You will also need to un-gzip, and un-tar the file, before you can compile it. To do this I recommend using WinZip, which is available from:

http://www.winzip.com/


Step-by-step instructions for compiling under Win32

Conditions

These instructions were tested under the following conditions;

To see how I compiled 1.7.2 p2, follow this link: How to compile version 1.7.2


Download files

  1. Download the Pennmush source from:

    ftp://pennmush.tinymush.org/pub/DuneMUSH/Source/oldsrc/1.6/pennmush-1.6.9p0.tar.gz

  2. Download SHS.C from:

    ftp://lists.pennmush.org/pub/PennMUSH/shs.c

  3. Obtain SHS.H from [SHS.H Listing] and save to disk as SHS.H

Unzip archive and prepare to compile

  1. Use Winzip to uncompress "pennmush-1.6.9p0.tar.gz" into an appropriate directory (eg. C:\PENNMUSH).
  2. Go to the Win32 directory
  3. Create subdirectory: win32\sce
  4. Copy all Unix source files from the "src" directory. NB - leave originals there for use during future patching operations (ie. hold down Ctrl key to make a copy rather than move the files).
  5. Copy all Unix headers from the "hdrs" directory. NB - leave originals there for use during future patching operations.
  6. Copy all Win32 source from the win32 directory EXCEPT "pennmush.mak", overriding files where necessary. NB - leave originals there for use during future patching operations.
  7. Add SHS.C and SHS.H (obtained earlier) to the win32\sce directory
  8. Use your C++ compiler to open PENNMUSH.MAK
  9. Add SERVICES.C to the project
  10. Add ACCESS.C to the project
  11. In SERVICES.C (line 25) change the include from

    #include "conmagic.h"

    to

    #include "confmagic.h"

  12. Add:

    #include <ctype.h>

    to the list of includes in ACCESS.C

  13. Add:

    #include <ctype.h>

    to the list of includes in ATTRIB.C

  14. Bring up the "Project Settings" window, C++ tab, Category "Code Generation" and change "Use run-time library" to "Multithreaded" (or "Debug Multithreaded" if you are doing a debug build) - see below.

    Example of setting multithreaded option - 11K


How it should look

Your finished pennmush\win32\sce directory structure should look like this:

PennMUSH source structure

The contents of the "sce" directory should be:

PennMUSH source directory contents


Compile and test

  1. Compile
  2. Ignore various warnings.
  3. Copy the resulting PENNMUSH.EXE from "Windebug" subdirectory to the "GAME" directory
  4. Amend MUSH.CFG as described in Configuring PennMUSH
  5. Open a command window, and type: PENNMUSH /RUN

That's it! It should work.


Using other compilers

I cannot guarantee that you can compile using other compilers (eg. Borland) however there is no reason why not, provided they support Windows sockets, and multiple threads. In case your compiler cannot read the "mak" file, click on Source Listing to see a listing of all of the source files that should be in your project.


Adding patchlevels

Once a new release of PennMUSH is released, minor changes are made by adding "patches". These are files that are created by using the "diff" utility to find the difference between the newer version and the distributed major version. Under Unix (or Linux) it is a simple matter to run the "patch" utility which reapplies the patches back. Patches for the older source files can be found at:

ftp://pennmush.tinymush.org/pub/DuneMUSH/Source/oldpatches/

Example of a patch file


*** /tmp/T0a00543	Mon Sep 30 15:24:20 1996
--- src/funmisc.c	Tue Sep 24 10:59:31 1996
***************
*** 119,124 ****
--- 119,126 ----
      return;
    }
    strcpy(renv[r], args[1]);
+   if (!strcmp(called_as, &quot;SETR&quot;))
+     safe_str(args[1], buff, bp);
  }
 

What this means is that:

How to apply patches

A copy of the PATCH program has been ported to Win32. You can obtain it from:

ftp://ftp.ozemail.com.au/pub/gammon/pennmush/patch.zip

Because the PATCH program has been ported from Unix, it is rather idiosyncratic under Windows :(. After lengthy investigation I have found that the following methods will get it to work reasonably well ...

To use it, copy the above code and paste into a file called PATCHIT.BAT. Then, to apply a patch, you would enter (say):


patchit patch01

Note that this patches the original files (ie. in the Unix directories), so that after doing one or more patches you would then copy the .c and .h files back into the win32\sce directory before recompiling.

You may get errors during the patch process, but if the file with the error is not a .c or .h file I wouldn't worry too much. Files like "configure" and suchlike are only used during the Unix compilation process anyway.

Using the above process I successfully applied patches 1 through to 10 for PennMUSH version 1.6.9 and recompiled without any errors.


Latest source

The latest source for PennMUSH, along with the appropriate patch files, can be found at:

ftp://pennmush.tinymush.org/pub/DuneMUSH/Source/


[Previous] [Back] [Home]
Written by Nick Gammon - 5K

Comments to Gammon Software support

[Best viewed with any browser - 2K]    Internet Contents Rating Association (ICRA) - 2K    [Web site powered by FutureQuest.Net]

Page updated on Wednesday, 15 December 2004