Add linking of gssapi to support Kerberos authentication

Resolves: rhbz#2245095
This commit is contained in:
Tomas Korbar 2023-12-07 13:44:50 +01:00
parent d33a74d5b0
commit cf8573cae2
2 changed files with 67 additions and 3 deletions

View File

@ -0,0 +1,60 @@
commit 821fc34e224a4e82563f0561be2e60fd1d4ec92b
Author: Tomas Korbar <tkorbar@redhat.com>
Date: Tue Nov 14 12:42:45 2023 +0100
Add gssapi linking
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3f10eae..e435e29 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,7 +51,7 @@ option(DEBUG "Enable debugging info and strict compile warnings" OFF)
option(SKIP_SHARED "Disable building shared Serf libraries" OFF)
option(SKIP_STATIC "Disable building static Serf libraries" OFF)
option(LIBDIR "Install directory for architecture-dependent libraries" "")
-option(GSSAPI "Path to GSSAPI's install area" "")
+option(GSSAPI "Use pkg-config to link with GSSAPI" OFF)
option(BROTLI "Path to Brotli's install area" "")
option(DISABLE_LOGGING "Disable the logging framework at compile time" OFF)
option(SKIP_TESTS "Disable building the unit tests and utilities" OFF)
@@ -156,10 +156,14 @@ if(SERF_WINDOWS)
)
endif(SERF_WINDOWS)
-
# Process build options for dependency search
if(GSSAPI)
- message(WARNING "option GSSAPI is not implemented")
+ find_package(PkgConfig REQUIRED)
+ pkg_check_modules(GSSAPI krb5-gssapi)
+ if (NOT GSSAPI_FOUND)
+ message(WARNING "GSSAPI pkgconfig module was not found")
+ endif()
+ add_definitions("-DSERF_HAVE_GSSAPI")
endif()
if(BROTLI)
@@ -285,6 +289,11 @@ if(NOT SKIP_SHARED)
PRIVATE ${SERF_PRIVATE_TARGETS}
${SERF_STANDARD_LIBRARIES}
PUBLIC ${SERF_PUBLIC_TARGETS})
+ if (GSSAPI_FOUND)
+ target_link_libraries(serf_shared PRIVATE ${GSSAPI_LIBRARIES})
+ target_include_directories(serf_shared PRIVATE ${GSSAPI_INCLUDE_DIRS})
+ target_compile_options(serf_shared PRIVATE ${GSSAPI_CFLAGS_OTHER})
+ endif (GSSAPI_FOUND)
set_target_properties(serf_shared PROPERTIES
VERSION ${SERF_VERSION}
SOVERSION ${SERF_SOVERSION})
@@ -307,6 +316,11 @@ if(NOT SKIP_STATIC)
${SERF_PRIVATE_TARGETS}
${SERF_PUBLIC_TARGETS}
${SERF_STANDARD_LIBRARIES})
+ if (GSSAPI_FOUND)
+ target_link_libraries(serf_shared PRIVATE ${GSSAPI_LIBRARIES})
+ target_include_directories(serf_shared PRIVATE ${GSSAPI_INCLUDE_DIRS})
+ target_compile_options(serf_shared PRIVATE ${GSSAPI_CFLAGS_OTHER})
+ endif (GSSAPI_FOUND)
list(APPEND SERF_TARGETS "serf_static")
endif()

View File

@ -1,6 +1,6 @@
Name: libserf
Version: 1.3.10
Release: 2%{?dist}
Release: 3%{?dist}
Summary: High-Performance Asynchronous HTTP Client Library
License: Apache-2.0
URL: http://serf.apache.org/
@ -15,6 +15,7 @@ Patch0: %{name}-norpath.patch
Patch1: %{name}-1.3.9-errgetfunc.patch
Patch2: %{name}-1.3.9-multihome.patch
Patch3: %{name}-1.3.9-cmake.patch
Patch4: %{name}-1.3.10-gssapi.patch
%description
The serf library is a C-based HTTP client library built upon the Apache
@ -46,12 +47,11 @@ popd
%endif
%build
%cmake -DCMAKE_INSTALL_LIBDIR=%{_libdir}
%cmake -DCMAKE_INSTALL_LIBDIR=%{_libdir} -DGSSAPI=ON -DSKIP_STATIC=ON
%cmake_build
%install
%cmake_install
find %{buildroot}%{_libdir} -type f -name '*.*a' -delete -print
mkdir -p %{buildroot}%{_libdir}/pkgconfig
mv %{buildroot}%{_datadir}/pkgconfig/serf.pc %{buildroot}%{_libdir}/pkgconfig/serf.pc
@ -77,6 +77,10 @@ true
%{_libdir}/pkgconfig/serf*.pc
%changelog
* Thu Dec 07 2023 Tomas Korbar <tkorbar@redhat.com> - 1.3.10-3
- Add linking of gssapi to support Kerberos authentication
- Resolves: rhbz#2245095
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.10-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild