Skip to content

Commit

Permalink
Add support for building with pkgconfig (#1310)
Browse files Browse the repository at this point in the history
librelp, bind, and other libraries use package config to detect OpenSSL
support. This lets these projects find AWS-LC with their existing build
configurations.
  • Loading branch information
samuel40791765 authored Nov 27, 2023
1 parent e3d01dc commit 7e6aef8
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1115,3 +1115,17 @@ FILE(STRINGS "include/openssl/opensslv.h"
if(NOT ${BASE_VERSION_NUMBER} MATCHES ${OPENSSLV_VERSION_NUMBER})
message( FATAL_ERROR "OPENSSL_VERSION_NUMBER in base.h and opensslv.h should match.")
endif()

# TODO: Find a way to make this automatically align with OPENSSL_VERSION_NUMBER in base.h.
set(VERSION 1.1.1)

# AWS-LC may be installed in a non-standard prefix. If OpenSSL exists in the standard path,
# 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")
foreach(in_file ${OPENSSL_PKGCONFIGS})
file(RELATIVE_PATH in_file ${PROJECT_SOURCE_DIR} ${in_file})
string(REPLACE ".in" "" pc_file ${in_file})
configure_file(${in_file} ${CMAKE_CURRENT_BINARY_DIR}/${pc_file} @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${pc_file} DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endforeach()
9 changes: 9 additions & 0 deletions pkgconfig/libcrypto.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
prefix=@CMAKE_INSTALL_PREFIX@
libdir=${prefix}/lib
includedir=${prefix}/include

Name: AWS-LC-libcrypto
Description: AWS-LC cryptography library
Version: @VERSION@
Libs: -L${libdir} -lcrypto
Cflags: -I${includedir}
10 changes: 10 additions & 0 deletions pkgconfig/libssl.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
prefix=@CMAKE_INSTALL_PREFIX@
libdir=${prefix}/lib
includedir=${prefix}/include

Name: AWS-LC-libssl
Description: AWS-LC (OpenSSL SHIM)
Version: @VERSION@
Requires.private: libcrypto
Libs: -L${libdir} -lssl
Cflags: -I${includedir}
8 changes: 8 additions & 0 deletions pkgconfig/openssl.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
prefix=@CMAKE_INSTALL_PREFIX@
libdir=${prefix}/lib
includedir=${prefix}/include

Name: AWS-LC
Description: AWS-LC (OpenSSL SHIM)
Version: @VERSION@
Requires: libssl libcrypto

0 comments on commit 7e6aef8

Please sign in to comment.