Re: git: 756ff0a53c87 - main - sysutils/msktutil: Fix build for FreeBSD >= 15

From: Daniel Engberg <diizzy_at_FreeBSD.org>
Date: Thu, 23 Jul 2026 03:07:55 UTC
On 2026-07-23 03:14, Joseph Mingrone wrote:
> On Wed, 2026-07-22 at 19:01, Daniel Engberg <diizzy@FreeBSD.org> wrote:
> 
>> On 2026-07-22 17:35, Joseph Mingrone wrote:
>>> On Wed, 2026-07-22 at 00:39, Daniel Engberg <diizzy@FreeBSD.org> wrote:
> 
>>>> On 2026-07-22 00:33, Joseph Mingrone wrote:
>>>>> On Tue, 2026-07-21 at 17:59, "Dan Langille" <dan@langille.org> wrote:
> 
>>>>>> On Tue, Jul 21, 2026, at 5:19 PM, Daniel Engberg wrote:
>>>>>>> On 2026-07-21 22:26, Dan Langille wrote:
>>>>>>>> The branch main has been updated by dvl:
> 
>>>>>>>> URL: https://cgit.FreeBSD.org/ports/commit/?id=756ff0a53c87b6de3bd7303db91756615985e785
> 
>>>>>>>> commit 756ff0a53c87b6de3bd7303db91756615985e785
>>>>>>>> Author:     Dan Langille <dvl@FreeBSD.org>
>>>>>>>> AuthorDate: 2026-07-21 20:24:52 +0000
>>>>>>>> Commit:     Dan Langille <dvl@FreeBSD.org>
>>>>>>>> CommitDate: 2026-07-21 20:25:56 +0000
> 
>>>>>>>>         sysutils/msktutil: Fix build for FreeBSD >= 15
> 
>>>>>>>>         * Take maintainership
>>>>>>>>         * While here, portfmt
> 
>>>>>>>>         PR:             292735
>>>>>>>> ---
>>>>>>>>      sysutils/msktutil/Makefile | 20 ++++++++++++--------
>>>>>>>>      1 file changed, 12 insertions(+), 8 deletions(-)
> 
>>>>>>> Port doesn't build after this change using Ports tree because it's
>>>>>>> missing inclusion of bsd.port.options.mk as documented in Porters Handbook.
>>>>>>> https://docs.freebsd.org/en/books/porters-handbook/book/#slow-patch-extra
> 
>>>>>>> Variable "OPSYS" is undefined
> 
>>>>>> Thank you. I've been working on it. It passed both poudriere testport and bulk.
>>>>> Hi Dan(iel)?,
>>>>> Maybe you can detect Kerberos the same way the framework does.
>>>>> Mk/Uses/gssapi.mk:93 decides whether base Kerberos is MIT or Heimdal
>>>>> with exists(/usr/libdata/pkgconfig/mit-krb5.pc), and exists() works at
>>>>> parse time with no framework variables.
>>>>> GSSAPI_BASE_USES=	gssapi
>>>>> .if exists(/usr/libdata/pkgconfig/mit-krb5.pc)
>>>>> GSSAPI_BASE_CONFIGURE_ON=	--with-krb5=mit
>>>>> .else
>>>>> GSSAPI_BASE_CONFIGURE_ON=	--with-krb5=heimdal
>>>>> .endif
>>>>> Joe
>>> Hello Daniel,
> 
>>>> While possible I'm not very fond of these since they tend to get stale and we already have a good established way of pruning checks based on version aka rene@.
>>> I didn't have a lot of time to research solutions, hence "Maybe you
>>> can...".  I'm unsure what you mean by "aka rene."  I don't see any
>>> messages from rene@ in this thread.
> 
>> rene@ periodically prunes the tree for obsolete version checks. There nothing done for if exist and it's really hard to easily find ones since we don't have defined list.
> 
>>> On Tue, 2026-07-21 at 23:19, Daniel Engberg <diizzy@FreeBSD.org> wrote:
>>>> Port doesn't build after this change using Ports tree because it's missing inclusion of bsd.port.options.mk as documented in Porters Handbook.
>>>> https://docs.freebsd.org/en/books/porters-handbook/book/#slow-patch-extra
>>> As Dan discovered, simply adding .include <bsd.port.options.mk> above
>>> the .if won't work here.  GSSAPI_BASE_CONFIGURE_ON, assigned after the
>>> include, will get set to --with-krb5=mit, but CONFIGURE_ARGS will not
>>> contain --with-krb5=mit.  No warning, no error.
> 
>> Because ordering is wrong, as shown in Porters Handbook which I linked to.
> 
> Daniel,
> 
> You must be referring to this example, since it's the only one with a .include:
> 
> .include <bsd.port.options.mk>
> 
> .if ${OPSYS} == FreeBSD && ${OSVERSION} < 1100069
> EXTRA_PATCHES=	${PATCHDIR}/extra-patch-fbsd10
> .endif
> 
> .include <bsd.port.mk>
> 
> This does not show what you claim.  This particular example works
> because EXTRA_PATCHES is a plain variable the framework reads later.
> GSSAPI_BASE_CONFIGURE_ON is an option helper, and helpers are flattened
> into CONFIGURE_ARGS in bsd.port.options.mk.  A helper assigned after
> that include is silently ignored.
> 
> Simply suggesting Dan follow the handbook was not actionable advice
> here.  If you believe the handbook covers this case, please quote the
> part that does.
> 
> That said, your general argument makes sense (to me) now.  Dan, if you
> agree, after the ports tree thaws, you could use arrowd's suggestion
> from IRC, that uses a lazily-expanded variable.
> 
>> arrowd wrote on IRC:
>> First GSSAPI_BASE_CONFIGURE_ON=${MIT_OR_HEIMDAL} and then set MIT_OR_HEIMDAL conditionally after .include
> 
> GSSAPI_BASE_USES=		gssapi
> GSSAPI_BASE_CONFIGURE_ON=	${MIT_OR_HEIMDAL}
> 
> .include <bsd.port.options.mk>
> 
> .if ${OPSYS} == FreeBSD && ${OSVERSION} < 1500047
> MIT_OR_HEIMDAL=	--with-krb5=heimdal
> .else
> MIT_OR_HEIMDAL=	--with-krb5=mit
> .endif
> 
> On 16-CURRENT this parses and puts --with-krb5=mit into CONFIGURE_ARGS.
> 
> Joe

I posted this in another reply but this is a bit clearer and doesn't 
introduce more variables.

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MGSSAPI_BASE} && (${OPSYS} == FreeBSD && ${OSVERSION} 
< 1500047)
CONFIGURE_ARGS+=        --with-krb5=heimdal
.else
CONFIGURE_ARGS+=        --with-krb5=mit
.endif

Best regards,
Daniel