On Fri, November 26, 2021 18:34, Thomas Frohwein wrote:
> On Fri, Nov 26, 2021 at 10:39:35AM +0300, Kirill Bychkov wrote:
>> On Fri, November 26, 2021 07:10, Thomas Frohwein wrote:
>> > 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?
>>
>> Hi!
>> Completely missed that it was marked broken.
>> Builds and runs fine for me. Thanks for fixing it.
>> OK kirby@ with the REVISION bump.
>
> Sounds good! 2 long years have passed since it's been marked BROKEN [1]
> and some archs have seen a lot of work in that time. Should we give
> this a try to build on arm64 and riscv64, as in the updated diff below?
>
> [1] https://marc.info/?l=openbsd-ports-cvs&m=157766382113923&w=2
Yes. Reading cvs log for Makefile surprised me very much.
I guess that's because I was disappointed with campaign ending....
No final battle and so on as it was in X-Com.
>
> Index: Makefile.inc
> ===================================================================
> RCS file: /cvs/ports/games/ufoai/Makefile.inc,v
> retrieving revision 1.8
> diff -u -p -r1.8 Makefile.inc
> --- Makefile.inc 12 Jul 2019 21:07:46 -0000 1.8
> +++ Makefile.inc 26 Nov 2021 15:23:24 -0000
> @@ -3,7 +3,7 @@
> # data package is useless without ufoai itself, which can only be
> # built on some arches.
> # Saves a useless 895MB package on other arches.
> -ONLY_FOR_ARCHS= amd64 i386 powerpc
> +ONLY_FOR_ARCHS= amd64 arm64 i386 powerpc riscv64
Let's give it a try. I have no arm64 nor riscv64 to test.
>
> CATEGORIES = games
>
> Index: base/Makefile
> ===================================================================
> RCS file: /cvs/ports/games/ufoai/base/Makefile,v
> retrieving revision 1.22
> diff -u -p -r1.22 Makefile
> --- base/Makefile 9 Jun 2021 19:50:08 -0000 1.22
> +++ base/Makefile 26 Nov 2021 15:23:24 -0000
> @@ -1,14 +1,12 @@
> # $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
>
> DISTNAME = ufoai-${V}-source
> PKGNAME-main = ${DISTNAME:S/-source//}
> PKGNAME-editor = uforadiant-${V}
> -REVISION = 6
> +REVISION = 7
>
> EXTRACT_SUFX = .tar.bz2
>
> @@ -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: base/patches/patch-src_tools_radiant_libs_gtkutil_glfont_cpp
> ===================================================================
> RCS file: base/patches/patch-src_tools_radiant_libs_gtkutil_glfont_cpp
> diff -N base/patches/patch-src_tools_radiant_libs_gtkutil_glfont_cpp
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ base/patches/patch-src_tools_radiant_libs_gtkutil_glfont_cpp 26 Nov
> 2021
> 15:23:24 -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: base/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
> --- base/pkg/PLIST-main 27 Jun 2018 21:03:50 -0000 1.6
> +++ base/pkg/PLIST-main 26 Nov 2021 15:23:24 -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/
>