Wikia

Freeciv

Install-Windows

Talk12
613pages on
this wiki

The quickest and easiest way to install Freeciv is simply to download a Windows installer file. This ensures that you have a working game and a minimum of difficulty getting started.

If you're interested in testing the next version of Freeciv and are willing to work through the occasional technical difficulty, you might want to consider installing the development version.

Windows InstallerEdit

The latest official version of Freeciv can be found on the Freeciv home page or on SourceForge.

Differences between Win32 Native and GTK2 versions

To play on old (1.14.x) servers, you can still download the last version of the 1.0-series client:

  • freeciv-1.14.2-win32.zip (for Windows 95 and later)
  • Install the game by unzipping the files into a suitable directory, such as C:\Program Files\Freeciv

Please notice that some virus checkers incorrectly tell you a "Trojan" is included with the Freeciv distribution.

Other LanguagesEdit

If you installed a recent version of Freeciv (2.0 or later), you can run the game in a different language than your default system language.

Create a batch file (for example, named freeciv.cmd) in the same directory as where you installed the package. It only needs to contain these two lines:

set LANG=EN
set LANGUAGE=EN
freeciv-gtk2.exe

Substitute "EN" with the two-letter code for your desired language, and run this batch file instead of freeciv-gtk2.exe. If you use the shortcuts created by the Windows installer, don't forget to change the "target" field of each shortcut to point to this batch file instead of to freeciv-gtk2.exe.

Compile From SourceEdit

If you choose to compile Freeciv from source, you likely fit one or more descriptions:

  • You want to play and test the latest version of the game
  • You want to contribute to Freeciv development
  • You're curious
  • You like to run with scissors

When compiling Freeciv from source, remember this Free Software/Open Source axiom: "If it breaks, you get to keep both pieces." The humor needed to understand that saying will serve you well if you encounter difficulties.

Tip: While we have taken care to explain the process as clearly as possible, you may still run into problems when compiling Freeciv from source. Use IRC to join #freeciv-dev on irc.freenode.org to talk to someone if you run into problems.

Install the Development EnvironmentEdit

If your goal is simply to play the latest version of Freeciv, compiling from source is typically a one-time operation. However, the extra work necessary to configure the development environment will reward you with the very latest version of Freeciv - along with all the newest features and potential bugs which that implies.

MinGW, Cygwin, MSYS, and their supporting files are rather large. Patience and/or a fast connection is required.

The Compiler and Libraries (MinGW)Edit

MinGW (Minimal GNU for Windows) hosts the basic tools necessary to compile Freeciv from source: an ANSI C compiler and the code libraries that Freeciv depends on.

If you're interested in learning more about MinGW in more detail, the MinGW Getting Started  page is an excellent source. Otherwise, simply following the instructions below should result in the environment you need to compile Freeciv from source.

Freeciv can use one of two clients under Windows: the GTK client, and the Windows native (GDI) client. The GTK client is the primary client supported on Windows and is actively developed. It has more advanced features and is better maintained than the Windows native client.

1
=====For Either Client=====
  1. Install the latest MinGW (currently MinGW-5.1.4.exe). This is where you will install the packages that Freeciv needs to compile, referred to as the "MinGW root directory".
    • On the "Choose Package" step, select "Current"
    • On the "Choose Components" step, check only the box next to "MinGW base tools"
      Tip: You will make things much easier on yourself if you avoid spaces in the directory names that you choose for MinGW and other tools. We recommend accepting the MinGW installer's default directory name (C:\MinGW), or using a similar convention (C:\gnuwin32, C:\Devel\MinGW).
  2. Download the latest version of following package from the GTK+ for Windows page:
    • GNU libiconv (Binaries & Dev)
  3. Unzip and extract the files to the MinGW root directory.
    Tip: You can install these packages (and the others mentioned in this how-to) in any order.
