Bug 281080

Summary: emulators/ares: update to 139.20240825 and unbundle librashader dependency
Product: Ports & Packages Reporter: Stefan Schlosser <bsdcode>
Component: Individual Port(s)Assignee: Vladimir Druzenko <vvd>
Status: Closed FIXED    
Severity: Affects Some People CC: vvd
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
update to 139.20240825 and unbundle librashader dependency
bsdcode: maintainer-approval+
update to 139.20240825 and unbundle librashader dependency bsdcode: maintainer-approval+

Description Stefan Schlosser 2024-08-26 18:06:31 UTC
Created attachment 253107 [details]
update to 139.20240825 and unbundle librashader dependency

Commit changes:
https://github.com/ares-emulator/ares/compare/3cd82c8..efb7f61

Port changes:
 * set unconditional BUILD_DEPENDS on devel/librashader, required to compile
 * set conditional RUN_DEPENDS on devel/librashader by the SHADER portoption
 * hide the 'thirdparty/librashader/include' directory from the build process
 * use <librashader/librashader_ld.h> include instead of "librashader_ld.h"
 * set required LIBRA_RUNTIME_OPENGL preprocessor constant
 * remove librashader section from pkg-message
 * remove pkg-message from SUB_FILES, it doesn't have variable strings anymore
 * replace 'hiro/GNUmakefile'-patch with ${REINPLACE_CMD}, simplifies port
Comment 1 Vladimir Druzenko freebsd_committer freebsd_triage 2024-08-26 19:50:52 UTC
Can it work without librashader? If yes, maybe make default ON option?
Comment 2 Stefan Schlosser 2024-08-26 22:55:26 UTC
The relationship between ares and librashader is this: ares bundles a local copy of the complete librashader sourcecode under ${WRKSRC}/thirdparty/librashader. The only things ares really needs and uses from it are the includefiles include/librashader.h and include/librashader_ld.h. But this is mandatory, ares won't compile without them. At runtime it isn't a hard dependency, it tries to dynamically load ${LOCALBASE}/lib/librashader.so and if it succeeds then shaders work, if it doesn't succeed then shaders don't work.

If it wouldn't be an unconditional build dependency then we could control everything related to librashader behind the SHADER portoption, i.e.
 * use SHADER_LIB_DEPENDS=devel/librashader instead of BUILD_DEPENDS + SHADER_RUN_DEPENDS
 * use SHADER_CFLAGS=-DLIBRA_RUNTIME_OPENGL instead of CFLAGS
 * use ${REINPLACE_CMD} for librashader_ld.h in post-patch-SHADER-on instead of in post-patch
 * use ${REINPLACE_CMD} 's|-I../thirdparty/librashader/include||g' ${WRKSRC}/desktop-ui/GNUmakefile in post-patch-SHADER-on instead of inside the desktop-ui_GNUmakefile patch itself

Now, we can do exactly this, but because librashader is an unconditional build dependency we have the following situation:
 * SHADER on: ares build uses includefiles from devel/librashader
 * SHADER off: ares build uses bundled includefiles

With my current updatepatch we just always use the includefiles from devel/librashader.

What are you recommending?
Comment 3 Vladimir Druzenko freebsd_committer freebsd_triage 2024-08-26 23:20:24 UTC
I think better have 2 options: SHADERS_SLANG and RASHADERS (you pick better names :-D).
SHADERS_SLANG is current SHADER.
RASHADERS is:
 * use RASHADER_LIB_DEPENDS=devel/librashader instead of BUILD_DEPENDS
 * use RASHADER_CFLAGS=-DLIBRA_RUNTIME_OPENGL instead of CFLAGS
and etc.
Comment 4 Stefan Schlosser 2024-08-26 23:39:10 UTC
I don't think it's a good idea to split the actual shaders from the shader engine. One is useless without the other. Without the libretro shaders you don't need the librashader engine, and without the librashader engine you don't need the shaders.

Or are we talking about different things?
Comment 5 Vladimir Druzenko freebsd_committer freebsd_triage 2024-08-26 23:45:24 UTC
Can't it really just work with one set of shaders?
Hm…
Comment 6 Stefan Schlosser 2024-08-26 23:52:14 UTC
I think you are a little bit off here :-D

There is ONLY one set of shaders: games/libretro-shaders-slang
/devel/librashader is the engine which uses these shaders.

I think there's no need to overcomplicate things here ;)
ares bundles librashader. Now that /devel/librashader is available in the ports tree we just unbundle this dependency. Nothing more.
Comment 7 Vladimir Druzenko freebsd_committer freebsd_triage 2024-08-27 00:31:12 UTC
(In reply to Stefan Schlosser from comment #6)
Ok.
Option SHADER handle both engine and shaders.
Comment 8 Stefan Schlosser 2024-08-27 08:26:10 UTC
Created attachment 253112 [details]
update to 139.20240825 and unbundle librashader dependency

Thanks! I updated the patch as requested. Unfortunately stage-qa interfered with our plans... it complains about librashader.so not needed as LIB_DEPENDS, which is true because ares doesn't link against it explicitly. So I had to keep the split between SHADER_BUILD_DEPENDS and SHADER_RUN_DEPENDS.
Comment 9 Vladimir Druzenko freebsd_committer freebsd_triage 2024-08-27 11:29:55 UTC
Are you sure you need lang/rust-nightly for devel/librashader?
lang/rust is 1.80.1.
Comment 10 Stefan Schlosser 2024-08-27 11:34:41 UTC
Yes. Also upstream is tracking the requirements before they can switch to the stable rust version (https://github.com/SnowflakePowered/librashader/issues/55).

I also tested version 0.3.0 of /devel/librashader with lang/rust back when I first created the port and it didn't work, lang/rust-nightly was needed. For the recent version update to 0.3.3 of /devel/librashader I didn't test it because I assume it's still the case.
Comment 11 Stefan Schlosser 2024-08-27 11:44:45 UTC
And I just tested the build of version 0.3.3 with lang/rust. Still doesn't work, lang/rust-nightly still needed.
Comment 12 commit-hook freebsd_committer freebsd_triage 2024-08-27 17:39:20 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=b772f1f7b08121988afc02f0dc70a4ce07e72e7d

commit b772f1f7b08121988afc02f0dc70a4ce07e72e7d
Author:     Stefan Schlosser <bsdcode@disroot.org>
AuthorDate: 2024-08-27 17:35:50 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2024-08-27 17:38:22 +0000

    emulators/ares: Update 139.20240823 → 139.20240825 and unbundle librashader dependency

    Commit changes:
    https://github.com/ares-emulator/ares/compare/3cd82c8..efb7f61

    PR:     281080

 emulators/ares/Makefile                             | 21 ++++++++++++++-------
 emulators/ares/distinfo                             |  6 +++---
 emulators/ares/files/patch-hiro_GNUmakefile (gone)  | 11 -----------
 .../ares/{files/pkg-message.in => pkg-message}      | 12 ------------
 4 files changed, 17 insertions(+), 33 deletions(-)
Comment 13 Vladimir Druzenko freebsd_committer freebsd_triage 2024-08-27 17:40:47 UTC
Thanks.