Home
Personal tools
Namespaces
Variants
Actions

Compiling Win

From Naevwiki

Jump to: navigation, search

This is a short guide on how to setup a compiling environment on Windows, and using it to compile Naev. It also covers setting up a command line git client.

Setting up your compiling environment

Note: these instructions were successfully tested with version 20110211. However, you SHOULD be able to just get the latest version at the top of the page.
Note: The version of this git package is 1.7.0.2.msysgit.0. It contains ONLY git, and some vim-related files. These files were taken from msysgit.

You are done installing your compile environment! Now it is time to clone the git repo.

Post-installation tips

The following is optional, you don't need to do any of it. These steps may make life easier, though.

  • Remove the . at the start of the path. Including the current directory in the path is a Windows convention, but not a *nix one. Doing so COULD potentially create problems with *nix based apps.
  • Remove the "cd $HOME" command at the end of the file. This will allow you to invoke "sh --login" anywhere from a cmd prompt, and get a bash shell in the same directory (without ending up in your homedir instead).
  • Tell msys to run ~/.bashrc after HOME is set. .bashrc is to bash what autoexec.bat is to DOS. By convention, it is located in HOME, and while msys doesn't use it by default following the convention is a good idea. Note that .bashrc doesn't exist in your home directory yet, you will have to make it if you want to use it. Add the following lines to your profile:
if [ -e ~/.bashrc ]; then
    . ~/.bashrc
elif [ -e ~/.bash_profile ]; then
    . ~/.bash_profile
elif [ -e /etc/bash_profile ]; then
    . /etc/bash_profile
fi
  • Run the git-specific script in /etc. Doing so will show you what branch you are currently on at all times on the command prompt. Add the following lines to your profile:
. /etc/git-completion.bash
PS1='\[\033]0;$MSYSTEM:\w\007
\033[32m\]\u@\h \[\033[33m\w$(__git_ps1)\033[0m\]
$ '

Building

Step 1:

After you cloned the git repo, open a MSYS console (this comes down to running sh.exe, installed by the MinGW installer). Before trying to build, make sure you are in the folder of your git repo. For the obvious, you can use the following command:

cd <path-to-repo>

With the command "pwd" you can check if you are in the right folder. If you are, do the following.

export PKG_CONFIG_PATH="/mingw/lib/pkgconfig"

You need this for configure to be able to find all the required libs. Note that you will need to do this EVERY TIME you start a new sh session, as exports aren't saved! So, it can be helpful to have this command in your .bashrc (see the tips above), so you don't have to enter it manually every time.

Step 2:

First run:

./autogen.sh
Note: You should only need to do this once. And if you are using a source tarball and not using git, you do not need to run autogen.sh

Step 3:

When ready, just run:

./configure

Followed by

make

If everything went without any errors, the compiled executable should be automatically copied to your Naev directory. If you can't find it, however, it may be in the src subdirectory. If you haven't already done so, get the dll package (linked at the top of this page) and extract it into your Naev directory. You are now ready to play!

Tip: If you have a multi-core CPU, you may tell make to use multiple jobs at the same time by specifying the -jn parameter, where n is the number of jobs you wish to use.