Commit 3bc23e1d24 for openssl.org
commit 3bc23e1d2470ad1366c17fcb784e4a4daec4d6f2
Author: Richard Levitte <levitte@openssl.org>
Date: Sat Oct 11 06:53:18 2025 +0200
Slight enhancement of commentary for exported configurations
There's a misunderstanding regarding the use of .pc and .cmake files
found in the top of the build tree vs in its 'exporters' subdirectory.
Some added commentary, especially in the files being produced, might
help clarify their uses.
Resolves: https://github.com/openssl/openssl/issues/28803
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Mar 26 15:19:09 2026
(Merged from https://github.com/openssl/openssl/pull/28858)
diff --git a/build.info b/build.info
index fdcccb46da..de909255e1 100644
--- a/build.info
+++ b/build.info
@@ -464,12 +464,10 @@ IF[{- $config{target} =~ /^(?:Cygwin|mingw|VC-|BC-)/ -}]
SHARED_SOURCE[libssl]=libssl.rc
ENDIF
-# This file sets the build directory up for CMake inclusion
-# Note: This generation of OpenSSLConfig[Version].cmake is used
-# for building openssl locally, and so the build variables are
-# taken from builddata.pm rather than installdata.pm. For exportable
-# versions of these generated files, you'll find them in the exporters
-# directory
+# These files set the build directory up for CMake inclusion.
+# To achieve this, their variables are taken from builddata.pm.
+# These files are not installed; you will find the installable
+# versions in the 'exporters' directory.
GENERATE[OpenSSLConfig.cmake]=exporters/cmake/OpenSSLConfig.cmake.in
DEPEND[OpenSSLConfig.cmake]=builddata.pm
GENERATE[OpenSSLConfigVersion.cmake]=exporters/cmake/OpenSSLConfigVersion.cmake.in
@@ -477,7 +475,10 @@ DEPEND[OpenSSLConfigVersion.cmake]=builddata.pm
DEPEND[OpenSSLConfigVersion.cmake]=OpenSSLConfig.cmake
DEPEND[""]=OpenSSLConfigVersion.cmake
-# This file sets the build directory up for pkg-config
+# These files set the build directory up for pkg-config use.
+# To achieve this, their variables are taken from builddata.pm.
+# These files are not installed; you will find the installable
+# versions in the 'exporters' directory.
GENERATE[libcrypto.pc]=exporters/pkg-config/libcrypto.pc.in
DEPEND[libcrypto.pc]=builddata.pm
GENERATE[libssl.pc]=exporters/pkg-config/libssl.pc.in
@@ -487,6 +488,7 @@ DEPEND[openssl.pc]=builddata.pm
DEPEND[openssl.pc]=libcrypto.pc libssl.pc
GENERATE[builddata.pm]=util/mkinstallvars.pl \
+ COMMENT="This file should be used when building against this OpenSSL build, and should never be installed" \
PREFIX=. BINDIR=apps APPLINKDIR=ms \
LIBDIR= INCLUDEDIR=include "INCLUDEDIR=$(SRCDIR)/include" \
MODULESDIR=providers \
diff --git a/exporters/cmake/OpenSSLConfig.cmake.in b/exporters/cmake/OpenSSLConfig.cmake.in
index 07b7a3e4df..4970528573 100644
--- a/exporters/cmake/OpenSSLConfig.cmake.in
+++ b/exporters/cmake/OpenSSLConfig.cmake.in
@@ -1,4 +1,5 @@
# Generated by OpenSSL
+# {- $OpenSSL::safe::installdata::COMMENT // "" -}
{-
use lib catdir($config{sourcedir}, 'Configurations');
use platform;
diff --git a/exporters/cmake/OpenSSLConfigVersion.cmake.in b/exporters/cmake/OpenSSLConfigVersion.cmake.in
index b1290a9eec..15bae56972 100644
--- a/exporters/cmake/OpenSSLConfigVersion.cmake.in
+++ b/exporters/cmake/OpenSSLConfigVersion.cmake.in
@@ -1,4 +1,5 @@
# Generated by OpenSSL
+# {- $OpenSSL::safe::installdata::COMMENT // "" -}
set(PACKAGE_VERSION {- $config{version} -})
diff --git a/exporters/pkg-config/libcrypto.pc.in b/exporters/pkg-config/libcrypto.pc.in
index cb00b749d1..b0481093a1 100644
--- a/exporters/pkg-config/libcrypto.pc.in
+++ b/exporters/pkg-config/libcrypto.pc.in
@@ -1,3 +1,4 @@
+# {- $OpenSSL::safe::installdata::COMMENT // "" -}
prefix={- $OpenSSL::safe::installdata::PREFIX[0] -}
exec_prefix=${prefix}
libdir={- if (defined $OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0]) {
diff --git a/exporters/pkg-config/libssl.pc.in b/exporters/pkg-config/libssl.pc.in
index f73be2e9f2..50132b7502 100644
--- a/exporters/pkg-config/libssl.pc.in
+++ b/exporters/pkg-config/libssl.pc.in
@@ -1,3 +1,4 @@
+# {- $OpenSSL::safe::installdata::COMMENT // "" -}
prefix={- $OpenSSL::safe::installdata::PREFIX[0] -}
exec_prefix=${prefix}
libdir={- if (defined $OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0]) {
diff --git a/exporters/pkg-config/openssl.pc.in b/exporters/pkg-config/openssl.pc.in
index d41eea7e3a..3573ed9872 100644
--- a/exporters/pkg-config/openssl.pc.in
+++ b/exporters/pkg-config/openssl.pc.in
@@ -1,3 +1,4 @@
+# {- $OpenSSL::safe::installdata::COMMENT // "" -}
prefix={- $OpenSSL::safe::installdata::PREFIX[0] -}
exec_prefix=${prefix}
libdir={- if (defined $OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0]) {
diff --git a/util/mkinstallvars.pl b/util/mkinstallvars.pl
index 6588c5f230..b0674acad0 100644
--- a/util/mkinstallvars.pl
+++ b/util/mkinstallvars.pl
@@ -29,7 +29,7 @@ my @subdirs = _pairs (PREFIX => [ qw(BINDIR LIBDIR INCLUDEDIR APPLINKDIR) ],
LIBDIR => [ qw(MODULESDIR PKGCONFIGDIR
CMAKECONFIGDIR) ]);
# For completeness, other expected variables
-my @others = qw(VERSION LDLIBS);
+my @others = qw(COMMENT VERSION LDLIBS);
my %all = ( );
foreach (@absolutes) { $all{$_} = 1 }
@@ -135,9 +135,10 @@ foreach my $pair (@subdirs) {
}
print <<_____;
- \$VERSION \@LDLIBS
+ \$COMMENT \$VERSION \@LDLIBS
);
+our \$COMMENT = '$values{COMMENT}->[0]';
_____
foreach my $k (@absolutes) {