git: f7717bbe1350 - releng/15.0 - OpenSSL: install .pc files from the exporters subdir

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Wed, 05 Nov 2025 19:37:44 UTC
The branch releng/15.0 has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=f7717bbe1350323289a94aaebe49b2a0d26c5ece

commit f7717bbe1350323289a94aaebe49b2a0d26c5ece
Author:     Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2025-10-11 20:47:20 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-11-05 19:37:11 +0000

    OpenSSL: install .pc files from the exporters subdir
    
    The .pc files generated in the root directory are used as part of the
    build; they should never be installed. Use the versions from the
    exporters subdirectory--which should be installed--as the .pc files
    which are distributed with FreeBSD. This avoids the need for "fixing up"
    these files after the fact (see `crypto/openssl/BSDmakefile` for more
    details as part of this change).
    
    Garbage collect `secure/lib/libcrypto/Makefile.version`, et al,
    as they're orphaned files. They were technically unused prior to this
    change as the vendor process properly embeds the version numbers in
    various files, but this commit formalizes the removal.
    
    This correction/clarification on the .pc files will be made in an
    upcoming release of OpenSSL [1].
    
    References:
    1. https://github.com/openssl/openssl/issues/28803
    
    Approved by:    re (cperciva)
    Suggested by:   Richard Levitte (OpenSSL project)
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D53043
    
    (cherry picked from commit 97388e7215e080f2cb9fd446f4be4e46a9aeb114)
    (cherry picked from commit 9b84a17c0adc85f32eb6a284011730f5d645fd2c)
---
 crypto/openssl/BSDmakefile                          | 20 --------------------
 .../openssl/freebsd/dump_version_from_configdata.pl | 21 ---------------------
 secure/lib/libcrypto/Makefile.inc                   | 12 +++---------
 secure/lib/libcrypto/Makefile.version               |  2 --
 4 files changed, 3 insertions(+), 52 deletions(-)

diff --git a/crypto/openssl/BSDmakefile b/crypto/openssl/BSDmakefile
index 514c87ae3a8e..c6b539be0432 100644
--- a/crypto/openssl/BSDmakefile
+++ b/crypto/openssl/BSDmakefile
@@ -43,32 +43,12 @@ configure:
 	    enable-sctp \
 	    --openssldir=etc \
 	    --prefix=/usr)
-	@echo "Building configdata.pm for later use."
-	@(cd ${.CURDIR} && \
-	    ${SETENVI} ${WRK_ENV} ${GMAKE} -j ${.MAKE.JOBS} configdata.pm)
-
-	@echo "Populating Makefile.version with release information"
-	@(cd ${LCRYPTO_SRC} && ${SETENVI} ${WRK_ENV} ${PERL} \
-	     ${LCRYPTO_SRC}/freebsd/dump_version_from_configdata.pl > \
-	     ${SRCTOP}/secure/lib/libcrypto/Makefile.version)
 
 all: patch
 	@echo "==> Building generated files (headers, manpages, etc)"
 	@(cd ${.CURDIR} && \
 	     ${SETENVI} ${WRK_ENV} ${GMAKE} -j ${.MAKE.JOBS} build_all_generated)
 
-	# 1. Fix --prefix.
-	#    a. Not sure why --prefix isn't honored properly, even though it's
-	#       passed to Configure; the files might be getting rebuilt
-	#       post-Configure, somehow.
-	# 2. Remove duplicate path in CFLAGS.
-	# 3. Remove duplicate path in includedir(s).
-	@echo "==> Fixing pkgconfig files"
-	@find . -name \*.pc -print -exec sed -i '' -E \
-	    -e 's,^prefix=.+,prefix=/usr,' \
-	    -e 's,[[:space:]]+(\-I)?\$\{prefix\}/\./include[[:space:]]*,,g' \
-	    {} +
-
 	@echo "==> Cleaning / rebuilding ASM"
 	@(cd ${SRCTOP}/secure/lib/libcrypto && \
 	     ${SETENVI} ${WRK_ENV} ${MAKE} cleanasm && \
diff --git a/crypto/openssl/freebsd/dump_version_from_configdata.pl b/crypto/openssl/freebsd/dump_version_from_configdata.pl
deleted file mode 100644
index b6137718ba54..000000000000
--- a/crypto/openssl/freebsd/dump_version_from_configdata.pl
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env perl
-#
-# This dumps out the values needed to generate manpages and other artifacts
-# which include the release version/date.
-#
-# See also: `secure/lib/libcrypto/Makefile.version`.
-
-use Cwd qw(realpath);
-use File::Basename qw(dirname);
-use Time::Piece;
-
-use lib dirname(dirname(realpath($0)));
-
-use configdata qw(%config);
-
-$OPENSSL_DATE = Time::Piece->strptime($config{"release_date"}, "%d %b %Y")->strftime("%Y-%m-%d");
-
-$OPENSSL_VER = "$config{'major'}.$config{'minor'}.$config{'patch'}";
-
-print("OPENSSL_VER=\t${OPENSSL_VER}\n");
-print("OPENSSL_DATE=\t${OPENSSL_DATE}\n");
diff --git a/secure/lib/libcrypto/Makefile.inc b/secure/lib/libcrypto/Makefile.inc
index 4d5e9c68a1fe..5b281166df61 100644
--- a/secure/lib/libcrypto/Makefile.inc
+++ b/secure/lib/libcrypto/Makefile.inc
@@ -3,9 +3,6 @@
 PACKAGE=	openssl
 LIB_PACKAGE=
 
-# OpenSSL version used for manual page generation
-.include "Makefile.version"
-
 LCRYPTO_SRC=	${SRCTOP}/crypto/openssl
 LCRYPTO_DOC=	${LCRYPTO_SRC}/doc
 
@@ -15,10 +12,7 @@ CFLAGS+=	-I${LCRYPTO_SRC}/providers/common/include
 CFLAGS+=	-I${LCRYPTO_SRC}/providers/fips/include
 CFLAGS+=	-I${LCRYPTO_SRC}/providers/implementations/include
 
-.include "Makefile.common"
+.SUFFIXES: .pc
+.PATH.pc:	${LCRYPTO_SRC}/exporters
 
-.for pcfile in ${PCFILES}
-${pcfile}:	${pcfile}.in
-	sed -e 's,@openssl_ver@,${OPENSSL_VER},g' ${.ALLSRC} > ${.TARGET}
-.endfor
-CLEANFILES+=	${PCFILES}
+.include "Makefile.common"
diff --git a/secure/lib/libcrypto/Makefile.version b/secure/lib/libcrypto/Makefile.version
deleted file mode 100644
index 81636b8adfe8..000000000000
--- a/secure/lib/libcrypto/Makefile.version
+++ /dev/null
@@ -1,2 +0,0 @@
-OPENSSL_VER=	3.5.4
-OPENSSL_DATE=	2025-09-30