Bug 267980 - emulators/qmc2: Fails to build on systems <13.x—SDL.h not found
Summary: emulators/qmc2: Fails to build on systems <13.x—SDL.h not found
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: Nuno Teixeira
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-25 03:15 UTC by Alastair Hogge
Modified: 2022-12-05 09:43 UTC (History)
2 users (show)

See Also:
agh: maintainer-feedback+


Attachments
qmc2.patch (1.62 KB, patch)
2022-12-03 12:04 UTC, Alastair Hogge
agh: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 Alastair Hogge 2022-11-25 03:29:55 UTC
I am currently trying to reproduce this on my system. 14-CURRENT host with a 12.3 guest.
Comment 2 Alastair Hogge 2022-11-25 03:32:53 UTC
More logs:

https://portsfallout.com/fallout?port=emulators%2Fqmc2&maintainer=&env=&
category=&flavor=
Comment 3 Alastair Hogge 2022-11-26 09:26:19 UTC
${INCLUDEPATH} is not being set on build hosts <14-CURRENT
Comment 4 Alastair Hogge 2022-11-30 13:16:18 UTC
Correction fails on <13
Comment 5 Alastair Hogge 2022-11-30 13:20:53 UTC
${WRKDIR}/qmc2-mame-fe-0.243/scripts/sdl-includepath.sh produces an empty string, when it should produce the following:
/usr/local/include/SDL2
/usr/local/include

Those file paths are meant to populate ${INCLUDEPATH}.
Comment 6 Alastair Hogge 2022-11-30 23:12:42 UTC
From https://github.com/qmc2/qmc2-mame-fe/blob/master/scripts/sdl-includepath.sh:

echo $SDL_CFLAGS | egrep -o -e "\\-I\\S+" | sed -e 's/^-I//'

Appears to be failing on egrep. Prior to the pipe to egrep, ${SDL_CFLAGS} expands to:

-I/usr/local/include/SDL2 -I/usr/local/include -D_REENTRANT -D_THREAD_SAFE

I think egrep is meant to remove the -I, the trailing whitespace, and the -D_* flags.
Comment 7 Alastair Hogge 2022-11-30 23:47:14 UTC
egrep is throwing out error code 1.
Comment 8 Alastair Hogge 2022-12-03 07:55:10 UTC
egrep on the build guests <13.x is perhaps too old and does not have the expected Special Expressions found in the grep with guests ≥13.x.

12.3-RELEASE:
$ grep --version
grep (GNU grep) 2.5.1-FreeBSD

14-CURRENT:
$ grep --version
grep (BSD grep, GNU compatible) 2.6.0-FreeBSD

I do not think the GNU grep in the 12.3 build guest has the support for the \S Special Expression. I have tested the build with the following change to ${WRKDIR}/qmc2-mame-fe-0.243/scripts/sdl-includepath.sh:

echo $SDL_CFLAGS | egrep -o -e "-I[^[:space:]]+" | sed -e 's/^-I//'

The build completes.
Comment 9 Alastair Hogge 2022-12-03 12:04:57 UTC
Created attachment 238499 [details]
qmc2.patch

• Update ${RUN_DEPENDS} to reflect current mame/mess versions
• Add two more files to ${SHEBANG_FILES}
• Add ${EXTRA_PATCHES} conditional to compensate for missing \S Special Expression support in GNU grep on system <13.x (if that is even the problem)
• Add files/extra-scripts-sdl-includepaths to patch ${WRKSRC}/scripts/sdl-includepath.sh

I am waiting on the poudriere-testport to finish, I am also not sure if the attached is the correct way to solve this problem.
Comment 10 Alastair Hogge 2022-12-03 22:24:17 UTC
pourdriere-testport build passed.
Comment 11 commit-hook freebsd_committer freebsd_triage 2022-12-05 09:39:11 UTC
A commit in branch main references this bug:

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

commit 8674ebc2a72d77bca1d4fc1438a6b986184e7c75
Author:     Alastair Hogge <agh@riseup.net>
AuthorDate: 2022-12-05 09:34:49 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2022-12-05 09:37:53 +0000

    emulators/qmc2: Fix build on systems <13.x: SDL.h not found

    * Update ${RUN_DEPENDS} to reflect current mame/mess versions
    * Add two more files to ${SHEBANG_FILES}
    * Add ${EXTRA_PATCHES} conditional to compensate for missing \S Special
      Expression support in GNU grep on system <13.x (if that is even the problem)
    * Add files/extra-scripts-sdl-includepaths to patch
      ${WRKSRC}/scripts/sdl-includepath.sh

    PR:             267980

 emulators/qmc2/Makefile                                   | 11 +++++++++--
 emulators/qmc2/files/extra-scripts-sdl-includepaths (new) |  9 +++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)
Comment 12 Nuno Teixeira freebsd_committer freebsd_triage 2022-12-05 09:41:15 UTC
Nice work!

Committed, thank you!
Comment 13 Alastair Hogge 2022-12-05 09:43:52 UTC
Hi Nuno,

Thanks very much for that.