2 (a)
For the GTK ClientEdit
  1. Download the latest version of these libraries from the GTK+ for Windows page. You can download them individually, but the easiest way to obtain them all at once is via the all-in-one bundle of the GTK+ stack. Note that this link may not point to the most recent bundle; check the GTK+ for Windows page for the latest version.
    • atk, atk-dev
    • cairo, cairo-dev
    • gettext-runtime, gettext-runtime-dev
    • glib2, glib2-dev
    • GTK2+, GTK2+-dev
    • libpng, libpng-dev
    • pango, pango-dev
    • pkg-config
    • zlib, zlib-dev
  2. Unzip and extract all files to the MinGW root directory.
2 (b)
For the Windows native (GDI) ClientEdit
  1. Download the latest version of these libraries from the GTK+ for Windows page. Alternately, if you don't mind some bloat, you could just grab the all-in-one bundle of the GTK+ stack. Note that this link may not point to the most recent bundle; check the GTK+ for Windows page for the latest version.
    • gettext-runtime, gettext-runtime-dev
    • libpng, libpng-dev
    • zlib, zlib-dev
  2. Unzip and extract all files to the MinGW root directory.

The Shell and Supporting ToolsEdit

We strongly recommend installing the Cygwin environment. It offers the option to install a wide array of tools including Subversion, which is used to check out the Freeciv source. You will probably find it much simpler to do regular checkouts and compiles in the same environment, rather than using a combination of Windows programs and command-line tools.

Developers will most likely be interested to find that the Cygwin installer is actually a package manager. This enables you to install familiar tools like Subversion, Emacs, or even the X Window System - all with automatic dependency resolution.

Even if you are not a developer,

If you want to keep pace with Freeciv development or modify the code, then you would most likely be interested in the additional tools in the Cygwin environment.

Tip: You really only need to install one of either Cygwin or MYS, not both. Installing both won't do any harm, but you'll spend more time downloading and installing than necessary.

3 (a)
CygwinEdit

Cygwin is a Linux-like environment for Windows. These instructions focus on installing only the "extras" necessary to integrate with MinGW and compile Freeciv source. For more information on the wide range of command-line and graphical tools that Cygwin offers, refer to the Cygwin FAQ and Cygwin package list.

  1. Download the Cygwin net installer and launch it to start installation.
    Tip: It's best if you place Cygwin in the same parent directory as where you installed MinGW. For MinGW in C:\MinGW, install Cygwin to C:\cygwin. If you installed MinGW into a subdirectory (for example, C:\Devel\MinGW), use the same subdirectory for Cygwin (C:\Devel\cygwin).
    • On the "Select Packages" step, select the following packages:
      • automake1.9 (in the "Devel" section)
      • gettext-devel (in the "Devel" section)
      • make (in the "Devel" section)
      • subversion (in the "Devel" section)
      • Optional:
        • rxvt (in the "Shells" section)
          Tip: You will have a much better experience with Cygwin using rxvt as your shell than if you keep the Cygwin default.
        • vim or emacs (in the "Editors" section)
    • Note that other packages (such as autoconf) will be automatically selected to satisfy dependencies
  2. With WordPad (in the Windows Start menu, under Accessories), edit the file profile in the etc directory, contained in the Cygwin root directory.
    • Go to the line starting with PATH=.
    • Insert the full path to your MinGW bin directory at the start of the existing Cygwin path. Use the following example as a guide. (Note the way "/" and ":" are used, and how Windows drive letter x: is replaced with /cygdrive/x.)
    • Example: For MinGW in C:\MinGW, the edited PATH= line should look something like:
      PATH=/cygdrive/c/MinGW/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:$PATH
      
  3. If you installed rxvt, go to the Cygwin root directory. Edit the file called cygwin.bat. Replace its contents with the following lines:
    @echo off
    cd /d c:\Devel\cygwin\bin
    rxvt -tn xterm -rv -sr -sl 2500 -e /bin/bash --login -i
    
    • To understand what the above rxvt options do - as well as to find other useful options - refer to the rxvt man page (man rxvt).
3 (b)
MSYSEdit

MSYS (Minimal SYStem) is designed to be a minimal environment for MinGW, adding a command-line shell and some automatic configuration developer tools that the autogen.sh script uses.

