]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs: Add a pkgconfig file for libcephfs
authorAnoop C S <anoopcs@cryptolab.net>
Wed, 11 Sep 2024 10:38:12 +0000 (16:08 +0530)
committerAnoop C S <anoopcs@cryptolab.net>
Mon, 16 Dec 2024 07:25:33 +0000 (12:55 +0530)
It would really help external consumers to collectively figure out all
required parameters to link, build or load with libcephfs from a single
source of truth.

Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
src/CMakeLists.txt
src/cephfs.pc.in [new file with mode: 0644]

index 4a1c5768aa7f84dcc7e2234588e6d5d8df5386fd..9cbe350b388a30cef718a1cc8aea2c2855ef35f1 100644 (file)
@@ -16,6 +16,7 @@ endif()
 set(bindir ${CMAKE_INSTALL_FULL_BINDIR})
 set(sbindir ${CMAKE_INSTALL_FULL_SBINDIR})
 set(libdir ${CMAKE_INSTALL_FULL_LIBDIR})
+set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})
 set(sysconfdir ${CMAKE_INSTALL_FULL_SYSCONFDIR})
 set(libexecdir ${CMAKE_INSTALL_FULL_LIBEXECDIR})
 set(pkgdatadir ${CMAKE_INSTALL_FULL_DATADIR})
@@ -31,6 +32,12 @@ configure_file(ceph-post-file.in
 configure_file(ceph-crash.in
   ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-crash @ONLY)
 
+if(WITH_LIBCEPHFS)
+  configure_file(
+    ${CMAKE_SOURCE_DIR}/src/cephfs.pc.in
+    ${CMAKE_BINARY_DIR}/src/cephfs.pc @ONLY)
+endif(WITH_LIBCEPHFS)
+
 # the src/.git_version file may be written out by make-dist; otherwise
 # we pull the git version from .git
 option(ENABLE_GIT_VERSION "build Ceph with git version string" ON)
@@ -832,10 +839,12 @@ if(WITH_LIBCEPHFS)
   target_link_libraries(cephfs PRIVATE client ceph-common
     ${CRYPTO_LIBS} ${EXTRALIBS})
   if(ENABLE_SHARED)
+    set(libcephfs_version 2.0.0)
+    set(libcephfs_soversion 2)
     set_target_properties(cephfs PROPERTIES
       OUTPUT_NAME cephfs
-      VERSION 2.0.0
-      SOVERSION 2)
+      VERSION ${libcephfs_version}
+      SOVERSION ${libcephfs_soversion})
     if(NOT APPLE AND NOT
         (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL Clang))
       foreach(name ceph-common client osdc)
@@ -848,6 +857,9 @@ if(WITH_LIBCEPHFS)
   install(DIRECTORY
     "include/cephfs"
     DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+  install(FILES
+    ${CMAKE_BINARY_DIR}/src/cephfs.pc
+    DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
   set(ceph_syn_srcs
     ceph_syn.cc
     client/SyntheticClient.cc)
diff --git a/src/cephfs.pc.in b/src/cephfs.pc.in
new file mode 100644 (file)
index 0000000..3c57614
--- /dev/null
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libcephfs
+Description: Ceph distributed file system client library
+Version: @libcephfs_version@
+Cflags: -I${includedir}/cephfs -D_FILE_OFFSET_BITS=64
+Libs: -L${libdir} -lcephfs