git: e1584ae1c5af - main - subpackages: fix minor regression

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Mon, 12 Feb 2024 13:25:00 UTC
The branch main has been updated by bapt:

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

commit e1584ae1c5af74f4ee54ee8dee74b2650dd20714
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2024-02-12 13:19:42 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2024-02-12 13:24:57 +0000

    subpackages: fix minor regression
    
    Before subpackages, when running package there where 2 cases:
    case 1: ${PACKAGES} directory exist:
      packages are created in the work/pkg directory then copies into
      ${PACKAGES} directory
    case 2: ${PACKAGES} does not exist:
      packages where only created in work/pkg
    
    After subpackages in the case 2, the packages get copied into the
      directory actually running the make package comment.
    
    This change makes the framework behave like before subpackages
    
    Reported by:    Antonio Huete Jimenez (tuxilio from Dragonfly irc
                    channel)
---
 Mk/bsd.port.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 448056ca1c17..5258bcfeb55b 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -3487,11 +3487,13 @@ ${WRKDIR_PKGFILE${_SP.${sp}}}:	${_PLIST}.${sp} create-manifest ${WRKDIR}/pkg
 
 _EXTRA_PACKAGE_TARGET_DEP+=	${WRKDIR_PKGFILE${_SP.${sp}}}
 
+.      if defined(_HAVE_PACKAGES)
 ${PKGFILE${_SP.${sp}}}: ${WRKDIR_PKGFILE${_SP.${sp}}}
 	@${LN} -f ${WRKDIR_PKGFILE${_SP.${sp}}} ${PKGFILE${_SP.${sp}}} 2>/dev/null \
 		|| ${CP} -f ${WRKDIR_PKGFILE${_SP.${sp}}} ${PKGFILE${_SP.${sp}}}
 
 _EXTRA_PACKAGE_TARGET_DEP+=	${PKGFILE${_SP.${sp}}}
+.      endif
 .    endfor
 # This will be the end of the loop