Bug 274272 - usr.bin/bmake: does not create make if tests dir does not exist
Summary: usr.bin/bmake: does not create make if tests dir does not exist
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 13.2-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-05 01:56 UTC by Ivan Rozhuk
Modified: 2023-11-03 11:37 UTC (History)
4 users (show)

See Also:


Attachments
patch (842 bytes, patch)
2023-10-05 02:49 UTC, Ivan Rozhuk
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Rozhuk 2023-10-05 01:56:42 UTC
/usr/src/usr.bin/bmake/Makefile.inc
...
.if exists(${.CURDIR}/tests)
PROG= make
.if ${PROGNAME:U} != "bmake"
LINKS= ${BINDIR}/make ${BINDIR}/bmake
MLINKS= ${MAN} b${MAN}
.endif
.endif
...

This looks strange, FreeBSD relies that 'make' always exist.

As far I understand from git history, probably it should be:
.if exists(${.CURDIR}/tests)
PROG= make
.endif

.if ${PROGNAME:U} != "bmake"
LINKS= ${BINDIR}/make ${BINDIR}/bmake
MLINKS= ${MAN} b${MAN}
.endif
Comment 1 Ivan Rozhuk 2023-10-05 02:49:05 UTC
Created attachment 245442 [details]
patch

Not sure that it correct patch, I do not test it with TESTS, only normal build+install without tests dir.
Comment 2 Simon J. Gerraty freebsd_committer freebsd_triage 2023-10-05 21:13:08 UTC
Sorry I don't understand the problem here.
The guard `exists(${.CURDIR}/tests)` is to avoid settings that are inappropriate  when in the tests directory.

usr.bin/bmake/tests should always exist whether you want to build TESTS or not.
If that directory does not, that is the problem to fix.
Comment 3 Ivan Rozhuk 2023-10-05 21:54:59 UTC
(In reply to Simon J. Gerraty from comment #2)

It is my local problem, it is out of usual FreeBSD sources use cases.

Software certification requires to provide source files that was really used during build: compiled or copied to distribution.
We use ktrace + custom parser to find out files that was open+read/fstat/mmap/copy_file, next we copy files from this list to new dir and try to build FreeBSD to ensure that nothing miss.

At this time there is only small number of issues that breaks this, another one: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=274273

All this looks simple to fix, patch is simple workaround that we use.
Comment 4 Simon J. Gerraty freebsd_committer freebsd_triage 2023-10-06 23:17:33 UTC
Simply changing the condition to

`.if ${.CURDIR:M*make} != ""`

would preserve the original intent and also meet your goal