Bug 274947 - devel/genie: update to 20230921
Summary: devel/genie: update to 20230921
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Muhammad Moinur Rahman
URL:
Keywords:
Depends on:
Blocks: 274783
  Show dependency treegraph
 
Reported: 2023-11-07 01:08 UTC by Alastair Hogge
Modified: 2023-11-23 22:05 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (bofh)


Attachments
Update to 20230921; some Makefile maintenance; patches for FreeBSD use (22.53 KB, patch)
2023-11-07 01:08 UTC, Alastair Hogge
no flags Details | Diff
Update to 20230921; some Makefile maintenance; patches for FreeBSD use (60.32 KB, patch)
2023-11-11 07:05 UTC, Alastair Hogge
no flags Details | Diff
Update to 20230921; some Makefile maintenance; patches for FreeBSD use (60.32 KB, patch)
2023-11-11 07:19 UTC, Alastair Hogge
no flags Details | Diff
Update to 20230921; some Makefile maintenance; patches for FreeBSD use (60.78 KB, patch)
2023-11-12 00:26 UTC, Alastair Hogge
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alastair Hogge 2023-11-07 01:08:55 UTC
Created attachment 246169 [details]
Update to 20230921; some Makefile maintenance; patches for FreeBSD use

Hello,

Working on unbundling GENie from emulators/mame, I noticed that devel/genie did not have the same patches that were required in MAME for GENie to correctly produce GMake projects/files.

When stock GENie from devel/genie runs, it hardcodes the use of ${ARCH} into all the GNU Makefiles that it generates, I am not sure what for, and I have noticed that both NetBSD and OpenBSD are able to use GENie like that. I thought the initial problem may have been because of FreeBSD's historic preference to use amd64 over x86_64, however, the GENie build system looks like it compensates for this.

If I use stock devel/genie for MAME, the build fails with Clang not being able to find ${ARCH}, if I modify the build to create a directory ${ARCH}, the linker fails with finding no input, or not liking finding a directory. I am not sure what exactly is the solution, however, I think FreeBSD automagically incantates the correct ISA bit width spell, so I suspect that is why the MAME port removed all references to ${ARCH} in the GENie related build configs.

So included with this update, is the following patches:
* files/patch-build_gmake.freebsd_genie.make (already part of devel/genie)
Have commented out AR, CC, and CXX in the makefile so the Ports values are inherited. Also removed the offending $(ARCH), and some -Os optimisations so not to poison the compiler environment inherited from the Ports.

* files/patch-src_host_scripts.c
This file has a mega sized const char* containing loads of predefined build-fu for all GENie supporting platforms (most of which are lumped together), here is where ${ARCH} is littered. This file eventually contributes to building the custom GNU Makefile for the Project (in this case, MAME) for the supporting platform.

* files/patch-src_tools_gcc.lua
Attempt to use compiler environment inherited from Ports again.

Thanks.
Comment 1 Alastair Hogge 2023-11-10 02:30:10 UTC
The patch for src/host/scripts.c is wrong, and requires more thought. Removing $(ARCH) from all these places, just causing GENie to drop it's buildoptions and linktoptions from the generated makefiles. The reason why the MAME Port got away with it, was because the Ports would populate the make environment with everything required to build.
Comment 2 Alastair Hogge 2023-11-10 11:26:11 UTC
I am working on a patch that is created from 'genie embed', which creates a clean 'src/host/scripts.c' used for makefile generation.
Comment 3 Alastair Hogge 2023-11-11 07:05:44 UTC
Created attachment 246238 [details]
Update to 20230921; some Makefile maintenance; patches for FreeBSD use

OK, so instead of patching the release assets that come with GENie, I have patched GENie to produce the correct assets from the embed and release scripts. Those artifacts are used to create the patches in files/

To build the assets, GENie is required. Information in the distribution refer to premake4, however, I think that may be a typo and should be genie:
> $ cd to ${WRKSRC}/scripts;
> $ /usr/local/bin/genie /scripts=../src/ embed
> $ env _PREMAKE_COMMAND=genie /usr/local/bin/genie /scripts=../src/ release

Thanks.
Comment 4 Alastair Hogge 2023-11-11 07:19:52 UTC
Created attachment 246239 [details]
Update to 20230921; some Makefile maintenance; patches for FreeBSD use

Updated patch to use ${DISTVERSION} over ${PORTVERSION}.
Comment 5 Alastair Hogge 2023-11-12 00:26:54 UTC
Created attachment 246252 [details]
Update to 20230921; some Makefile maintenance; patches for FreeBSD use

Attempt to improve commit log.
Comment 6 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2023-11-22 22:48:11 UTC
Testing and will commit in a few days on my next batch.
Comment 7 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2023-11-22 22:56:01 UTC
Next time please fix commit-msgs to fit in 72 characters before submitting unless not extremely required like for Changelog URLS.
Comment 8 Alastair Hogge 2023-11-23 09:26:09 UTC
Ah damn, sorry about the wide columns in the commit message, thanks for the reminder, and for adding this report to your workload.
Comment 9 commit-hook freebsd_committer freebsd_triage 2023-11-23 22:04:05 UTC
A commit in branch main references this bug:

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

commit c62bdd591140f038cdc47fe238483fd91ee067f8
Author:     Alastair Hogge <agh@riseup.net>
AuthorDate: 2023-11-22 22:51:51 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2023-11-23 22:02:57 +0000

    devel/genie: Update version g2020082801=>g20230921

    - Pet port{clippy,fmt,lint} hints
    - Add DEBUG option to Port
    - GENie releases come with pre-rolled assets used for project
      generation, this means GNU makefiles configured to build GENie, and
      created for User projects, include hard coded architecture
      information, including compiler platform options (-m64). Remove hard
      coded information, as well as any -O optimisation that are fouling
      with the Ports framework. Patch the GENie sources to produce sanitised
      output fit for consumers of the Port, and use the assets produced from
      the build to create the needed patches in files/

    PR:             274947

 devel/genie/Makefile                               | 23 ++++--
 devel/genie/distinfo                               |  6 +-
 .../files/patch-build_gmake.freebsd_genie.make     | 93 ++++++++++++++--------
 devel/genie/files/patch-scripts_genie.lua (new)    | 20 +++++
 devel/genie/files/patch-scripts_release.lua (new)  | 22 +++++
 .../patch-src_actions_make_make__cpp.lua (new)     | 61 ++++++++++++++
 devel/genie/files/patch-src_host_scripts.c (new)   | 55 +++++++++++++
 devel/genie/files/patch-src_host_version.h (new)   |  8 ++
 devel/genie/files/patch-src_tools_gcc.lua (new)    | 24 ++++++
 9 files changed, 272 insertions(+), 40 deletions(-)