Here is a diff that unbreaks crashing when toggling fullscreen in
singleplayer. I used LD_DEBUG=1 to see the differences between openjk_sp
and openjk.[1] I eventually found that openjk is linked with -lGL -lGLU
whereas openjk_sp lacks these flags.

I opened a pull request.[2]

Feedback and tests are welcome. OK?

Footnotes:
[1]  https://gist.github.com/namtsui/3f227e9f9e6e16c804e76efecf0f2a46
[2]  https://github.com/JACoders/OpenJK/pull/1037#issuecomment-833410518

Index: Makefile
===================================================================
RCS file: /cvs/ports/games/openjk/Makefile,v
retrieving revision 1.12
diff -u -p -u -p -r1.12 Makefile
--- Makefile    7 Feb 2021 18:59:12 -0000       1.12
+++ Makefile    6 May 2021 10:45:55 -0000
@@ -8,6 +8,7 @@ CATEGORIES =    games x11
 GH_ACCOUNT =   JACoders
 GH_PROJECT =   OpenJK
 GH_COMMIT =    d2ed03a016f54917bc1dcf06bcc59d3f674fb533
+REVISION =     0
 
 HOMEPAGE =     https://openjk.org/
 MAINTAINER =   Brian Callahan <[email protected]>
Index: patches/patch-code_CMakeLists_txt
===================================================================
RCS file: patches/patch-code_CMakeLists_txt
diff -N patches/patch-code_CMakeLists_txt
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-code_CMakeLists_txt   6 May 2021 10:45:55 -0000
@@ -0,0 +1,28 @@
+$OpenBSD$
+
+Add -lGL and -lGLU to openjk_sp 
+
+see: https://github.com/JACoders/OpenJK/pull/1037
+
+Unbreaks crash when toggling fullscreen in the singleplayer binary on
+OpenBSD. openjk (multiplayer binary) uses -lGL and -lGLU but openjk_sp
+did not.
+
+Index: code/CMakeLists.txt
+--- code/CMakeLists.txt.orig
++++ code/CMakeLists.txt
+@@ -45,6 +45,14 @@ if(BuildSPEngine OR BuildJK2SPEngine)
+               "${GSLIncludeDirectory}")
+ 
+       #    Dependencies
++
++      if (NOT WIN32)
++              # OpenGL
++              find_package(OpenGL REQUIRED)
++              set(SPEngineIncludeDirectories ${SPEngineIncludeDirectories} 
${OPENGL_INCLUDE_DIR})
++              set(SPEngineLibraries ${SPEngineLibraries} ${OPENGL_LIBRARIES})
++      endif()
++
+       # OpenAL (is optionally included for Windows)
+       if(MSVC AND NOT WIN64)
+               if(UseInternalOpenAL)

Reply via email to