Note: If you choose to use MSYS instead of Cygwin, you will also need to install a separate Subversion client such as TortoiseSVN.

  1. Install the latest MSYS (currently MSYS-1.0.11-2004.04.30-1.exe). This provides an interactive shell.
    Tip: It's best if you place MSYS in the same parent directory as where you installed MinGW. For MinGW in C:\MinGW, install MSYS to C:\msys. If you installed MinGW into a subdirectory (for example, C:\Devel\MinGW), use the same subdirectory for MSYS (C:\Devel\msys).
    • When asked by the MSYS installer if you would like to normalize your MinGW installation, reply "yes". This will integrate MinGW with the MSYS environment. (For details see the section "Working with MinGW" in README.rtf, installed by MSYS in its doc directory.)
  2. Install the latest MSYS Developer Tool Kit (currently msysDTK-1.0.1.exe). These are the basic compiler support packages that you will need for Freeciv development.
    • Install msysDTK in exactly the same directory as where you installed MSYS. For example, C:\msys or C:\Devel\msys.

Download the SourceEdit

4 (a)

Stable VersionEdit

To compile the stable version of Freeciv, download the source tarball (currently freeciv-2.4.3.zip). The latest official version of the source can be found on the Freeciv home page or on SourceForge.

Unzip this file within your home directory in your development environment. Your home directory is contained in home, which is in turn within the Cygwin or MSYS root.

Tip: If you installed Cygwin, downloading a stable version of Freeciv is no different than checking out the development version. See the next step for the best way to download the source under Cygwin.

Development VersionEdit

These instructions focus on checking out a version of the Freeciv source. Refer to How to Contribute for general developer information, including more things you can do with Subversion.

4 (b)
Using CygwinEdit

Launch the shell by either double-clicking the Cygwin icon on the desktop or selecting it from the Windows Start menu.

To check out the latest Freeciv source, type:

svn co svn://svn.gna.org/svn/freeciv/trunk freeciv

To check out an older stable version of the Freeciv source (for example, Freeciv 2.1), type:

svn co svn://svn.gna.org/svn/freeciv/branches/S2_1/ freeciv-2.1
4 (c)
If You Installed MSYSEdit

Install TortoiseSVN. Once installed, configure TortoiseSVN to use Unix line endings.

Be sure to check out the source to a directory contained within your home directory in your development environment. Your home directory is contained in home, which is in turn within the Cygwin or MSYS root.

To check out the latest Freeciv source, use this address:

svn://svn.gna.org/svn/freeciv/trunk

To check out an older stable version of the Freeciv source (for example, Freeciv 2.1), use this address:

svn://svn.gna.org/svn/freeciv/branches/S2_1/

Configure the BuildEdit

If you haven't already, launch the shell by either double-clicking the appropriate icon on the desktop or selecting it from the Windows Start menu.

Change the directory to the one containing the Freeciv source (where you unzipped or checked out the source in Download the Source).

5 (a)

Using CygwinEdit

To configure the build for the native Windows client, type:

./autogen.sh --enable-client=win32 --with-libiconv-prefix=/usr --host=mingw32 CPPFLAGS=-mno-cygwin

To configure the build for the GTK client, type:

./autogen.sh --enable-client=gtk-2.0 --with-libiconv-prefix=/usr --host=mingw32 CPPFLAGS=-mno-cygwin
5 (b)

Using MSYSEdit

To configure the build for the native Windows client, type:

./autogen.sh --enable-client=win32 --with-libiconv-prefix=/usr

To configure the build for the GTK client, type:

./autogen.sh --enable-client=gtk-2.0 --with-libiconv-prefix=/usr
6

The configure process will start, printing out something like the following:

+ checking for autoconf >= 2.55 ... found 2.59, ok.
+ checking for automake >= 1.6 ... found 1.9.6, ok.
+ checking for xgettext >= 0.10.36 ... found 0.14.5, ok.
+ checking for msgfmt >= 0.10.36 ... found 0.14.5, ok.
+ creating acinclude.m4
+ running aclocal ...
+ running autoheader ...
+ running autoconf ...

