Re: git: 145ca5487348 - main - audio/openal-soft: fix build with lld 15 on i386

From: Tijl Coosemans <tijl_at_FreeBSD.org>
Date: Sun, 25 Dec 2022 22:29:54 UTC
On Sun, 25 Dec 2022 23:19:10 +0100 Dimitry Andric <dim@FreeBSD.org>
wrote:
> On 25 Dec 2022, at 21:13, Dima Panov <fluffy@freebsd.org> wrote:
>> On 25.12.2022 20:54, Dimitry Andric wrote:  
>>> The branch main has been updated by dim (src committer):
>>> URL: https://cgit.FreeBSD.org/ports/commit/?id=145ca54873489e7d45eac99de62f733a54dc294d
>>> commit 145ca54873489e7d45eac99de62f733a54dc294d
>>> Author:     Dimitry Andric <dim@FreeBSD.org>
>>> AuthorDate: 2022-12-20 22:28:41 +0000
>>> Commit:     Dimitry Andric <dim@FreeBSD.org>
>>> CommitDate: 2022-12-25 17:53:21 +0000
>>>     audio/openal-soft: fix build with lld 15 on i386
>>>   
>> [skip]
>>   
>>> +.include <bsd.port.pre.mk>
>>> +
>>> +# The following is actually meant for lld 15.0 and later, but the ports
>>> +# framework does not support LINKER_TYPE and LINKER_VERSION yet.
>>> +.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 150
>>> +# Turn off checking of dynamic relocations, to avoid lld diagnostics about
>>> +# possibly incorrect addend values.
>>> +LDFLAGS_i386+= -Wl,--no-check-dynamic-relocations
>>> +.endif
>>> +
>>>  PLIST_SUB= SOVERSION=${PORTVERSION}
>>>    OPTIONS_DEFINE= CONFIG EXAMPLES JACK OSS PORTAUDIO PULSEAUDIO \  
>> 
>> Looks like 1) misplased .pre.mk include and corresponding section
>> 2) not closed with .post.mk
>> 
>> This breaks OPTIONS settings (always sets to off due misconfig) and
>> caused unneded rebuild of consumers
> 
> I'm not a ports wizard, so could you enlighten me what the correct
> incantation of the various *.mk files is? I.e., first bsd.port.pre.mk,
> then where should bsd.port.post.mk be put?
> 
> The reason I put bsd.port.pre.mk there is that without it, the ports
> framework does not fill the COMPILER_TYPE and COMPILER_VERSION
> variables, even though the port Makefile has "USES=compiler". As far as
> I can see in other ports Makefiles, this is solved by including
> bsd.port.pre.mk before the first use of those variables.

Put ".include <bsd.port.pre.mk>" and the .if block right before the
post-patch target.  Replace ".include <bsd.port.mk>" with ".include
<bsd.port.post.mk>".