Home » SIRTECH CLASSICS » Jagged Alliance: Unfinished Business » Vanilla Modding » Tutorial: Compiling sources with free MS commandline tools
| Tutorial: Compiling sources with free MS commandline tools[message #102102]
|
Thu, 02 December 2004 17:47
|
|
Mr.Homm |
 |
Messages:14
Registered:April 2004 Location: Hamburg |
|
|
I will describe the way I get my ja2.exe from the sources using only free software. At the bottom of this post are the links to the sites where you can download all the needed tools. To do it the way I describe it in this tutorial you need to download approx. 500MB mainly from microsoft.com. This tutorial will NOT explain how to use the commandline (CMD.EXE/COMMAND.COM)! Even worst, you'll have to edit a few source files, because the C++ compiler we'll downloading is more strict than C++ from MS Visual C v6.
But first we need the sources. To get them you'll need SVN (s. DOWNLOADS). After installing SVN you should be able to invoke it from the commandline: 'svn co http://hobby-software.com/svn/ja2test/trunk ' will checkout the sources to your current working directory creating a "trunk" subdirectory. I don't know who maintain the svnserver but at the moment I write this tutorial it is operating. After you've got the sources you can start downloading the tools (s. DOWNLOADS). Then install "Platform SDK", ".NET framework (redist)" and ".NET framework (SDK)". Make sure to install the .NET redist before .NET SDK and don't change the installationpaths or you'll have to edit the MAKE.BAT below.
Now copy the text of the batchfile MAKE.BAT from below (just everything between ### MAKE.BAT ### and ### DOWNLOAD ###) and create that file (MAKE.BAT) in your "trunk"-directory you've got from the svn-checkout. Just two more steps: there are two programs needed which we did'nt get by now. You get CVTRES.EXE from the selfextracting archiv cvtres1.exe, but BSCMAKE.EXE isn't available on the net (or at least I can't find it). No problem since BSCMAKE.EXE is a tool to maintain the "browser information" we don't need, we can use a dummy for it. I toke share.exe from \system32 and copied it to \Microsoft Visual Studio 8\bin\bscmake.exe, right beside CVTRES.EXE. share.exe is a short program and it returns no errorcode when invoking it.
Now we're ready to rumble. The MAKE.BAT batchfile will call nmake.exe with a configuration. There are many configurations, but you'll need only few. All configurations can be read at the top of the file \JA2.MAK. I have the german version of JA2 and would type 'make "ja2 - Win32 German Release"' to start the build process. Owner of the english version who wants the release version can omit the configuration, because MAKE.BAT will call nmake with the 'ja2 - Win32 Release' configuration in the case no configuration was given.
If you compile the sources the first time you'll get a few errors. The text below starting from ### SVN-DIFF ### is the 'svn diff' output. This shows which files I've changed and what I've changed in them. The good thing is, the compiler will spot the errors for you, and you only have to make the changes I've made. Every line starting with a single "-" means: this line was removed. Lines starting with a single "+" means: this line was inserted. Looking at the text you'll notice that I've mostly inserted typecasts, so you don't have to remove the whole line and type it anew.
Good luck!
### CAVEAT ###
A weird error occurs when the build process comes to build the Utils-objects: NMAKE : fatal error U1073: don't know how to make '"c:\program files\microsoft visual studio\vc98\include\basetsd.h"' Stop. There is no target basetsd.h in Utils.MAK and I found no other way to continue the build process as to create those directories and copy the headerfile basetsd.h from \Microsoft Platform SDK for Windows XP SP2\Include to c:\program files\microsoft visual studio\vc98\include\basetsd.h. Dunno if this will happens to you.
### MINIMUM FILES ###
If you don't want the whole MS-SDK to be installed on your drive you could use the files list below to copy them elsewhere and after that deinstall the SDKs. If you can't find a file listed below search in \Microsoft.NET. This lightweight build environment consumes only 22MB. Of course you'll have to modify MAKE.BAT in this case.
+---bin
| | cl.exe
| | mspdb80.dll
| | msvcr80.dll
| | c1.dll
| | msvcp80.dll
| | c2.dll
| | link.exe
| | c1xx.dll
| | nmake.exe
| | mspdbsrv.exe
| | mspdbcore.dll
| | msobj80.dll
| | BSCMAKE.EXE
| | RC.Exe
| | RcDll.Dll
| | cvtres.exe
| | mpr.dll
| |
| \---1033
| clui.dll
|
+---lib
| libcmt.lib
| oldnames.lib
| kernel32.lib
| User32.Lib
| WinSpool.Lib
| Gdi32.Lib
| ComDlg32.Lib
| AdvAPI32.Lib
| Shell32.Lib
| Ole32.Lib
| OleAut32.Lib
| Uuid.Lib
| WinMM.Lib
|
\---include
| stdlib.h
| crtdefs.h
| stdio.h
| swprintf.inl
| vadefs.h
| wchar.h
| wtime.inl
| malloc.h
| Windows.h
| excpt.h
| stdarg.h
| WinDef.h
| WinNT.h
| ctype.h
| specstrings.h
| BaseTsd.h
| Guiddef.h
| string.h
| PshPack4.h
| PopPack.h
| PshPack2.h
| PshPack8.h
| WinBase.h
| WinError.h
| WinGDI.h
| PshPack1.h
| WinUser.h
| Tvout.h
| WinNls.h
| WinCon.h
| WinVer.h
| WinReg.h
| Reason.h
| WinNetWk.h
| StrAlign.h
| WinSvc.h
| Mcx.h
| Imm.h
| MMSystem.h
| ObjBase.h
| Rpc.h
| RpcDce.h
| RpcDceP.h
| RpcNsi.h
| RpcNtErr.h
| RpcAsync.h
| RpcNdr.h
| RpcNsip.h
| WTypes.h
| Unknwn.h
| ObjIdl.h
| CGuid.h
| UrlMon.h
| OleIdl.h
| ServProv.h
| MsXml.h
| OAIdl.h
| PropIdl.h
| process.h
| memory.h
| time.h
| time.inl
| math.h
| tchar.h
| float.h
| CdErr.h
| Dde.h
| Ddeml.h
| Dlgs.h
| LZExpand.h
| Nb30.h
| ShellAPI.h
| WinPerf.h
| WinSock.h
| WinCrypt.h
| WinEFS.h
| WinSCard.h
| WinIoCtl.h
| WinSmCrd.h
| WinSpool.h
| PrSht.h
| Ole2.h
| OleAuto.h
| CommDlg.h
| mbstring.h
| io.h
| fcntl.h
| share.h
| WindowsX.h
| errno.h
| direct.h
| assert.h
| InitGuid.h
| zmouse.h
| Dbt.h
| winresrc.h
| CommCtrl.h
|
\---sys
types.h
stat.h
stat.inl
### MAKE.BAT ###
@echo off
rem ProgramFiles=
if not "%ProgramFiles%" == "" goto l1
set ProgramFiles=C:\Program Files
:l1
set NETPATH=%ProgramFiles%\Microsoft.NET\SDK\v2.0
set SDKPATH=%ProgramFiles%\Microsoft Platform SDK for Windows XP SP2
set VSPATH=%ProgramFiles%\Microsoft Visual Studio 8
set OLDPATH=%PATH%
set PATH=%WINDIR%\SYSTEM32;%WINDIR%;%VSPATH%\VC\bin;%VSPATH%\Common7\IDE;%NETPATH%\bin;%SDKPATH%\bin
set INCLUDE=%VSPATH%\VC\include;%SDKPATH%\include
set LIB=%VSPATH%\VC\lib;%SDKPATH%\lib
set TARGET=%1
if not _%TARGET% == _ goto l2
set TARGET="ja2 - Win32 Release"
:l2
nmake /f ja2.mak CFG=%TARGET%
set PATH=%OLDPATH%
set OLDPATH=
set TARGET=
set NETPATH=
set SDKPATH=
set VSPATH=
set INCLUDE=
set LIB=
### DOWNLOADS ###
- SVN
name: svn-1.0.9-setup.exe
size: 2.57 mb
http://subversion.tigris.org/files/documents/15/17847/svn-1.0.9-setup.exe
- WinXP SP2 Platfrom SDK
name: PSDK-FULL...
size: 266000 KB
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/XPSP2FULLInstall.htm
- .NET 2.0 beta framework (redist)
name: dotnetfx.exe
size: 24615 KB
http://msdn.microsoft.com/library/default.asp?url=/downloads/list/netdevframework.asp
- .NET 2.0 beta framework (SDK)
name: setup.exe
size: 234532 KB
http://msdn.microsoft.com/library/default.asp?url=/downloads/list/netdevframework.asp
- CVTRES.EXE
name: cvtres1.exe
size: 31 KB
http://download.microsoft.com/download/vstudio97pro/patch/1/win98/en-us/cvtres1.exe
### SVN-DIFF ###
Index: Tactical/SoldierProfile.cpp
===================================================================
--- Tactical/SoldierProfile.cpp (revision 44)
+++ Tactical/SoldierProfile.cpp (working copy)
@@ -701,10 +701,10 @@
uiStats = ((2 * pProfile->bLifeMax) + pProfile->bStrength + pProfile->bAgility + pProfile->bDexterity + ((pProfile->bLeadership + pProfile->bWisdom) / 2)) / 3;
// marksmanship is very important, count it double
- uiSkills = (UINT32) ((2 * (pow(pProfile->bMarksmanship, 3) / 10000)) +
- 1.5 * (pow(pProfile->bMedical, 3) / 10000) +
- (pow(pProfile->bMechanical, 3) / 10000) +
- (pow(pProfile->bExplosive, 3) / 10000));
+ uiSkills = (UINT32) ((2 * (pow((double)pProfile->bMarksmanship, 3) / 10000)) +
+ 1.5 * (pow((double)pProfile->bMedical, 3) / 10000) +
+ (pow((double)pProfile->bMechanical, 3) / 10000) +
+ (pow((double)pProfile->bExplosive, 3) / 10000));
// action points
uiActionPoints = 5 + (((10 * pProfile->bExpLevel +
Index: Utils/Cinematics.cpp
===================================================================
--- Utils/Cinematics.cpp (revision 44)
+++ Utils/Cinematics.cpp (working copy)
@@ -43,7 +43,7 @@
#include "radmalw.i"
-#include
+// #include
//-Structures----------------------------------------------------------------------
Index: TileEngine/ShadeTableUtil.cpp
===================================================================
--- TileEngine/ShadeTableUtil.cpp (revision 44)
+++ TileEngine/ShadeTableUtil.cpp (working copy)
@@ -120,7 +120,7 @@
//stored in the TileSurfaceFilenames[]. If it isn't, then that is a huge problem
//and should be fixed. Also assumes that the directory is set to Data\ShadeTables.
strcpy( ShadeFileName, TileSurfaceFilenames[ uiTileTypeIndex ] );
- ptr = (UINT8 *)strstr( ShadeFileName, "." );
+ ptr = (UINT8 *)strstr( (const char *) ShadeFileName, "." );
if( !ptr )
{
return FALSE;
@@ -167,7 +167,7 @@
//stored in the TileSurfaceFilenames[]. If it isn't, then that is a huge problem
//and should be fixed. Also assumes that the directory is set to Data\ShadeTables.
strcpy( ShadeFileName, TileSurfaceFilenames[ uiTileTypeIndex ] );
- ptr = (UINT8 *)strstr( ShadeFileName, "." );
+ ptr = (UINT8 *)strstr( (const char *) ShadeFileName, "." );
if( !ptr )
{
return FALSE;
Index: TileEngine/TileCache.cpp
===================================================================
--- TileEngine/TileCache.cpp (revision 44)
+++ TileEngine/TileCache.cpp (working copy)
@@ -342,7 +342,7 @@
// Remove path
strcpy( cTempFilename, pSrcStr );
- cEndOfName = strrchr( cTempFilename, '\\' );
+ cEndOfName = (STR) strrchr( (const char *) cTempFilename, '\\' );
if (cEndOfName != NULL)
{
cEndOfName++;
@@ -354,7 +354,7 @@
}
// Now remove extension...
- cEndOfName = strchr( (const char *)pDestStr, '.' );
+ cEndOfName = (STR) strchr( (const char *)pDestStr, '.' );
if (cEndOfName != NULL)
{
*cEndOfName = '\0';
Index: StandardGamingPlatform/himage.cpp
===================================================================
--- StandardGamingPlatform/himage.cpp (revision 44)
+++ StandardGamingPlatform/himage.cpp (working copy)
@@ -37,7 +37,7 @@
// Depending on extension of filename, use different image readers
// Get extension
- StrPtr = strstr( ImageFile, ExtensionSep );
+ StrPtr = (STR) strstr( (const char *) ImageFile, (const char *) ExtensionSep );
if ( StrPtr == NULL )
{
Index: Res/ja2.rc
===================================================================
--- Res/ja2.rc (revision 44)
+++ Res/ja2.rc (working copy)
@@ -7,8 +7,8 @@
//
// Generated from the TEXTINCLUDE 2 resource.
//
-#include "afxres.h"
-
+//#include "afxres.h"
+#include
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
Index: StandardGamingPlatform/DEBUG.H
===================================================================
--- StandardGamingPlatform/DEBUG.H (revision 44)
+++ StandardGamingPlatform/DEBUG.H (working copy)
@@ -14,7 +14,7 @@
#ifndef __DEBUG_MANAGER_
#define __DEBUG_MANAGER_
-#include
+//#include
#include "types.h"
#include "TopicOps.h"
### END OF TUTORIAL ###
Report message to a moderator
|
Private
|
|
|
|
|
|
|
|
|
|
| Re: Tutorial: Compiling sources with free MS commandline tools[message #131473]
|
Fri, 02 March 2007 22:00 
|
|
| Hutton |
 |
Messages:7
Registered:February 2007 |
|
|
I had an error with a missing crtdbg.h.
I've corrected it by Getting Visual C++ here: http://msdn.microsoft.com/vstudio/express/downloads/default.aspx
Before installing it, you have to uninstall some of the previous components. (The instilation program will interupt and tell you so if you haven't). You can get an auto unistaller here: http://msdn.microsoft.com/vstudio/express/support/uninstall/
Now I'm getting an error with cl.exe which is, I gather, some sort of error checker.
Does making the changes under "### SVN-DIFF ###" fix this one? I was trying to get the compiling working before I woried about the changes, but maybe it doesn't work that way.
Obviously I'm not a programmer, so if anyone could let me know if I'm on the right track, I'd appreciate it.
Report message to a moderator
|
Private
|
|
|
|
| Re: Tutorial: Compiling sources with free MS commandline tools[message #131476]
|
Fri, 02 March 2007 23:05 
|
|
| Hutton |
 |
Messages:7
Registered:February 2007 |
|
|
I've made the changes to the files, but i'm still getting the same error.
I noticed that the two files that call for this change:
-#include
+//#include
actually have the line "#include " where "#include" is supposed to be. I don't know if that's related or not. I've tried substituing with both
//#include
and
//#include
but both produce an error that reads:
NMAKE : fatal error U1077: '"C\PROGRA~1\Microsoft Visual Studio 8\vc\bin\cl.exe"' : return code '0*2'
Stop
NMAKE : fatal error U1077: '"C\PROGRA~1\Microsoft Visual Studio 8\vc\bin\cnmake.exe"' : return code '0*2'
Stop
If this means anything to anybody, I'd much oblige a few pointers.
Report message to a moderator
|
Private
|
|
|
|
| Re: Tutorial: Compiling sources with free MS commandline tools[message #131492]
|
Sat, 03 March 2007 02:09 
|
|
| Hutton |
 |
Messages:7
Registered:February 2007 |
|
|
ok, I've sussed it out.
For the benefit of other non-programmers that refer to this thread, and have an error related to cl.exe
change the following line in make.bat from:
set TARGET="ja2 - Win32 Release"
to
set TARGET="ja2 - Win32 Release" /I
I suspect that entering 'make "ja2 - Win32 Release" /I' would have also worked.
I think the /I is case sensative.
I now have:
LINK : fatal error LNK1181: cannot open input file '.\Release\overhead map.obj
but it looks to me like this is aerror within the 'Build' directory, which I find a little easier to decipher.
[Updated on: Sat, 03 March 2007 03:02] by Moderator Report message to a moderator
|
Private
|
|
|
|
| Re: Tutorial: Compiling sources with free MS commandline tools[message #131560]
|
Sat, 03 March 2007 17:32 
|
|
| Hutton |
 |
Messages:7
Registered:February 2007 |
|
|
Well, I was mistaken about being able to figure that error out.
I'm now trying to compile with the 'Visual Studio 2005 Command Prompt', but I can't find a website that will tell me what extension means a file is an input source, or which option I use to specify it.
Please help! I'm starting to loose hair!
Report message to a moderator
|
Private
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Sun Jun 14 00:08:36 GMT+3 2026
Total time taken to generate the page: 0.00980 seconds
|