Trying to port compilation of a game to nix

Just for the sake of learning (and because I want to play that game) I’m trying to build a game called “Goblin Camp”.

I forked the repository and created a default nix on a branch, loosely based on another branch that already switched buildsystem from b2/boost-build to cmake.

The cmake version is known to be able to build on a debian wheezy, which seems to be EOL since May '18.

According to my recherches, that debian version ran on GCC 4.7 (oldest available in nix is 4.8) and Boost 1.49 (oldest available in nix is 1.55).

Of SDL and SDL_image I know that 1.2-ish versions are required (which are available in nix, assuming that they won’t be as much of a problem as boost usually is).

Also zlib and libpng are known dependencies, but of them I do not know any version constraints.

I tried the following overlay to get the correct boost version:

  overlay = self: super:
    {
      boost149 = super.callPackage <nixpkgs/pkgs/development/libraries/boost/generic.nix> {
        stdenv = self.overrideCC super.stdenv super.gcc48;
        version = "1.49.0";

        src = builtins.fetchurl {
          url = "http://sourceforge.net/projects/boost/files/boost/1.49.0/boost_1_49_0.tar.bz2";
          sha256 = "0g0d33942rm073jgqqvj3znm3rk45b2y2lplfjpyg9q7amzqlx6x";
        };
      };
    };

Sadly building this boost149 fails, but in a log spanning ~23k lines I can’t really find any hints about what the problems are.

So can perhaps someone help me to recreate a wheezy compatible environment to build that game?

Perhaps after that I will be able to update dependencies one by one to get the program building on a modern system.

FYI boost 1.49 was in nixpkgs and can be found here. For older versions going back in the history can be quite helpful.
I didn’t take a closer look, so this might be broken too :​P

1 Like

Thanks!

Will check tonight if this helps me somehow.

Can I “safely” pin that branch via niv or will a modern nix choke on it?

My first instinct says that probably everything there is about the correct age.

Okay, using the old nixos-13.10 channel seems in fact to compile, and I do see a different set of errors now. It does not complain about missing symbols from boost anymore which I consider progress :smiley:

Instead linking failed because some missing refs to functions which seem to be defined in vendored code, which isn’t considered by the CMakeLists.txt, I’m wondering how this worked for the creator of that file…

I will continue to dig into the issue and report back here.

NB: I’m also setting up a wheezi container via systemd-nspawn to be able to compare versions and flow, as wheezie is “known to build” according to the creator of the CMake instructions.


edit:

As my computer is currently very slow, a new build with the vendored files compiled and linked as well suceeded!

Lets continue with installPhase!

1 Like

Just for the sake of learning (and because I want to play that game) I’m trying to build a game called “Goblin Camp”.

I forked the repository and created a default nix on a branch, loosely based on another branch that already switched buildsystem from b2/boost-build to cmake.

Maybe you will get some value out of looking at all the forks of goblin-camp, both on Github and Gitlab. Some of them seem to be buildable on more recent systems…

1 Like