MinGW environment for building OpenTTD

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

User avatar
LKRaider
Transport Coordinator
Transport Coordinator
Posts: 360
Joined: 23 Mar 2005 04:05
Location: Brasil
Contact:

MinGW environment for building OpenTTD

Post by LKRaider »

Hi there :)

I documented a step-by-step guide to get a working build environment to compile SVN OpenTTD on Windows. If you ever wanted to do it, but didn't know how, here is your chance :wink:

So, here we go:


Download needed files:
Install the packages:
Install MSYS:
Folder: X:\msys (remove the 1.0 thing, it's useless)
Questions: Answer "no" when it asks about MinGW, we'll install it next.

Install MinGW:
Preparation: First copy the mingw.ini file to the folder where the MinGW setup program is, then execute the setup.
Folder: X:\msys\mingw (replace X: with a real drive letter)
Questions: Select Candidate, then select the Minimal install plus the g++ compiler.

Install SVN:
Details: Just unzip it to the folder below.
Folder: X:\msys\home\YourUser (replace with the name of your user there)

Install EnvSetup:
Folder: X:\msys\home\YourUser (same as before)

Okay, installations are complete, now let's setup the compilation environment.



Setup Compilation:

> Start MSYS : msys.bat

Run these commands, one by one:

Code: Select all

./build\ requirements.sh
  • This will build the required libraries (zlib, libpng, and copy dx9 files)

Code: Select all

./get\ latest\ openttd.sh
  • This will download the latest OpenTTD code from SVN. You can run it anytime later on, to always have the most up-to-date code from the net

Code: Select all

cd ../OpenTTD/trunk
  • Change to OpenTTD build directory

Code: Select all

./configure --with-png --with-directmusic
  • Configure compilation

Code: Select all

notepad Makefile.config
  • This will open the file that configures the compilation for manual edit, we will change a few lines.
    Edit the corresponding lines to look like this:

Code: Select all

INSTALL:=1
PREFIX:=home/OpenTTD
BINARY_DIR:=build
DATA_DIR:=build
ICON_DIR:=build
USE_HOMEDIR:=
PERSONAL_DIR:=/home/OpenTTD/build
SECOND_DATA_PATH:=data
CUSTOM_LANG_PATH:=lang
  • Save and close Notepad. We are ready to compile.

Compile:
Back on MSYS, execute:

Code: Select all

make && make install && make clean
  • and wait! :) When done, you'll have the new compiled files at OpenTTD\build, looking just like a nightly release !
From here on, it's with you. Mess with the code, see if it compiles, etc. Have fun 8)

Also, for applying patches, you may like to try TortoiseSVN. It also will let you administer the OpenTTD SVN folder through Windows Explorer.

NOTE: I did my best to test the correctness of these instructions, but it is quite possible something has evaded my sight, so if you face problems while following them, please post them here and I will try to correct the guide.
Attachments
mingw.ini.txt
Rename to mingw.ini
(1.31 KiB) Downloaded 1001 times
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

*reads name*
*rubs eyes*
*re-reads name*
*rubs eyes again*
*re-re-reads name*
Yep. It does indeed say LKRaider.

Welcome back.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Post by XeryusTC »

The MinGW documentation/installation guide said that it is better to install MinGW before MSys, of course you don't have to listen to this advice ;).
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image
User avatar
LKRaider
Transport Coordinator
Transport Coordinator
Posts: 360
Joined: 23 Mar 2005 04:05
Location: Brasil
Contact:

Post by LKRaider »

Thanks DaleStan : ) Yeah, I've been away for some time... heh


I prefer the MSYS then MinGW install method here, simply because there is no need to type the location of MinGW when installing MSYS, which makes it easier (for lazy people like me :P ). And since we are installing inside /mingw , we need no fstab entry for it anyways.
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Post by TrueBrain »

Please update the wiki about this topic. There is already a patch about how to compile on mingw, but I believe it is a bit outdated. Nice job btw ;)
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

Thanks! That's what I've been looking for since MSVC++ strangely crashes when loading langs.dsp...
User avatar
LKRaider
Transport Coordinator
Transport Coordinator
Posts: 360
Joined: 23 Mar 2005 04:05
Location: Brasil
Contact:

Post by LKRaider »

TrueLight: you mean, replace the whole instructions there or just update it a bit? Also, should it really include the EnvSetup I'm using here?

I think the wiki should stay more generic, simply because the EnvSetup will need to be updated manually for new versions of zlib and pnglib (and I'm also using the mingwPORT patches here, slightly edited for automation).

The only thing missing in the wiki, is about DirectX, though they are mentioned for Dev-C++. (note: here I use DX9c SDK files, not the ones mentioned at the Dev-C++ page).

I'll edit it a bit, see how you like it.
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

Horray! It works :bow: Thank you so much!
No more MSVC++, that's just great :)

MinGW is small and simple yet powerful tool, indeed
User avatar
LKRaider
Transport Coordinator
Transport Coordinator
Posts: 360
Joined: 23 Mar 2005 04:05
Location: Brasil
Contact:

Post by LKRaider »

Good to hear it works for you :D

I like the MinGW and MSYS tools too, yep simple and powerful. : )
User avatar
LKRaider
Transport Coordinator
Transport Coordinator
Posts: 360
Joined: 23 Mar 2005 04:05
Location: Brasil
Contact:

