Monday, April 25, 2022

Re: games/godot: split the editor in a subpackage

Omar Polo <op@openbsd.org> wrote:
> Hello ports,
>
> I'd like to split the godot package into two: the engine alone and the
> editor.
>
> We're currently building the engine with the editor enabled, which is
> fine, but makes akward to run standalone PCK (i.e. godot' packaged
> games) from the command line. When the editor (tools=yes) is enabled
> godot does some checks that really make sense only when developing, even
> when running PCK.
>
> Since I'm expecting that most users install godot just to play some
> games, having these "errors" logged is misleading. (godot tries to do
> stuff like loading the assets from the disk even when they're in the
> PCK, and other stuff like this.) Thus having the editor enabled for
> them makes the experience only worse.
>
> On the other hand I'd like to be possible to "opt in" and have the IDE
> available.
>
> What I'm proposing is to build godot two times, one with tools=yes and
> one without, and split the thing into two subpackages. I'm explicitly
> using MULTI_PACKAGES and not flavor because:
>
> 1. scons does the right thing and rebuilds only what's needed when the
> flags changes, so we save a bit of build time. (not that much, but
> every bit helps?)
>
> 2. I'd like to have different PLIST for the packages, and this approach
> seemed simpler than rolling something like MODPY_COMMENT. The desktop
> file and icon only makes sense for the -editor build for example.
>
> 3. if one opts in and install the hypothetic "editor" flavor, than when
> trying run a standalone PCK they have the same issues as the current
> package.

I forgot one thing: this also makes possible in the future to eventually
ship also a -server package (to host game servers) or a -headless one
(that would come in handy for building godot stuff from the port tree.)

