Dwarf Fortress on Asahi on aarch64
A quick install guide.
Let’s start with assumptions, you’re running Fedora Asahi Remix maybe ALARM, and you want to play Dwarf Fortress (Premium). So let’s do something about it.
A quick caveat before we get into the guide. You’re going to need an x64 machine running some flavour of Linux, this is so you can download the Dwarf Fortress Premium executable. You will NOT need an x64 machine if you intend on running DF Classic as you can grab everything you need from the Bay 12 website. If you intend on running the Premium version then read on, if you’re rolling with Classic then skip to BOX64
Getting The Game Files
SteamCMD is going to let us download our purchased version of Dwarf Fortress Premium. You can also download Steam install the game and get your files that way, but, I used my headless home server and just ssh’d in from Asahi. I’ll briefly run you through how I used SteamCMD but YMMV, depending on your own setup at home. I installed SteamCMD through Docker as that saved any headaches around dependencies, I suggest you do the same. You can find install instructions from the SteamCMD site.
Bring up the Docker container with:
docker run -it --rm -v ${YOURDIR}:/data --name=steamcmd cm2network/steamcmd shell
Where ${YOURDIR}
is the directory you want to download the games files. Then, in the interactive terminal run:
./steamcmd.sh
force_install_dir /data
login ${YOURUSERNAME}
app_update 975370 validate
Once that is done you should have all the game files downloaded into the directory you specified earlier.
BOX64
BOX64 is going to allow us to run the x64 executable on our aarch64 machine. Nice. I will be more specific here to save you the time parsing the myriad of compile options:
git clone https://github.com/ptitSeb/box64
cd box64
mkdir build; cd build; cmake .. -D M1=1 -D CMAKE_BUILD_TYPE=RelWithDebInfo
make -j4
sudo make install
The compile docs say to run sudo systemctl restart systemd-binfmt
I didn’t and had no issues.
Dependencies & Desktop File
Before you “Strike the Earth!” you will need to install SDL2_image. It’s as easy as:
sudo dnf install SDL2_image SDL2_image-devel
You may have other unmet dependencies just do a google for the corresponding package and you’ll be fine.
Finally the last optional step is to whip up a .desktop file to nicely integrate Dwarf Fortress into our system. To start we need to create a super simple shell script. You can keep this anywhere but I keep it in my DF folder. This shell script is going to cd into our DF folder every time we run the game. This is important as we want BOX64 to load the libraries (.so) in the DF folder.
#!/bin/sh
cd ${YOURDIR}
box64 ./dwarfort
Of course ${YOURDIR}
being the directory you downloaded DF too, or where you moved the game files to. Save the script as whatever feels right in the moment, place it somewhere in your $PATH without an extension.
Make sure it’s executable too with:
chmod +x ${YOURSCRIPT}
Next the desktop file. The desktop file should be saved to ~/.local/share/applications/
.
[Desktop Entry]
Name=Dwarf Fortress
Comment=Dwarf Fortress Premium with box64
Exec=${YOURSCRIPTPATH}
Terminal=false
Type=Application
StartupWMClass=dwarfort
Categories=Game;
The Exec portion of the desktop file is what gets run when we launch Dwarf Fortress. Replace ${YOURSCRIPTPATH}
with the full path of the script we just wrote devoid of any tildes.
I run tofi under sway for my launcher so Dwarf Fortress shows up as soon as the desktop file has been written to disk, if you’re using KDE or another DE then you may need to “install” the desktop file if my hunch is correct.
Strike The Earth!
That should be it! Run via your launcher of choice or by using the script that should be in your path! If you have any questions feel free to reach out to harry「at」hryjksn「dot」com