...

This will be followed by a long series of checks for various header files and functions:

...

checking whether we are using the GNU C++ compiler... no
checking whether CC accepts -g... no
checking dependency style of CC... none
checking whether ln -s works... yes
checking for mingw32-ranlib... no
checking for ranlib... ranlib
checking for mingw32-ar... no
checking for ar... ar
checking for uname... uname
checking for iconv... yes

...

If the build configuration terminates normally, you should see something like the following:

...

config.status: creating civ
config.status: creating ser
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing default-1 commands
config.status: creating po/POTFILES
config.status: creating po/Makefile
config.status: executing fc_default-1 commands
extending po/Makefile
config.status: executing fc_default-2 commands
silencing po/Makefile
config.status: executing fc_default-4 commands
modifying po/Makefile add-comments/escape
config.status: executing fc_default-5 commands
config.status: executing default commands
7

Compile the CodeEdit

If the build configuration terminated normally, you can now type make and sit back while the code compiles.

Tip: If the compiling fails, especially if you encounter an error when make comes to the intl directory, see the section below titled If Things Go Wrong With Compiling.

8

Install the FilesEdit

Type make install and/or copy over DLLs as needed.

TODO: This section needs documentation love.

9

Server with Authentication SupportEdit

If you are interested in compiling the Windows server with authentication support, you may want to see the article dedicated to that topic.

If Things Go Wrong With CompilingEdit

Not everything in life goes quite as well as we'd like, and compiling the Freeciv code is one of them.

  • If you encounter an error when configure comes to checking the presence of gtk.h (see config.log), try
pkg-config --cflags gtk+-2.0

It should print out something like

-mms-bitfields -Ic:/mingw/include/gtk-2.0 -Ic:/mingw/lib/gtk-2.0/include -Ic:/mingw/include/atk-1.0 -Ic:/mingw/include/cairo -Ic:/mingw/include/pango-1.0 -Ic:/devel/target/stable/include/cairo -Ic:/mingw/include/glib-2.0 -Ic:/mingw/lib/glib-2.0/include

If it does not, try fixing your PKG_CONFIG_PATH env variable like this

export PKG_CONFIG_PATH=/c/mingw/lib/pkgconfig

Also, you might want to change those .pc files in /c/mingw/lib/pkgconfig to reflect your path-prefix

prefix=/c/MinGW
  • This error when configure comes to checking the presence of zlib is due to an older version of zlib somewhere in your PATH (e.g. I had 1 with the Ruby distribution):