> Diff belows install the engine itself as `godot' and the editor as,
> unsurprisingly, `godot-editor'. patch-drivers_unix_os_unix_cpp
> hardcoded /usr/local/bin/godot inside the binary and needed some
> tweaking because that code is now used by *two* differently-named
> executable. Fortunately, the main() caches argv[0] and we can just
> reuse that.
>
> P.S.: is the REVISION handling correct? the old `godot' package keeps
> the name but its content differs (see the new plist) so I bumped the
> revision only for -main, right? `make show=PKGNAMES' looks correct:
>
> % make show=PKGNAMES
> godot-3.4.4p1 debug-godot-3.4.4p1 godot-editor-3.4.4 debug-godot-editor-3.4.4
>
>
> Index: Makefile
> ===================================================================
> RCS file: /home/cvs/ports/games/godot/Makefile,v
> retrieving revision 1.34
> diff -u -p -r1.34 Makefile
> --- Makefile 15 Apr 2022 20:23:19 -0000 1.34
> +++ Makefile 25 Apr 2022 17:38:31 -0000
> @@ -1,25 +1,33 @@
> BROKEN-powerpc = fails at runtime, the UI is totally blank
>
> -COMMENT = 2D and 3D game engine
> +COMMENT-main = 2D and 3D game engine
> +COMMENT-editor= 2D and 3D game engine (with editor)
>
> V = 3.4.4
> GODOTSTEAM_V = g34-s152-gs311
> DISTNAME = godot-${V}-stable
> PKGNAME = godot-${V}
> -REVISION = 0
> +REVISION-main = 1
> +
> CATEGORIES = games
> +
> HOMEPAGE = https://godotengine.org/
> +
> MAINTAINER = Omar Polo <op@omarpolo.com>
>
> # MIT
> PERMIT_PACKAGE = Yes
>
> +MULTI_PACKAGES = -main -editor
> +
> WANTLIB += ${COMPILER_LIBCXX} BulletCollision BulletDynamics BulletSoftBody
> WANTLIB += LinearMath GL X11 Xau Xcursor Xdmcp Xext Xfixes Xi Xinerama Xrandr
> WANTLIB += Xrender c enet execinfo freetype intl m mbedtls mbedcrypto
> WANTLIB += mbedx509 mpcdec ogg opus opusfile png sndio steam_api theora
> WANTLIB += theoradec usbhid vorbis vorbisfile webp xcb z pcre2-32 vpx zstd
>
> +WANTLIB-editor = ${WANTLIB}
> +
> # C++14
> COMPILER = base-clang ports-gcc
>
> @@ -83,7 +91,8 @@ LIB_DEPENDS = archivers/zstd \
> multimedia/libvpx \
> net/enet \
> security/polarssl
> -RUN_DEPENDS = devel/desktop-file-utils
> +
> +RUN_DEPENDS-editor = devel/desktop-file-utils
>
> DEBUG_PACKAGES = ${BUILD_PACKAGES}
> NO_TEST = Yes
> @@ -103,15 +112,21 @@ post-extract:
> ${WRKDIST}/platform/x11/
>
> pre-configure:
> - ${SUBST_CMD} ${WRKSRC}/drivers/unix/os_unix.cpp
> + ${SUBST_CMD} ${WRKSRC}/misc/dist/linux/*.desktop
> sed -E -i 's/ISteamHTMLSurface:://g' \
> ${WRKDIR}/GodotSteam-${GODOTSTEAM_V}/godotsteam/godotsteam.cpp
> sed -E -i 's/Connection_DEPRECATED/Connection/g' \
> ${WRKDIR}/GodotSteam-${GODOTSTEAM_V}/godotsteam/godotsteam.cpp
>
> +do-build:
> + @${MODSCONS_BUILD_TARGET} tools=no
> + @${MODSCONS_BUILD_TARGET} tools=yes
> +
> do-install:
> - ${INSTALL_PROGRAM} ${WRKBUILD}/bin/godot* \
> + ${INSTALL_PROGRAM} ${WRKBUILD}/bin/godot.x11.opt.debug.* \
> ${PREFIX}/bin/godot
> + ${INSTALL_PROGRAM} ${WRKBUILD}/bin/godot.x11.opt.tools.* \
> + ${PREFIX}/bin/godot-editor
> ${INSTALL_MAN_DIR} ${PREFIX}/man/man6
> ${INSTALL_MAN} ${WRKSRC}/misc/dist/linux/godot.6 \
> ${PREFIX}/man/man6
> Index: patches/patch-drivers_unix_os_unix_cpp
> ===================================================================
> RCS file: /home/cvs/ports/games/godot/patches/patch-drivers_unix_os_unix_cpp,v
> retrieving revision 1.8
> diff -u -p -r1.8 patch-drivers_unix_os_unix_cpp
> --- patches/patch-drivers_unix_os_unix_cpp 11 Mar 2022 19:04:30 -0000 1.8
> +++ patches/patch-drivers_unix_os_unix_cpp 25 Apr 2022 17:51:42 -0000
> @@ -1,14 +1,16 @@
> -hardcode executable path
> -
> Index: drivers/unix/os_unix.cpp
> --- drivers/unix/os_unix.cpp.orig
> +++ drivers/unix/os_unix.cpp
> -@@ -485,7 +485,7 @@ String OS_Unix::get_executable_path() const {
> +@@ -483,11 +483,7 @@ String OS_Unix::get_executable_path() const {
> + }
> + return b;
> #elif defined(__OpenBSD__) || defined(__NetBSD__)
> - char resolved_path[MAXPATHLEN];
> -
> +- char resolved_path[MAXPATHLEN];
> +-
> - realpath(OS::get_executable_path().utf8().get_data(), resolved_path);
> -+ realpath("${PREFIX}/bin/godot", resolved_path);
> -
> - return String(resolved_path);
> +-
> +- return String(resolved_path);
> ++ return OS::get_executable_path();
> #elif defined(__FreeBSD__)
> + int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
> + char buf[MAXPATHLEN];
> Index: pkg/DESCR
> ===================================================================
> RCS file: pkg/DESCR
> diff -N pkg/DESCR
> --- pkg/DESCR 27 Apr 2018 07:32:53 -0000 1.1.1.1
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,3 +0,0 @@
> -Godot is an advanced, feature-packed, multi-platform 2D and 3D open source
> -game engine. It provides a huge set of common tools, so you can just focus
> -on making your game without reinventing the wheel.
> Index: pkg/DESCR-editor
> ===================================================================
> RCS file: pkg/DESCR-editor
> diff -N pkg/DESCR-editor
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ pkg/DESCR-editor 19 Apr 2022 10:25:53 -0000
> @@ -0,0 +1,3 @@
> +Godot is an advanced, feature-packed, multi-platform 2D and 3D open source
> +game engine. It provides a huge set of common tools, so you can just focus
> +on making your game without reinventing the wheel.
> Index: pkg/DESCR-main
> ===================================================================
> RCS file: pkg/DESCR-main
> diff -N pkg/DESCR-main
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ pkg/DESCR-main 27 Apr 2018 07:32:53 -0000
> @@ -0,0 +1,3 @@
> +Godot is an advanced, feature-packed, multi-platform 2D and 3D open source
> +game engine. It provides a huge set of common tools, so you can just focus
> +on making your game without reinventing the wheel.
> Index: pkg/PLIST
> ===================================================================
> RCS file: pkg/PLIST
> diff -N pkg/PLIST
> --- pkg/PLIST 8 Mar 2022 16:48:16 -0000 1.4
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,9 +0,0 @@
> -@bin bin/godot
> -@man man/man6/godot.6
> -share/applications/org.godotengine.Godot.desktop
> -share/doc/pkg-readmes/${PKGSTEM}
> -share/metainfo/
> -share/metainfo/org.godotengine.Godot.appdata.xml
> -share/pixmaps/
> -share/pixmaps/godot.svg
> -@tag update-desktop-database
> Index: pkg/PLIST-editor
> ===================================================================
> RCS file: pkg/PLIST-editor
> diff -N pkg/PLIST-editor
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ pkg/PLIST-editor 19 Apr 2022 10:22:56 -0000
> @@ -0,0 +1,9 @@
> +@bin bin/godot-editor
> +@man man/man6/godot.6
> +share/applications/org.godotengine.Godot.desktop
> +share/doc/pkg-readmes/${PKGSTEM}
> +share/metainfo/
> +share/metainfo/org.godotengine.Godot.appdata.xml
> +share/pixmaps/
> +share/pixmaps/godot.svg
> +@tag update-desktop-database
> Index: pkg/PLIST-main
> ===================================================================
> RCS file: pkg/PLIST-main
> diff -N pkg/PLIST-main
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ pkg/PLIST-main 19 Apr 2022 10:22:55 -0000
> @@ -0,0 +1 @@
> +@bin bin/godot
> Index: pkg/README
> ===================================================================
> RCS file: pkg/README
> diff -N pkg/README
> --- pkg/README 11 Mar 2022 19:04:30 -0000 1.2
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,12 +0,0 @@
> -+-------------------------------------------------------------------------------
> -| Running ${PKGSTEM} on OpenBSD
> -+-------------------------------------------------------------------------------
> -
> -Modules
> -=======
> -
> -Note that this version includes the module "GodotSteam" in its namespace which
> -is not part of the default Godot install. This is mainly for compatibility with
> -runtime of prepackaged games. It communicates with games/goldberg_emulator, not
> -an official Steam client. Making use of the Steam.* namespace for development
> -may lead to unexpected behavior, so use at your own risk.
> Index: pkg/README-editor
> ===================================================================
> RCS file: pkg/README-editor
> diff -N pkg/README-editor
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ pkg/README-editor 12 Mar 2022 10:06:25 -0000
> @@ -0,0 +1,12 @@
> ++-------------------------------------------------------------------------------
> +| Running ${PKGSTEM} on OpenBSD
> ++-------------------------------------------------------------------------------
> +
> +Modules
> +=======
> +
> +Note that this version includes the module "GodotSteam" in its namespace which
> +is not part of the default Godot install. This is mainly for compatibility with
> +runtime of prepackaged games. It communicates with games/goldberg_emulator, not
> +an official Steam client. Making use of the Steam.* namespace for development
> +may lead to unexpected behavior, so use at your own risk.

No comments:

Post a Comment