Bug 223139 - New port: games/OpenClaw, reimplementation of Captain Claw (1997) platformer
Summary: New port: games/OpenClaw, reimplementation of Captain Claw (1997) platformer
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Yuri Victorovich
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-20 21:48 UTC by Val Packett
Modified: 2017-11-22 20:05 UTC (History)
3 users (show)

See Also:


Attachments
openclaw.patch (3.41 KB, patch)
2017-10-20 21:48 UTC, Val Packett
no flags Details | Diff
simplify (5.77 KB, patch)
2017-10-25 12:58 UTC, Jan Beich
jbeich: maintainer-approval? (val)
Details | Diff
improve launcher (3.28 KB, patch)
2017-10-25 18:51 UTC, Jan Beich
no flags Details | Diff
improve launcher (3.28 KB, patch)
2017-10-25 19:07 UTC, Jan Beich
jbeich: maintainer-approval? (val)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Val Packett 2017-10-20 21:48:44 UTC
Created attachment 187338 [details]
openclaw.patch

New port for this ->> https://github.com/pjasicek/OpenClaw

NOTE: crashes with unpatched SDL 2.0.6! Works on 2.0.5 or patched 2.0.6 (audio related patches imported from upstream — bug 223018).
Comment 1 Jan Beich freebsd_committer freebsd_triage 2017-10-25 12:58:32 UTC
Created attachment 187461 [details]
simplify

Some bits maybe easier to explain via patch.

> +PORTNAME=		OpenClaw
[...]
> +DATADIR=	${LOCALBASE}/share/openclaw
[...]
> +	${INSTALL} -s ${WRKSRC}/../Build_Release/openclaw \

CamelCase is undesirable for package names. In this case, it seems lower case is more common. AUR also uses lower case.

> +DISTVERSION=		1.0-29
> +DISTVERSIONSUFFIX=	-g49c28d9
> +CATEGORIES=		games

This can be realigned to match indentation of the rest of the file.

> +USES=		cmake:outsource ...

Why :outsource? It's neither required nor safe per CMAKE_RUNTIME_OUTPUT_DIRECTORY.

> +do-install:
> +	${INSTALL} -s ${WRKSRC}/../Build_Release/openclaw \
> +			${STAGEDIR}${PREFIX}/bin/openclaw

${INSTALL} -s should be spelled as either ${INSTALL_PROGRAM} or ${INSTALL_LIB}

> +	${INSTALL} ${WRKSRC}/Build_Release/ClawLauncher.exe \
> +			${STAGEDIR}${PREFIX}/bin/ClawLauncher.exe

Use ${INSTALL_DATA} to drop executable bit thus avoid the clutter in shell command completion.

> +	${SED} -e 's|/usr/share/openclaw|${DATADIR}|g' \
> +		${WRKSRC}/Build_Release/clawlauncher > \
> +		${WRKSRC}/Build_Release/clawlauncher_freebsd
> +	${INSTALL} ${WRKSRC}/Build_Release/clawlauncher_freebsd \
> +			${STAGEDIR}${PREFIX}/bin/clawlauncher

Use ${REINPLACE_CMD}. /usr/local isn't really specific to FreeBSD.

> +	${INSTALL_DATA} ${WRKSRC}/Build_Release/ASSETS.ZIP \
> +			${STAGEDIR}${DATADIR}/ASSETS.ZIP
> +	${INSTALL_DATA} ${WRKSRC}/Build_Release/clacon.ttf \
> +			${STAGEDIR}${DATADIR}/clacon.ttf
> +	${INSTALL_DATA} ${WRKSRC}/Build_Release/console02.tga \
> +			${STAGEDIR}${DATADIR}/console02.tga
> +	${INSTALL_DATA} ${WRKSRC}/Build_Release/SAVES.XML \
> +			${STAGEDIR}${DATADIR}/SAVES.XML

Maybe use COPYTREE_SHARE instead.

> +To complete the installation of this port you need to copy the file
> +"CLAW.REZ" from the original Captain Claw distribution to
> +%%DATADIR%%.