checking for gzgets in -lz... no
configure: error: Could not find zlib library
  • If, during config, you get the following error:
 checking for C compiler default output file name... configure: error: C compiler cannot 
 create executables
 See `config.log' for more details.
 configure failed

try to run autogen.sh qithout the CPPFLAGS, like this

 ./autogen.sh --enable-client=gtk-2.0 --with-libiconv-prefix=/usr --host=mingw32

Running the Compiled VersionEdit

You might have noticed that the client program will not run from the directory you compiled in because it is not finding the data directory. I managed to run ./client/freeciv-gtk2, but not ./civ which is supposed to work.

Usually GNU/Unix programs can be installed by typing make install Which will install them such that they can be started from a MinGW shell, probably in $MINGW/ local/bin directory.

TODO: This section needs documentation love.

For me, this didn't work either because the shared libraries/DLLs where not found. You can either fix this by placing the DLLs in the appropriate windows/system folder by hand, or by packaging them with Freeciv in some folder where you installed to. In this case, a working Freeciv install that can be started by typing

./freeciv-gtk2

The freeciv directory in the MinGW shell looks like this (this isn't perfect, but I hope it helps):

freeciv-2.0.1/:
total 6800
-rw-r--r--    1 mcfred unknown      2217 May 13 00:39 CIVCLIENT.RPT
-rwxr-xr-x    1 mcfred unknown   5769464 May 11 22:11 civclient.exe
-rwxr-xr-x    1 mcfred unknown   1203712 May 11 23:02 civmanual.exe
-rwxr-xr-x    1 mcfred unknown   5751863 May 11 22:11 civserver.exe
drwxr-xr-x   14 mcfred unknown         0 May 11 23:05 data
-rwxr-xr-x    1 mcfred unknown    916849 Jan 31  2003 libiconv-2.dll
-rwxr-xr-x    1 mcfred unknown    203264 Dec  4 01:09 libpng13.dll
drwxr-xr-x    3 mcfred unknown         0 May 11 23:06 share
-rwxr-xr-x    1 mcfred unknown     74752 Jan  2 13:31 zlib1.dll
freeciv-2.0.1/data:
total 40
drwxr-xr-x    2 mcfred unknown         0 May 11 22:09 civ1
-rw-r--r--    1 mcfred unknown       249 May 11 22:10 civ1.serv
drwxr-xr-x    2 mcfred unknown         0 May 11 22:09 civ2
-rw-r--r--    1 mcfred unknown       218 May 11 22:10 civ2.serv
drwxr-xr-x    2 mcfred unknown         0 May 11 22:09 default
drwxr-xr-x    2 mcfred unknown         0 May 11 22:07 flags
-rw-r--r--    1 mcfred unknown     64491 May 11 22:10 helpdata.txt
drwxr-xr-x    2 mcfred unknown         0 May 11 22:10 history
-rw-r--r--    1 mcfred unknown       116 May 11 22:10 history.serv
drwxr-xr-x    2 mcfred unknown         0 May 11 22:09 isophex
-rw-r--r--    1 mcfred unknown      3126 May 11 22:10 isophex.tilespec
drwxr-xr-x    2 mcfred unknown         0 May 11 22:09 isotrident
-rw-r--r--    1 mcfred unknown      2851 May 11 22:10 isotrident.tilespec
drwxr-xr-x    2 mcfred unknown         0 May 11 22:07 misc
drwxr-xr-x    2 mcfred unknown         0 May 11 22:09 nation
drwxr-xr-x    2 mcfred unknown         0 May 11 22:09 scenario
drwxr-xr-x    2 mcfred unknown         0 May 11 22:09 trident
-rw-r--r--    1 mcfred unknown      2993 May 11 22:10 trident.tilespec
-rw-r--r--    1 mcfred unknown      3019 May 11 22:10 trident_shields.tilespec
freeciv-2.0.1/data/civ1:
total 66
freeciv-2.0.1/data/civ2:
total 73
freeciv-2.0.1/data/default:
total 87
freeciv-2.0.1/data/flags:
total 100
freeciv-2.0.1/data/history:
total 76
freeciv-2.0.1/data/isophex:
total 57
freeciv-2.0.1/data/isotrident:
total 53
freeciv-2.0.1/data/misc:
total 63
freeciv-2.0.1/data/nation:
total 92
freeciv-2.0.1/data/scenario:
total 84
freeciv-2.0.1/data/trident:
total 46
freeciv-2.0.1/share:
total 0
freeciv-2.0.1/share/locale:
total 2
drwxr-xr-x    3 mcfred unknown         0 May 11 23:08 en_GB
-rw-r--r--    1 mcfred unknown      2641 May 11 22:10 locale.alias

Package FreecivEdit

Setting up the development environmentEdit

$ hg qpush -a

Building Freeciv 2.3.0-beta3Edit

(in this HOWTO it ends up in X:\projects\freeciv\src)
$ cd /x/projects/freeciv/src/freeciv-2.3.0-beta3
$ mkdir build-gtk2
$ mkdir build-sdl
$ cd build-gtk2
$ ../configure --prefix=/mingw --enable-client=gtk-2.0
$ make
$ make DESTDIR=/x/tmp/fc-gtk install
$ cd ../build-sdl
$ ../configure --prefix=/mingw --enable-client=sdl
$ make
$ make DESTDIR=/x/tmp/fc-sdl install
$ strip /x/tmp/fc-gtk/mingw/bin/freeciv-manual.exe
$ strip /x/tmp/fc-sdl/mingw/bin/freeciv-manual.exe


Creating Windows installer package for GTK+ clientEdit

  • download and extract distribution base archive of the previous Freeciv release
(http://download.gna.org/freeciv/packages/windows/installer-scripts/Freeciv-2.2.4-gtk2.7z)
(in this HOWTO it ends up in X:\projects\freeciv\nsis)
  • rename the extracted directory from Freeciv-2.2.4-gtk2 to Freeciv-2.3.0-beta3-gtk2
  • delete Freeciv-2.2.4-gtk2.nsi
  • rename create-freeciv-2.2.4-gtk2-nsi.sh to create-freeciv-2.3.0-beta3-gtk2-nsi.sh
  • open create-freeciv-2.3.0-beta3-gtk2-nsi.sh in an editor and replace "!define VERSION 2.2.4" with "!define VERSION 2.3.0-beta3"
  • delete freeciv\data\*
  • delete freeciv\doc
  • delete freeciv\civmanual.exe (renamed in 2.3)
  • copy doc directory, ABOUT-NLS, AUTHORS, ChangeLog, COPYING, INSTALL, NEWS and README from freeciv source directory
  • delete all Makefile.am and Makefile.in files in freeciv\doc
  • move all files from X:\tmp\fc-gtk\mingw\bin directory into freeciv directory
  • move all files and subdirectories from X:\tmp\fc-gtk\mingw\share\freeciv directory into freeciv\data directory
  • move X:\tmp\fc-gtk\mingw\share\locale into freeciv\share direcory
  • delete X:\tmp\fc-gtk directory
$ cd /x/projects/freeciv/nsis/Freeciv-2.3.0-beta3-gtk2
$ ./create-freeciv-2.3.0-beta3-gtk2-nsi.sh freeciv > Freeciv-2.3.0-beta3-gtk2.nsi
  • right click on Freeciv-2.3.0-beta3-gtk2.nsi and click on "Compile NSIS script"
-> installer package created in Output direcory


Creating Windows installer package for SDL clientEdit

(basically the same as for GTK+ client until next paragraph)

  • download and extract distribution base archive of the previous Freeciv release
(http://download.gna.org/freeciv/packages/windows/installer-scripts/Freeciv-2.2.4-sdl.7z)
(in this HOWTO it ends up in X:\projects\freeciv\nsis)
  • rename the extracted directory from Freeciv-2.2.4-sdl to Freeciv-2.3.0-beta3-sdl
  • delete Freeciv-2.2.4-sdl.nsi
  • rename create-freeciv-2.2.4-sdl-nsi.sh to create-freeciv-2.3.0-beta3-sdl-nsi.sh
  • open create-freeciv-2.3.0-beta3-sdl-nsi.sh in an editor and replace "!define VERSION 2.2.4" with "!define VERSION 2.3.0-beta3"
  • delete freeciv\data\*
  • delete freeciv\doc
  • delete freeciv\civmanual.exe (renamed in 2.3)
  • copy doc directory, ABOUT-NLS, AUTHORS, ChangeLog, COPYING, INSTALL, NEWS and README from freeciv source directory
  • delete all Makefile.am and Makefile.in files in freeciv\doc
  • move all files from X:\tmp\fc-sdl\mingw\bin directory into freeciv directory
  • move all files and subdirectories from X:\tmp\fc-sdl\mingw\share\freeciv directory into freeciv\data directory
  • move X:\tmp\fc-sdl\mingw\share\locale into freeciv\share direcory
  • delete X:\tmp\fc-sdl directory
$ cd /x/projects/freeciv/nsis/Freeciv-2.3.0-beta3-sdl
$ ./create-freeciv-2.3.0-beta3-sdl-nsi.sh freeciv > Freeciv-2.3.0-beta3-sdl.nsi
  • right click on Freeciv-2.3.0-beta3-sdl.nsi and click on "Compile NSIS script"
-> installer package created in Output direcory

TODOEdit

  • Rewrite "Running the Compiled Version"
  • Write "Package Freeciv"

Around Wikia's network

Random Wiki