Waitman Gobble

2020-10-30 12:36 am

godot 3.2.3 on FreeBSD 12.2 with Joystick Support, exporting FreeBSD template

I updated the FreeBSD port for godot. USB Joystick will now work on FreeBSD. It's handy to have Joystick support on FreeBSD because my 2 year old can't really yet deal with the keyboard for a game. She kinda gets it, but joystick is much easier for her to manage. Especially if you map "all" the buttons and axis controllers to do "right / left" etc. So she can press whatever is easiest to interact with the game.

  • update to version 3.2.3
  • remove openssl dependency / config
  • added UDEV Joystick make option and patches

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=250730

Note: if you haven't previously used a USB joystick with FreeBSD you will want to install webcamd, and add your regular user to the webcamd group. When you insert the device webcamd will take it. You can access the joystick in your program using either libuvdev-devd or libevdev. SDL2 and Godot have built-in support for Joystick, so you don't have to get involved with the device-level programming. However, the Firefox port for FreeBSD has gamepad code disabled. That's a project I will soon look at tackling, because having the joystick for HTML5 games would be a good feature.

Creating a Godot Export Template for FreeBSD and version 3.2.3

Godot will look for the "Linux" template files. So we need to stick with that naming convention regardless that we are running on FreeBSD. If you select "download" option in the godot export menu, it will load the Linux binary, which will not run on FreeBSD even with Linux support installed. However, we can use the FreeBSD binary for the template. This will create an executable game file that runs on FreeBSD systems. If you actually want to create a Linux binary godot developers recommend installing an old version of Ubuntu and generating the binary file, because if you use a current version like 20, then the binary will not run on any version prior. But if you build on an older version of Ubuntu, the binary will run on the latest version.

Here are the steps to create the template for FreeBSD and godot version 3.2.3.stable:

% mkdir -p $HOME/.local/share/godot/templates/3.2.3.stable
% cd $HOME/.local/share/godot/templates/3.2.3.stable
% cp /usr/local/bin/godot linux_x11_64_release
% echo "3.2.3.stable" > version.txt

Note that this will give you "only" the 64 bit release binary option. If you want a debug version and/or 32 bit binaries you will have to build those. The easy way is to checkout the port, "make" the port, then switch to the work directory and run scons with bits=32 and target=release_debug. For example,

% svn co https://svn.FreeBSD.org/ports/head/devel/godot
% cd godot
% make
% cd work/godot-3.2.3-stable/
% scons platform=x11 use_llvm=yes udev=yes target=release_debug tools=no bits=32

Note: udev=yes will only work with the patched version, until the updated port is committed

Also the godot docs recommend using "use_lld=yes" for clang builds, however on FreeBSD 12.2, the ld linker command is now lld, so it's not necessary to specify. In previous versions of FreeBSD the ld command was GNU ld despite having clang in base.

% ld -version
LLD 10.0.1 (FreeBSD llvmorg-10.0.1-0-gef32c611aa2-1200012) (compatible with GNU linkers)
Copyright 2020 Waitman Gobble. Contact