Porting Barony to Haiku

Barony is having a free weekend on [Steam}(http://store.steampowered.com/app/371970/) as of the time of posting this. Seems like a good opportunity to try and get it working on Haiku.

GitHub repo:

After installing the necessary build deps*, configuration fails with this:

Could NOT find SDL2_ttf (missing: SDL2_TTF_INCLUDE_DIRS)

This is odd, since sdl2_ttf_devel was already installed prior to configuring.
If anyone can help with this, then it would be much appreciated.

*There is no libz package in HaikuDepot, although it is for libpng to use it and that’s available. Hopefully this won’t cause issues later on.

On a related note, I did also also make a preliminary recipe for the game which HaikuPorter refuses to parse:

Attempting to run HaikuPorter on that results in:

Checking if any dependency-infos need to be updated ...
Looking for stale dependency-infos ...
/boot/home/haikuports/games-action/barony/work-3.3.5~git/port.recipe: line 13: Wheel: command not found
Error: Can't evaluate config file: /boot/home/haikuports/games-action/barony/work-3.3.5~git/port.recipe

This is also odd, as I’ve seen this with the VVVVVV recipe that I made too yet that one still works regardless.

Addendum: Here is the CMake output log, if it’ll help.

1 Like

For start, missing closing double quote at the end of line https://github.com/win8linux/haikuports/blob/barony/games-action/barony/barony-3.3.5~git.recipe#L10

For SDL: You can either pass the include and lib folder to cmake or adjust the cmake modules and add SDL/SDL2 respectively to the include file search paths.
I got it built, but i don’t have the gamedata to test it.

There is a package for it, add “lib:libz$secondaryArchSuffix” and “devel:libz$secondaryArchSuffix” for it:
https://github.com/haikuports/haikuports/blob/master/sys-libs/zlib/zlib-1.2.11.recipe

1 Like

So add SDL to this line https://github.com/TurningWheel/Barony/blob/master/cmake/Modules/FindSDL_ttf.cmake#L21
Also for other *SDL cmake modules.
and SDL2 to the SDL2 ones.

May I ask what parameters did you use for CMake? I’m using these:

-DSDL2_INCLUDE_DIR=/boot/system/develop/headers/SDL2 -DSDL2_TTF_INCLUDE_DIR=/boot/system/develop/headers/SDL2 -DSDL2_NET_INCLUDE_DIR=/boot/system/develop/headers/SDL2 -DSDL2_IMAGE_INCLUDE_DIR=/boot/system/develop/headers/SDL2

However, building fails with this:

/boot/home/Barony/src/game.cpp:46:10: fatal error: execinfo.h: No such file or directory
 #include <execinfo.h>
          ^~~~~~~~~~~~
compilation terminated.

Added libexecinfo in the recipe?

Thanks, libexecinfo is oddly not in the dep list within the docs for the engine. The engine currently fails at the linking step here with this:

/boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/8.3.0/../../../../x86_64-unknown-haiku/bin/ld: CMakeFiles/barony.dir/src/game.cpp.o: in function `segfault_sigaction(int, __siginfo_t*, void*)':
game.cpp:(.text+0x44): undefined reference to `backtrace'
/boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/8.3.0/../../../../x86_64-unknown-haiku/bin/ld: game.cpp:(.text+0x68): undefined reference to `backtrace_symbols_fd'
collect2: error: ld returned 1 exit status

Research -DCMAKE_EXE_LINKER_FLAGS

Please dont do this in the recipe, this isnt secondary arch safe.

Not a lot of official info about it:
https://cmake.org/cmake/help/latest/variable/CMAKE_EXE_LINKER_FLAGS.html

It seems to be largely undocumented?

Use the search-in-repo function at haikuports.

From what I could find in HaikuPorts, this seemed to be the most likely flag to work:

-DCMAKE_EXE_LINKER_FLAGS="-lgnu"

Unfortunately, that wasn’t the case.

Then try with -lexecinfo instead of -lgnu, but you should first clean up the artifacts generated by the earlier runs. So start with clean work folder.

You should also read some cmake docs, not just blindly doing things.

Those aren’t of much help, as the CMake docs barely have anything to say about it.

But thanks anyways, it linked successfully. I will try it with the assets soon and see how it goes.

It works with some caveats:
barony_haiku

Caveats so far:

  • No sound, although I couldn’t get this to work in Linux either yet.
  • Using objects does not work.
  • Slow, but that’s somewhat expected considering that this is entirely rendered in software. The menu scene though seems to be running smoothly, though.
  • Moving the camera is like if the character is drunk, unsure whether this is with the game, Haiku itself, or the fact that this is from inside a VM. Might test on real hardware later on just in case.

The editor meanwhile seems to work just fine:
barony_editor_haiku

I’ll work on the recipe a bit more later and a fork of the code with Haiku-specific additions to base it upon.

Edit: Still haven’t figured out how to let the user place the assets for the game, as they normally go into the same folder as the binaries and are split across different folders instead of being in a single data directory. Unlike VVVVVV the assets aren’t freely redistributable, so making a data package for that is entirely out of the question.

2 Likes

You can ask the author for special license.

Unfortunately, Turning Wheel has mentioned in an email reply to an inquiry that this is not possible.