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

Suggested by:	Richard Levitte (OpenSSL project)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D53043

(cherry picked from commit 97388e7215e080f2cb9fd446f4be4e46a9aeb114)
This commit is contained in:
Enji Cooper 2025-10-11 13:47:20 -07:00 committed by Franco Fichtner
parent f19fe1bd86
commit 5fe9c6676e
4 changed files with 3 additions and 52 deletions

View file

@ -48,32 +48,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 && \

View file

@ -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");

View file

@ -1,9 +1,6 @@
.include <bsd.own.mk>
# OpenSSL version used for manual page generation
.include "Makefile.version"
LCRYPTO_SRC= ${SRCTOP}/crypto/openssl
LCRYPTO_DOC= ${LCRYPTO_SRC}/doc
@ -12,10 +9,7 @@ CFLAGS+= -I${LCRYPTO_SRC}/include
CFLAGS+= -I${LCRYPTO_SRC}/providers/common/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"

View file

@ -1,2 +0,0 @@
OPENSSL_VER= 3.0.16
OPENSSL_DATE= 2025-02-11