Compile and Run Doom on Linux
Building very old software may become complicated if you get lost in a labyrinth of dependencies, but John Carmack's linuxdoom-1.10 builds smoothly with little change. It has almost no heavy dependencies, a minimal Makefile and uses X for graphics. In brief I built everything on a my laptop that runs a 64-bit Xubuntu 20.04.1 LTS, and the nouveau driver drives the NVIDIA GeForce 940MX graphics card.
Modify the Source and Compile Doom
First, a few things need to be changed in the source code so that the code compiles on 64-bit Linux. The changes are neatly captured in the pull request #9 and #2 on the Github repository. The issues list helpful commit titles describing the context of the changes. In the second PR, the relevant commit is the second one that fixes the X colormap problem. I needed this change, otherwise, the rendered image's color was completely wrong. The changes from the PR #9 is enough to compile without errors (ignoring warnings).
In the linuxdoom-1.10 directory (where the source resides), create a directory named linux as make expects one, and run
to build Doom.
Then you need the .wad files. The file must be named doom1.wad (lowercase) and put in the same directory as the linuxdoom executable for the game engine to pick it up. There seem to be parts 2 and 3 to the file, and some varieties too, but I am not yet familiar with the full WAD story, so here is the one that worked for me.
Xephyr: A 'Nested' X Server, Renders 8 BPP
Finally, because you can no longer start a modern X server in 8-bit 256-color mode (Pseudocolor), use Xephyr, which is an X server that outputs to a window on a pre-existing 'host' X display. To get going,
sudo apt install xserver-xephyr
and open a blank window with the configuration Doom needs (note, the command name has an uppercase X)
Xephyr :2 -ac -screen 640x480x8
On my system I use display #:2 because a VNC server is attached to display #:1.
In another shell instance run Doom (where the binary has been built; linuxdoom-1.10/linux/), preceding the invocation to set the DISPLAY variable;
and this starts up Doom, rendering the output in the Xephyr-window. However, on my system, the game is rendered in a small rectangle at the top left of the window to which I have not yet found a fix. Make sure the cursor (an X) inside the X window sits inside the game's rendered image for your keystrokes to be picked up. Everything else seem to works fine, though, I haven't heard any sounds.