Doesn't seem to work unless clawlauncher was used at least once.

  $ rm -rf ~/.config/openclaw/
  $ openclaw
  INFO: Looking for: /home/luser/.config/openclaw/config.xml
  INFO: Expecting config.xml in path: /home/luser/.config/openclaw/config.xml
  WARN: [LoadGameOptions] Configuration file: /home/luser/.config/openclaw/config.xml not found - creating default configuration
  Assertion failed: (ParseValueFromXmlElem(&m_GameOptions.customArchive, assetsElem->FirstChildElement("CustomArchive"))), function LoadGameOptions, file OpenClaw/Engine/GameApp/BaseGameApp.cpp, line 429.
  Abort trap

  $ mkdir -p ~/.config/openclaw
  $ (cd /usr/local/share/openclaw/; cp SAVES.XML config.xml ~/.config/openclaw/)
  $ openclaw
  INFO: Looking for: /home/luser/.config/openclaw/config.xml
  INFO: Expecting config.xml in path: /home/luser/.config/openclaw/config.xml
  INFO: Loaded with:
	  Config File: /home/luser/.config/openclaw/config.xml
	  Saves File: /home/luser/.config/openclaw/SAVES.XML
  INFO: >>>>> Initializing display...
  INFO: Display successfully initialized.
  INFO: >>>>> Initializing audio...
  INFO: Audio successfully initialized.
  INFO: >>>>> Initializing font...
  INFO: Font successfully initialized...
  INFO: >>>>> Initializing resource cache...
  INFO: Resource cache successfully initialized
  INFO: >>>>> Loading actor prototypes...
  INFO: Actor prototypes loaded successfully.
  INFO: 1
  INFO: Changing to: 3

> +To use clawlauncher (optional), install lang/mono.

