Skip to content

Commit 7e6aef8

Browse files
Add support for building with pkgconfig (#1310)
librelp, bind, and other libraries use package config to detect OpenSSL support. This lets these projects find AWS-LC with their existing build configurations.
1 parent e3d01dc commit 7e6aef8

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,3 +1115,17 @@ FILE(STRINGS "include/openssl/opensslv.h"
11151115
if(NOT ${BASE_VERSION_NUMBER} MATCHES ${OPENSSLV_VERSION_NUMBER})
11161116
message( FATAL_ERROR "OPENSSL_VERSION_NUMBER in base.h and opensslv.h should match.")
11171117
endif()
1118+
1119+
# TODO: Find a way to make this automatically align with OPENSSL_VERSION_NUMBER in base.h.
1120+
set(VERSION 1.1.1)
1121+
1122+
# AWS-LC may be installed in a non-standard prefix. If OpenSSL exists in the standard path,
1123+
# the downstream integration may build with the system's OpenSSL version instead.
1124+
# Consider adjusting the PKG_CONFIG_PATH environment to get around this.
1125+
file(GLOB OPENSSL_PKGCONFIGS "pkgconfig/*.pc.in")
1126+
foreach(in_file ${OPENSSL_PKGCONFIGS})
1127+
file(RELATIVE_PATH in_file ${PROJECT_SOURCE_DIR} ${in_file})
1128+
string(REPLACE ".in" "" pc_file ${in_file})
1129+
configure_file(${in_file} ${CMAKE_CURRENT_BINARY_DIR}/${pc_file} @ONLY)
1130+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${pc_file} DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
1131+
endforeach()

pkgconfig/libcrypto.pc.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
prefix=@CMAKE_INSTALL_PREFIX@
2+
libdir=${prefix}/lib
3+
includedir=${prefix}/include
4+
5+
Name: AWS-LC-libcrypto
6+
Description: AWS-LC cryptography library
7+
Version: @VERSION@
8+
Libs: -L${libdir} -lcrypto
9+
Cflags: -I${includedir}

pkgconfig/libssl.pc.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
prefix=@CMAKE_INSTALL_PREFIX@
2+
libdir=${prefix}/lib
3+
includedir=${prefix}/include
4+
5+
Name: AWS-LC-libssl
6+
Description: AWS-LC (OpenSSL SHIM)
7+
Version: @VERSION@
8+
Requires.private: libcrypto
9+
Libs: -L${libdir} -lssl
10+
Cflags: -I${includedir}

pkgconfig/openssl.pc.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
prefix=@CMAKE_INSTALL_PREFIX@
2+
libdir=${prefix}/lib
3+
includedir=${prefix}/include
4+
5+
Name: AWS-LC
6+
Description: AWS-LC (OpenSSL SHIM)
7+
Version: @VERSION@
8+
Requires: libssl libcrypto

0 commit comments

Comments
 (0)