Freeciv
Advertisement

MSYS2 can be used as freeciv build/development environment on Windows.

Currently this document is accurate for autotools based builds only. For freeciv-2.6 and freeciv-3.0 that's the only build system available. Starting from freeciv-3.1, both autotools and meson based builds are possible. From freeciv-3.2, meson based build would be recommended one.

First time setup[]

- Download latest msys2 environment from https://files.freeciv.org/packages/windows/msys2/

- Extract the environment from the package to a suitable location. 7-zip from https://www.7-zip.org can be used for extracting.

- Start the msys2 shell by an .exe matching your target environment at environment root. For freeciv-2.6 and freeciv-3.0 that's either mingw32.exe (to produce win32 builds) or mingw64.exe (to produce win64 builds). For freeciv-3.1 and later, also ucrt64.exe is available, and is in fact the default (produces better results for Win10 and later, but those builds also require at least Win10).

  • If you selected ucrt64.exe, ${ARCH} in following examples is ucrt64
  • If you selected mingw32.exe, ${ARCH} is mingw32.
  • If you selected mingw64.exe, ${ARCH} is mingw64.

- Setup git directories. In the shell:

> mkdir freeciv
> cd freeciv
# Create root dirs for branch-specific directory hierarchies
> mkdir main
> mkdir S3_2
> mkdir S3_1
> mkdir S3_0
> # Clone freeciv repository under main/src
> cd main
> git clone https://github.com/freeciv/freeciv.git src
# Create worktrees for all the other branches
> cd src
> git worktree add ../S3_2/src S3_2
> git worktree add ../S3_1/src S3_1

- Create build directories.

# Do following for each of the branches (main, S3_2, S3_1)
# This example if for S3_1
> cd ~/freeciv/S3_1/src
> ./autogen.sh --no-configure-run
> cd ..
> mkdir builds
> cd builds
# Create configurations you want. This example creates
# simple gtk3.22-, Qt-, and sdl2-client configurations
> mkdir gtk3.22
> cd gtk3.22
> ../../src/configure --enable-debug --without-readline --disable-sys-lua --enable-client=gtk3.22
> cd ..
> mkdir qt
> cd qt
> ../../src/configure --enable-debug --without-readline --disable-sys-lua --enable-client=qt --with-qt6-includes=/${ARCH}/include --with-qt6-libs=/${ARCH}/lib
> cd ..
> mkdir sdl2
> cd sdl2
> ../../src/configure --enable-debug --without-readline --disable-sys-lua --enable-client=sdl2

Building and running freeciv[]

- Go to directory of the configuration you want to build. For example S3_1 gtk3.22-client configuration

> cd ~/freeciv/S3_1/builds/gtk3.22

- Run make to build freeciv

> make

- Run produced freeciv.

> ./fcgui

Updating sources to latest ones[]

- Go to source directory of the branch you want to update. For example S3_1:

> cd ~/freeciv/S3_1/src

- Pull the changes since your last update

> git pull

You are now ready to rebuild configurations of that branch from the updated sources.

Updating msys2 environment[]

If you want to keep your msys2 environment updated against upstream changes, you can do that with

> pacman -Syu

Notice however that such updates should not be made for environments used to build official freeciv installers, as the installers should be created in well-specified environments, not necessarily up-to-date (what ever that means at a given moment) environments.

Improving msys2 environment performance[]

Msys2 environment can be very slow to use. Msys2org tweeted: "Adding the MSYS2 directory to the defender exclusion list helps a lot."

Advertisement