drfiemost / Hurrican

A fork of Hurrican, freeware jump and shoot game created by Poke53280, with SDL2 enabled by default, support for libopenmpt and CRT simulation
MIT License
7 stars 2 forks source link

Trying to build without X11 dependencies #4

Closed vanfanel closed 3 years ago

vanfanel commented 3 years ago

Hi there again, @drfiemost I am trying to build Hurrican on the Raspberry Pi 4 without X11. Having SDL2 / OpenGL programs working without X11 is possible, since SDL2 runs perfectly well on KMSDRM, with working 3D GLES and OpenGL (via GLVND instead of GLX) acceleration. I have dozens of games running that way, like SDLPop, Scummvm, DoomRetro, etc

It seems that Hurrican doesn't directly require any GLX/X11 stuff directly, but it uses libEpoxy which in turn has HUGE X11 dependencies on Debian/Ubuntu:


pi@raspberrypi:~/src/Hurrican/Hurrican $ sudo apt-get install libepoxy-dev --no-install-recommends
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libdrm-amdgpu1 libdrm-common libdrm-nouveau2 libdrm-radeon1 libdrm2 libegl-dev libegl-mesa0 libegl1 libegl1-mesa-dev libepoxy0
  libgbm1 libgl-dev libgl1 libgl1-mesa-dev libgl1-mesa-dri libglapi-mesa libglvnd0 libglx-dev libglx-mesa0 libglx0 libllvm9
  libpthread-stubs0-dev libsensors-config libsensors5 libwayland-server0 libx11-dev libx11-xcb1 libxau-dev libxcb-dri2-0
  libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-sync1 libxcb-xfixes0 libxcb1-dev libxdamage1 libxdmcp-dev libxfixes3
  libxshmfence1 libxxf86vm1 x11proto-core-dev x11proto-dev xorg-sgml-doctools xtrans-dev
Suggested packages:
  lm-sensors libx11-doc libxcb-doc
The following NEW packages will be installed:
  libdrm-amdgpu1 libdrm-common libdrm-nouveau2 libdrm-radeon1 libdrm2 libegl-dev libegl-mesa0 libegl1 libegl1-mesa-dev libepoxy-dev
  libepoxy0 libgbm1 libgl-dev libgl1 libgl1-mesa-dev libgl1-mesa-dri libglapi-mesa libglvnd0 libglx-dev libglx-mesa0 libglx0
  libllvm9 libpthread-stubs0-dev libsensors-config libsensors5 libwayland-server0 libx11-dev libx11-xcb1 libxau-dev libxcb-dri2-0
  libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-sync1 libxcb-xfixes0 libxcb1-dev libxdamage1 libxdmcp-dev libxfixes3
  libxshmfence1 libxxf86vm1 x11proto-core-dev x11proto-dev xorg-sgml-doctools xtrans-dev
0 upgraded, 45 newly installed, 0 to remove and 0 not upgraded.
Need to get 22.2 MB of archives.
After this operation, 612 MB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.

So, is libEpoxy mandatory? In that case, what would be the course of action? Maybe building libepoxy from sources without X11 support if that's possible at all?

vanfanel commented 3 years ago

@drfiemost After providing my own libepoxy build (with no X11 dependencies) it seems that the buildsystem is failing to find OpenGL:


-- Could NOT find OpenGL (missing: OPENGL_glx_LIBRARY) 
-- Found LibEpoxy 1.5.8
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
OPENGL_gl_LIBRARY (ADVANCED)
    linked by target "hurrican" in directory /home/pi/src/Hurrican/Hurrican

It seems that OpenGL is supported via both GLX and GLVD on the CMakeLists.txt, right?

vanfanel commented 3 years ago

@drfiemost Ok, got it to build after removing this line from CMakeLists.txt:

https://github.com/drfiemost/Hurrican/blob/de17edb90e0e727e75a2520760b023168d382e07/Hurrican/CMakeLists.txt#L494

Maybe this specific GLX find script can be removed as it breaks modern GLVND-based builds?

drfiemost commented 3 years ago

@vanfanel In fact it builds fine without explicitly adding OpenGL. Only the EGL port still requires it, maybe it should be converted into using libepoxy? I'll try to fix the CMakeFile in the meanwhile.

vanfanel commented 3 years ago

@drfiemost I don't understand well. Is it possible to build against EGL instead of libepoxy? (ie: is it possible to build without libepoxy on the system?)

drfiemost commented 3 years ago

@vanfanel No, and I think the EGL target is no longer useful. Libepoxy should handle the abstraction over GLX/EGL if I get it correctly.

vanfanel commented 3 years ago

@drfiemost Ah! I understand now, thanks. Well, a fixed CMakeLists.txt for now is a good idea :)

drfiemost commented 3 years ago

Should be ok now