From 4763959227e50b7a625970c31347a0e7e84fb4a9 Mon Sep 17 00:00:00 2001 From: "Anton D. Kachalov" Date: Wed, 16 Dec 2020 06:45:33 -0800 Subject: [PATCH] Add pkg-config files generation. PiperOrigin-RevId: 347812826 Change-Id: I1722d39759628ad976b99887c8406cff08195009 --- CMakeLists.txt | 1 + cmake/sandbox2.pc.in | 10 ++++++++++ cmake/sapi.pc.in | 10 ++++++++++ sandboxed_api/CMakeLists.txt | 8 ++++++++ sandboxed_api/sandbox2/CMakeLists.txt | 8 ++++++++ 5 files changed, 37 insertions(+) create mode 100644 cmake/sandbox2.pc.in create mode 100644 cmake/sapi.pc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 2de3103..fa35b0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,7 @@ include(SapiOptions) include(SapiDeps) include(SapiUtil) include(SapiBuildDefs) +include(GNUInstallDirs) # Allow the header generator to auto-configure include paths set(CMAKE_EXPORT_COMPILE_COMMANDS ON) diff --git a/cmake/sandbox2.pc.in b/cmake/sandbox2.pc.in new file mode 100644 index 0000000..da4b963 --- /dev/null +++ b/cmake/sandbox2.pc.in @@ -0,0 +1,10 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@CMAKE_INSTALL_FULL_BINDIR@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + +Name: sandbox2 +Description: Sandbox2 is a C++ security sandbox for Linux using seccomp and BPF +Version: @PROJECT_VERSION@ +Libs: -L${libdir} -lsandbox2_sandbox2 +Cflags: -I${includedir} diff --git a/cmake/sapi.pc.in b/cmake/sapi.pc.in new file mode 100644 index 0000000..f947ae3 --- /dev/null +++ b/cmake/sapi.pc.in @@ -0,0 +1,10 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@CMAKE_INSTALL_FULL_BINDIR@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + +Name: sapi +Description: Sandboxed API makes sandboxing C/C++ libraries easier by auto-generating library API interfaces that call into sandboxed libraries using a custom RPC layer. Sandboxed API uses Sandbox2 as its underlying sandboxing technology. +Version: @PROJECT_VERSION@ +Libs: -L${libdir} -lsapi +Cflags: -I${includedir} diff --git a/sandboxed_api/CMakeLists.txt b/sandboxed_api/CMakeLists.txt index a2f541e..be89974 100644 --- a/sandboxed_api/CMakeLists.txt +++ b/sandboxed_api/CMakeLists.txt @@ -216,3 +216,11 @@ foreach(_file ${_sapi_headers}) string(REPLACE ${CMAKE_CURRENT_LIST_DIR} "" _dir ${_dir}) install(FILES ${_file} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sandboxed_api/${_dir}) endforeach() + +configure_file( + "${PROJECT_SOURCE_DIR}/cmake/sapi.pc.in" + "${PROJECT_BINARY_DIR}/sapi.pc" + @ONLY +) + +install(FILES "${PROJECT_BINARY_DIR}/sapi.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") diff --git a/sandboxed_api/sandbox2/CMakeLists.txt b/sandboxed_api/sandbox2/CMakeLists.txt index ead3c36..954b9a4 100644 --- a/sandboxed_api/sandbox2/CMakeLists.txt +++ b/sandboxed_api/sandbox2/CMakeLists.txt @@ -999,3 +999,11 @@ if(SAPI_ENABLE_TESTS) ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}" ) endif() + +configure_file( + "${PROJECT_SOURCE_DIR}/cmake/sandbox2.pc.in" + "${PROJECT_BINARY_DIR}/sandbox2.pc" + @ONLY +) + +install(FILES "${PROJECT_BINARY_DIR}/sandbox2.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")