git: c7e073a677e7 - main - ports-mgmt/pkg: fix regression in pkg-static and version number

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Mon, 13 Feb 2023 08:10:02 UTC
The branch main has been updated by bapt:

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

commit c7e073a677e754db2247a179524bcda3bc9f42c6
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2023-02-13 08:07:57 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2023-02-13 08:09:56 +0000

    ports-mgmt/pkg: fix regression in pkg-static and version number
    
    When adding the support for static PIE, we masked the actually
    STATIC_ARGS making pkg-static a dynamic binary in all other cases.
    
    While here fix the version numbering which was not updated properly
    during the release process.
---
 ports-mgmt/pkg/Makefile             |  5 ++++-
 ports-mgmt/pkg/files/patch-auto.def | 11 +++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/ports-mgmt/pkg/Makefile b/ports-mgmt/pkg/Makefile
index 5e70aeb1471c..5b8e69da2486 100644
--- a/ports-mgmt/pkg/Makefile
+++ b/ports-mgmt/pkg/Makefile
@@ -24,7 +24,6 @@ CONFIGURE_ENV=	CC_FOR_BUILD="${CC}"
 USE_SUBMAKE=	yes
 CFLAGS+=	-Wno-error
 CFLAGS_powerpc64le=	-DSQLITE_BYTEORDER=1234
-MAKE_ARGS+=	STATIC_ARG="${STATIC_PIE_ARG}"
 
 OPTIONS_DEFINE=	DOCS
 
@@ -38,6 +37,10 @@ EXTRA_PATCHES=	${FILESDIR}/extra-patch-docs_pkg.8
 MAKE_ARGS+=	DEBUG_FLAGS="${DEBUG_FLAGS}"
 .endif
 
+.if defined(WITH_PIE)
+MAKE_ARGS+=	STATIC_ARG="-static ${STATIC_PIE_ARGS}"
+.endif
+
 .if defined(WITH_PKG)
 .if ${WITH_PKG} == devel
 IGNORE=	WITH_PKG is defined to 'devel', this version is the stable one
diff --git a/ports-mgmt/pkg/files/patch-auto.def b/ports-mgmt/pkg/files/patch-auto.def
new file mode 100644
index 000000000000..f6e9bdb88b96
--- /dev/null
+++ b/ports-mgmt/pkg/files/patch-auto.def
@@ -0,0 +1,11 @@
+--- auto.def.orig	2023-02-01 15:55:57 UTC
++++ auto.def
+@@ -5,7 +5,7 @@ set med_ver 19
+ 
+ set maj_ver 1
+ set med_ver 19
+-set min_ver 0
++set min_ver 1
+ set dev_ver 0
+ define PKG_API [expr $maj_ver * 1000000 + $med_ver * 1000 + $min_ver]
+ define VERSION $maj_ver.$med_ver.$min_ver[expr {$dev_ver ? ".$dev_ver" : ""}]