Hi,

Out of an itch for squad-based tactics games, I looked at the BROKEN
port of games/ufoai and came up with the fix below that restores it to
working order. The patch is taken from an unrelated project that also
had to replace gdk_gl_font_use_pango_font().

The patch unbreaks the build and I've played a few minutes each in
campaign and skirmish modes. While here, added harfbuzz to WANTLIB
for the editor after make port-lib-depends-check pointed that out.
I also opened the editor (uforadiant) as the new patch affects the
editor's code. No issues noticed there either.

CC maintainer
ok?

[1] 
https://github.com/Garux/netradiant-custom/commit/a0a47640b0270d9377273f4fcb714a787300b7ac

Index: Makefile
===================================================================
RCS file: /cvs/ports/games/ufoai/base/Makefile,v
retrieving revision 1.22
diff -u -p -r1.22 Makefile
--- Makefile    9 Jun 2021 19:50:08 -0000       1.22
+++ Makefile    26 Nov 2021 04:05:38 -0000
@@ -1,7 +1,5 @@
 # $OpenBSD: Makefile,v 1.22 2021/06/09 19:50:08 sthen Exp $
 
-BROKEN =               does not build with pango >=1.44
-
 COMMENT-main =         squad-based tactical strategy game
 COMMENT-editor =       UFO:AI map editor
 
@@ -29,6 +27,7 @@ WANTLIB-editor += gio-2.0 glib-2.0 gmodu
 WANTLIB-editor += gtk-x11-2.0 gtkglext-x11-1.0 gtksourceview-2.0
 WANTLIB-editor += openal pango-1.0 pangocairo-1.0 pangoft2-1.0
 WANTLIB-editor += vorbisfile xml2 ${cWANTLIB}
+WANTLIB-editor += harfbuzz
 
 COMPILER =             base-clang ports-gcc
 
Index: patches/patch-src_tools_radiant_libs_gtkutil_glfont_cpp
===================================================================
RCS file: patches/patch-src_tools_radiant_libs_gtkutil_glfont_cpp
diff -N patches/patch-src_tools_radiant_libs_gtkutil_glfont_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_tools_radiant_libs_gtkutil_glfont_cpp     26 Nov 2021 
04:05:38 -0000
@@ -0,0 +1,28 @@
+$OpenBSD$
+
+replace retired gdk_gl_font_use_pango_font with pango_font_map_load_font
+https://github.com/Garux/netradiant-custom/commit/a0a47640b0270d9377273f4fcb714a787300b7ac
+
+Index: src/tools/radiant/libs/gtkutil/glfont.cpp
+--- src/tools/radiant/libs/gtkutil/glfont.cpp.orig
++++ src/tools/radiant/libs/gtkutil/glfont.cpp
+@@ -23,6 +23,7 @@
+ #include <GL/gl.h>
+ #include "debugging/debugging.h"
+ #include <gtk/gtkglwidget.h>
++#include <pango-1.0/pango/pangoft2.h>
+ 
+ GLFont glfont_create (const std::string& font_string)
+ {
+@@ -31,7 +32,10 @@ GLFont glfont_create (const std::string& font_string)
+ 
+       PangoFontDescription* font_desc = 
pango_font_description_from_string(font_string.c_str());
+ 
+-      PangoFont* font = gdk_gl_font_use_pango_font(font_desc, 0, 256, 
font_list_base);
++      PangoFontMap *fontmap = pango_ft2_font_map_new();
++      pango_ft2_font_map_set_resolution(PANGO_FT2_FONT_MAP(fontmap), 72, 72);
++      PangoContext *ft2_context = pango_font_map_create_context(fontmap);
++      PangoFont* font = pango_font_map_load_font(fontmap, ft2_context, 
font_desc);
+ 
+       if (font != 0) {
+               PangoFontMetrics* font_metrics = pango_font_get_metrics(font, 
0);
Index: pkg/PLIST-main
===================================================================
RCS file: /cvs/ports/games/ufoai/base/pkg/PLIST-main,v
retrieving revision 1.6
diff -u -p -r1.6 PLIST-main
--- pkg/PLIST-main      27 Jun 2018 21:03:50 -0000      1.6
+++ pkg/PLIST-main      26 Nov 2021 04:05:38 -0000
@@ -11,7 +11,7 @@ share/pixmaps/ufoai.xpm
 share/pixmaps/ufoded.xpm
 share/ufoai/COPYING
 share/ufoai/LICENSES
-share/ufoai/base/game.so
+@so share/ufoai/base/game.so
 share/ufoai/base/i18n/
 share/ufoai/base/i18n/bg_BG/
 share/ufoai/base/i18n/bg_BG/LC_MESSAGES/

Reply via email to