Skip to content

Commit

Permalink
Fix pkgconfig files
Browse files Browse the repository at this point in the history
  • Loading branch information
theoparis committed Oct 10, 2024
1 parent 49215e8 commit 1773266
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1258,6 +1258,11 @@ set(VERSION 1.1.1)
# the downstream integration may build with the system's OpenSSL version instead.
# Consider adjusting the PKG_CONFIG_PATH environment to get around this.
file(GLOB OPENSSL_PKGCONFIGS "pkgconfig/*.pc.in")

include(cmake/JoinPaths.cmake)
join_paths(libdir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_LIBDIR}")
join_paths(includedir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")

foreach(in_file ${OPENSSL_PKGCONFIGS})
file(RELATIVE_PATH in_file ${PROJECT_SOURCE_DIR} ${in_file})
string(REPLACE ".in" "" pc_file ${in_file})
Expand Down
23 changes: 23 additions & 0 deletions cmake/JoinPaths.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This module provides function for joining paths
# known from most languages
#
# SPDX-License-Identifier: (MIT OR CC0-1.0)
# Copyright 2020 Jan Tojnar
# https://github.com/jtojnar/cmake-snips
#
# Modelled after Python’s os.path.join
# https://docs.python.org/3.7/library/os.path.html#os.path.join
function(join_paths joined_path first_path_segment)
set(temp_path "${first_path_segment}")
foreach(current_segment IN LISTS ARGN)
if(NOT ("${current_segment}" STREQUAL ""))
if(IS_ABSOLUTE "${current_segment}")
set(temp_path "${current_segment}")
else()
set(temp_path "${temp_path}/${current_segment}")
endif()
endif()
endforeach()
file(TO_NATIVE_PATH "${temp_path}" temp_path)
set(${joined_path} "${temp_path}" PARENT_SCOPE)
endfunction()
4 changes: 2 additions & 2 deletions pkgconfig/libcrypto.pc.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
prefix=@CMAKE_INSTALL_PREFIX@
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
libdir=@libdir_for_pc_file@
includedir=@includedir_for_pc_file@

Name: AWS-LC-libcrypto
Description: AWS-LC cryptography library
Expand Down
4 changes: 2 additions & 2 deletions pkgconfig/libssl.pc.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
prefix=@CMAKE_INSTALL_PREFIX@
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
libdir=@libdir_for_pc_file@
includedir=@includedir_for_pc_file@

Name: AWS-LC-libssl
Description: AWS-LC (OpenSSL SHIM)
Expand Down
4 changes: 2 additions & 2 deletions pkgconfig/openssl.pc.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
prefix=@CMAKE_INSTALL_PREFIX@
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
libdir=@libdir_for_pc_file@
includedir=@includedir_for_pc_file@

Name: AWS-LC
Description: AWS-LC (OpenSSL SHIM)
Expand Down

0 comments on commit 1773266

Please sign in to comment.