Re: git: 35db13a201c4 - main - audio/pulseaudio-module-sndio: Fix build with poudriere

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Fri, 30 Aug 2024 12:08:39 UTC
Gleb Popov <arrowd@freebsd.org> writes:

> On Thu, Aug 29, 2024 at 11:17 PM Nicola Vitale <nivit@freebsd.org> wrote:
>
>>
>> The branch main has been updated by nivit:
>>
>> URL: https://cgit.FreeBSD.org/ports/commit/?id=35db13a201c4e9314accbf051083265e45dee758
>>
>> commit 35db13a201c4e9314accbf051083265e45dee758
>> Author:     Nicola Vitale <nivit@FreeBSD.org>
>> AuthorDate: 2024-08-29 20:07:37 +0000
>> Commit:     Nicola Vitale <nivit@FreeBSD.org>
>> CommitDate: 2024-08-29 20:07:37 +0000
>>
>>     audio/pulseaudio-module-sndio: Fix build with poudriere
>>
>>     As pointed out by arrowd@, the previous patch doesn't work in poudriere
>>     "because the pkg-config executable isn't there at the time the variable
>>     value is evaluated". So put the variables in the standard position in
>>     the Makefile and fix the regular expression of sed(1).
>
> It still doesn't work, unfortunately - the order in which variables
> are defined doesn't matter here.
> The root of the problem is that pkg-config is called during the fetch
> stage, but it gets checked for as a dependency and installed during
> the later build stage.
> It works if you already have pkg-config installed, but in the
> Poudriere case we always start from an empty system.

Why not evaluate slightly later, during build phase?

diff --git a/audio/pulseaudio-module-sndio/Makefile b/audio/pulseaudio-module-sndio/Makefile
index 6c2cb3d3a3bc..6da1e3229d48 100644
--- a/audio/pulseaudio-module-sndio/Makefile
+++ b/audio/pulseaudio-module-sndio/Makefile
@@ -22,7 +22,7 @@ PLIST_FILES=	${PULSE_MODDIR}/module-sndio.so
 PULSE_MODDIR=	`${LOCALBASE}/bin/pkg-config --variable=modlibexecdir libpulse`
 PULSE_VERSION=	`${LOCALBASE}/bin/pkg-config --modversion libpulse`
 
-post-patch:
+pre-configure:
 	${REINPLACE_CMD} \
 		-e "/^PA_MODULE_VERSION/s/0.0/${PULSE_VERSION}/1" \
 		${WRKSRC}/module-sndio.c