Post by LKRaider »

Double post, but... is there a place I can upload files to be attached on the wiki?

The wiki upload feature only allows pictures, and on the forums you need to rename the files, which only complicates the wiki instructions further.

Any ideas?
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

zip? rar? tar.gz? tar.bz2? Talk to SROTU™ about a users.tt-forums.net account?
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
habell
Transport Coordinator
Transport Coordinator
Posts: 374
Joined: 04 Mar 2004 12:47
Location: Veenendaal, The Netherlands

Post by habell »

I've a question. I've followed de installation guide to the letter but for some reasen it can't find svn when I start msys.

When I type: svn, it can't find it.
When I type: ./bin/svn it can.

So it seems to have something todo with path settings. But where can I find them?

Because:

Code: Select all

./configure --with-png --with-directmusic
doesn't work, when it can't find svn.

Please help.
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

Weird, SVN should be in your path. what does 'echo $PATH' say?

You can set your path to include svn by doing 'export PATH=$PATH;/bin'
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
User avatar
habell
Transport Coordinator
Transport Coordinator
Posts: 374
Joined: 04 Mar 2004 12:47
Location: Veenendaal, The Netherlands

Post by habell »

Darkvater wrote:Weird, SVN should be in your path. what does 'echo $PATH' say?

You can set your path to include svn by doing 'export PATH=$PATH;/bin'
Thanks, it works now :D
User avatar
orudge
Administrator
Administrator
Posts: 25138
Joined: 26 Jan 2001 20:18
Skype: orudge
Location: Banchory, UK
Contact:

Post by orudge »

DaleStan wrote:zip? rar? tar.gz? tar.bz2? Talk to SROTU™ about a users.tt-forums.net account?
Indeed, can you not stick it in a zip file and tell the user to unzip it? One would assume that if they're planning on building code, they can unzip a file. :)
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

LKRaider, could you please explain
make && make install && make clean?
I assume make compiles code, make install creates binary files in ../build/, and make clean removes some temp files, but I'm not very sure.
gigajum
Route Supervisor
Route Supervisor
Posts: 511
Joined: 08 Mar 2006 08:33
Location: Germany

Post by gigajum »

MeusH wrote:LKRaider, could you please explain
make && make install && make clean?
I assume make compiles code, make install creates binary files in ../build/, and make clean removes some temp files, but I'm not very sure.
make <- compiles all stuff
make install <- copies all generated and needed files to a folder, set by configure or a default dir
make clean <- removes all compiled things and cleans the dir as nothing had done with the files
User avatar
LKRaider
Transport Coordinator
Transport Coordinator
Posts: 360
Joined: 23 Mar 2005 04:05
Location: Brasil
Contact:

Post by LKRaider »

MeusH : yep, that's pretty much it.

I use the three steps so you have the compiled code in the build folder, and the source code separated and clean from temp files when you are done compiling.

Usually, if you do not setup the make install step, you have to manually copy the compiled stuff out of the source tree before performing a make clean, as it will delete the compiled files too.

All others : Ah yes! .zip! :P My mind fails to find obvious solutions like that sometimes, heh.
I was thinking of uploading to the wiki, but putting on the forums is ok too, I guess.
Attachments
msys_env.zip
Files used on the wiki
(888 Bytes) Downloaded 557 times
User avatar
PAStheLoD
Engineer
Engineer
Posts: 16
Joined: 13 Sep 2004 17:03
Skype: pasthelod
Location: Budapest, Hungary
Contact:

Post by PAStheLoD »

Hi!

This looks very-very..-very promising, however, because of my user name being two words separated by a space (it's 'Lord Pas') and that nasty space causes me a lot of trouble..

so is there a way, to force msys to use another directory as home dir?

Thanks in advance :)

edit:

hm, I've figured it out.. etc/profile -> just hardcode the LOGNAME, HOME USERNAME vars to a directory whose name doesn't contain space, and go on ;]
Last edited by PAStheLoD on 19 Apr 2006 16:57, edited 1 time in total.
OpenTTD > sex
Sacro
Tycoon
Tycoon
Posts: 1145
Joined: 18 Jun 2005 21:08
Location: Here
Contact:

Post by Sacro »

remove the space in the /home/what\ ever/ folder and then also change it under /etc/passwd , works for me under cygwin
We Am De Best

Host of ThroughTheTube site
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: Google [Bot], mrkastan and 26 guests