Looks underspecified.

  $ pkg install mono
  $ clawlauncher
  WARNING: The runtime version supported by this application is unavailable.
  Using default runtime: v4.0.30319

  Unhandled Exception:
  System.TypeInitializationException: The type initializer for 'System.Windows.Forms.XplatUI' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Drawing.GDIPlus' threw an exception. ---> System.DllNotFoundException: libgdiplus.so
    at (wrapper managed-to-native) System.Drawing.GDIPlus:GdiplusStartup (ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
    at System.Drawing.GDIPlus..cctor () [0x000cc] in <5eb1d9ccfec943adba5ae843e256d04f>:0
     --- End of inner exception stack trace ---
    at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_generic_class_init (intptr)
    at System.Drawing.Graphics.FromHdcInternal (System.IntPtr hdc) [0x00000] in <5eb1d9ccfec943adba5ae843e256d04f>:0
    at System.Windows.Forms.XplatUIX11.SetDisplay (System.IntPtr display_handle) [0x0007e] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0
    at System.Windows.Forms.XplatUIX11..ctor () [0x00077] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0
    at System.Windows.Forms.XplatUIX11.GetInstance () [0x0001c] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0
    at System.Windows.Forms.XplatUI..cctor () [0x0007d] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0
     --- End of inner exception stack trace ---
    at System.Windows.Forms.Application.EnableVisualStyles () [0x00006] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0
    at ClawLauncher.Program.Main () [0x00030] in <a4adea8190ba4536856f18624a80285b>:0
  [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'System.Windows.Forms.XplatUI' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Drawing.GDIPlus' threw an exception. ---> System.DllNotFoundException: libgdiplus.so
    at (wrapper managed-to-native) System.Drawing.GDIPlus:GdiplusStartup (ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
    at System.Drawing.GDIPlus..cctor () [0x000cc] in <5eb1d9ccfec943adba5ae843e256d04f>:0
     --- End of inner exception stack trace ---
    at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_generic_class_init (intptr)
    at System.Drawing.Graphics.FromHdcInternal (System.IntPtr hdc) [0x00000] in <5eb1d9ccfec943adba5ae843e256d04f>:0
    at System.Windows.Forms.XplatUIX11.SetDisplay (System.IntPtr display_handle) [0x0007e] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0
    at System.Windows.Forms.XplatUIX11..ctor () [0x00077] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0
    at System.Windows.Forms.XplatUIX11.GetInstance () [0x0001c] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0
    at System.Windows.Forms.XplatUI..cctor () [0x0007d] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0
     --- End of inner exception stack trace ---
    at System.Windows.Forms.Application.EnableVisualStyles () [0x00006] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0
    at ClawLauncher.Program.Main () [0x00030] in <a4adea8190ba4536856f18624a80285b>:0


  $ pkg install libgdiplus
  $ clawlauncher
  WARNING: The runtime version supported by this application is unavailable.
  Using default runtime: v4.0.30319
  Gtk not found (missing LD_LIBRARY_PATH to libgtk-x11-2.0.so.0?), using built-in colorscheme

  Unhandled Exception:
  System.ArgumentException: The requested FontFamily could not be found [GDI+ status: FontFamilyNotFound]
    at System.Drawing.GDIPlus.CheckStatus (System.Drawing.Status status) [0x001e5] in <5eb1d9ccfec943adba5ae843e256d04f>:0
    at System.Drawing.FontFamily..ctor (System.Drawing.Text.GenericFontFamilies genericFamily) [0x0005b] in <5eb1d9ccfec943adba5ae843e256d04f>:0
    at (wrapper remoting-invoke-with-check) System.Drawing.FontFamily:.ctor (System.Drawing.Text.GenericFontFamilies)
    at System.Drawing.FontFamily.get_GenericSansSerif () [0x00000] in <5eb1d9ccfec943adba5ae843e256d04f>:0
    at System.Drawing.Font.CreateFont (System.String familyName, System.Single emSize, System.Drawing.FontStyle style, System.Drawing.GraphicsUnit unit, System.Byte charSet, System.Boolean isVertical) [0x00014] in <5eb1d9ccfec943adba5ae843e256d04f>:0
    at System.Drawing.Font..ctor (System.String familyName, System.Single emSize, System.Drawing.FontStyle style, System.Drawing.GraphicsUnit unit, System.Byte gdiCharSet, System.Boolean gdiVerticalFont) [0x00011] in <5eb1d9ccfec943adba5ae843e256d04f>:0
    at System.Drawing.Font..ctor (System.String familyName, System.Single emSize, System.String systemName) [0x00000] in <5eb1d9ccfec943adba5ae843e256d04f>:0
    at (wrapper remoting-invoke-with-check) System.Drawing.Font:.ctor (string,single,string)
    at System.Drawing.SystemFonts.get_DefaultFont () [0x00000] in <5eb1d9ccfec943adba5ae843e256d04f>:0
    at System.Windows.Forms.Theme.get_DefaultFont () [0x0000d] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0
    at System.Windows.Forms.Control.get_DefaultFont () [0x00005] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0
    at System.Windows.Forms.Control.get_Font () [0x00031] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0
    at System.Windows.Forms.Form..ctor () [0x00018] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0
    at ClawLauncher.ClawLauncherForm..ctor () [0x00000] in <a4adea8190ba4536856f18624a80285b>:0
    at (wrapper remoting-invoke-with-check) ClawLauncher.ClawLauncherForm:.ctor ()
    at ClawLauncher.Program.Main () [0x0003b] in <a4adea8190ba4536856f18624a80285b>:0
  [ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentException: The requested FontFamily could not be found [GDI+ status: FontFamilyNotFound]
    at System.Drawing.GDIPlus.CheckStatus (System.Drawing.Status status) [0x001e5] in <5eb1d9ccfec943adba5ae843e256d04f>:0
    at System.Drawing.FontFamily..ctor (System.Drawing.Text.GenericFontFamilies genericFamily) [0x0005b] in <5eb1d9ccfec943adba5ae843e256d04f>:0
    at (wrapper remoting-invoke-with-check) System.Drawing.FontFamily:.ctor (System.Drawing.Text.GenericFontFamilies)
    at System.Drawing.FontFamily.get_GenericSansSerif () [0x00000] in <5eb1d9ccfec943adba5ae843e256d04f>:0
    at System.Drawing.Font.CreateFont (System.String familyName, System.Single emSize, System.Drawing.FontStyle style, System.Drawing.GraphicsUnit unit, System.Byte charSet, System.Boolean isVertical) [0x00014] in <5eb1d9ccfec943adba5ae843e256d04f>:0
    at System.Drawing.Font..ctor (System.String familyName, System.Single emSize, System.Drawing.FontStyle style, System.Drawing.GraphicsUnit unit, System.Byte gdiCharSet, System.Boolean gdiVerticalFont) [0x00011] in <5eb1d9ccfec943adba5ae843e256d04f>:0
    at System.Drawing.Font..ctor (System.String familyName, System.Single emSize, System.String systemName) [0x00000] in <5eb1d9ccfec943adba5ae843e256d04f>:0
    at (wrapper remoting-invoke-with-check) System.Drawing.Font:.ctor (string,single,string)
    at System.Drawing.SystemFonts.get_DefaultFont () [0x00000] in <5eb1d9ccfec943adba5ae843e256d04f>:0
    at System.Windows.Forms.Theme.get_DefaultFont () [0x0000d] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0
    at System.Windows.Forms.Control.get_DefaultFont () [0x00005] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0
    at System.Windows.Forms.Control.get_Font () [0x00031] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0
    at System.Windows.Forms.Form..ctor () [0x00018] in <b4e6df1a5a1f4b78af726adaf5fd3ede>:0
    at ClawLauncher.ClawLauncherForm..ctor () [0x00000] in <a4adea8190ba4536856f18624a80285b>:0
    at (wrapper remoting-invoke-with-check) ClawLauncher.ClawLauncherForm:.ctor ()
    at ClawLauncher.Program.Main () [0x0003b] in <a4adea8190ba4536856f18624a80285b>:0

  $ pkg install dejavu
  $ clawlauncher
  WARNING: The runtime version supported by this application is unavailable.
  Using default runtime: v4.0.30319
  Gtk not found (missing LD_LIBRARY_PATH to libgtk-x11-2.0.so.0?), using built-in colorscheme

Probably no need to document dejavu as any usable font will do.
Comment 2 Val Packett 2017-10-25 14:49:39 UTC
(In reply to Jan Beich from comment #1)
I've tried using GH_PROJECT=OpenClaw and lowercase name, but it failed (archive name related problems) for some reason. I guess I was using DISTNAME instead of PORTNAME or something. Works now, anyway :D

Re: clawlauncher_freebsd — I didn't want to overwrite the existing _linux file for some reason… that was silly, yeah.

gdiplus — nice catch!

And yeah, "config.xml not found - creating default configuration" does not even create the file… I'll look into fixing that.
Comment 3 Jan Beich freebsd_committer freebsd_triage 2017-10-25 18:51:26 UTC
Created attachment 187470 [details]
improve launcher

I wonder if an option would work better to track dependencies.

LAUNCHER=on  - http://sprunge.us/ZjCF
LAUNCHER=off - http://sprunge.us/cREH
Comment 4 Jan Beich freebsd_committer freebsd_triage 2017-10-25 19:02:10 UTC
Comment on attachment 187470 [details]
improve launcher

StartupNotify in .desktop file is blindly left unset. It's probably not important for a launcher, anyway.
Comment 5 Jan Beich freebsd_committer freebsd_triage 2017-10-25 19:07:42 UTC
Created attachment 187471 [details]
improve launcher
Comment 6 Val Packett 2017-10-25 19:09:49 UTC
(In reply to Jan Beich from comment #5)
Yeah I guess the launcher option is good.

Also, do we need INSTALLS_ICONS=yes? It's documented as "for gnome/gtk apps" but surely gnome users would want the cache refreshed for *any* apps…
Comment 7 Jan Beich freebsd_committer freebsd_triage 2017-10-25 19:18:37 UTC
(In reply to Greg V from comment #6)
It's a cache for icons that show up in app menu i.e., may work fine even if stale. And Gnome isn't the only DE that can run on FreeBSD. TrueOS seems to lean towards KDE.

$ pkg install gtk2 pkgconf
$ fetch -o icon-lookup.c 'https://bugs.freebsd.org/bugzilla/attachment.cgi?id=153255'
$ make icon-lookup CFLAGS="`pkg-config gtk+-2.0 --libs --cflags`"
$ ./icon-lookup hicolor openclaw 128x128 0
/usr/local/share/icons/hicolor/128x128/apps/openclaw.png
Comment 8 Jan Beich freebsd_committer freebsd_triage 2017-10-25 19:25:23 UTC
I don't remember what actually handles .desktop files on Gnome desktop. Gtk uses icons for file dialogs, buttons, etc. openclaw.png is unlikely to be part of those.
Comment 9 Jan Beich freebsd_committer freebsd_triage 2017-10-25 19:37:07 UTC
INSTALLS_ICONS would only make sense if LAUNCHER=on already dependended on any gtk* version. It adds gtk-update-icon-cache into RUN_DEPENDS. Let's measure the bloat:

$ pkg install -qy openclaw
$ pkg install -qn gtk-update-icon-cache
The following 24 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        gtk-update-icon-cache: 2.24.29
        libXcomposite: 0.4.4_3,1
        compositeproto: 0.4.2
        pango: 1.40.6
        xorg-fonts-truetype: 7.7_1
        font-misc-meltho: 1.0.3_3
        mkfontscale: 1.1.2
        libfontenc: 1.1.3_1
        mkfontdir: 1.0.7
        font-misc-ethiopic: 1.0.3_3
        font-bh-ttf: 1.0.3_3
        encodings: 1.0.4_3,1
        font-util: 1.3.1
        dejavu: 2.37
        harfbuzz: 1.5.1_1
        graphite2: 1.3.10
        shared-mime-info: 1.8
        hicolor-icon-theme: 0.15
        gdk-pixbuf2: 2.36.9
        libXt: 1.1.5,1
        libSM: 1.2.2_3,1
        libICE: 1.0.9_1,1
        jasper: 1.900.1_17
        atk: 2.24.0

Number of packages to be installed: 24
Comment 10 commit-hook freebsd_committer freebsd_triage 2017-11-22 20:04:28 UTC
A commit references this bug:

Author: yuri
Date: Wed Nov 22 20:04:01 UTC 2017
New revision: 454703
URL: https://svnweb.freebsd.org/changeset/ports/454703

Log:
  New port: games/openclaw: Reimplementation of Captain Claw (1997) platformer

  PR:		223139
  Submitted by:	Greg V <greg@unrelenting.technology>
  Approved by:	tcberner (mentor)
  Differential Revision:	https://reviews.freebsd.org/D13164

Changes:
  head/games/Makefile
  head/games/openclaw/
  head/games/openclaw/Makefile
  head/games/openclaw/distinfo
  head/games/openclaw/files/
  head/games/openclaw/files/pkg-message.in
  head/games/openclaw/pkg-descr
Comment 11 Yuri Victorovich freebsd_committer freebsd_triage 2017-11-22 20:05:49 UTC
Committed with small changes. Thanks!