Author: rinrab
Date: Thu Jul 11 15:38:21 2024
New Revision: 1919150

URL: http://svn.apache.org/viewvc?rev=1919150&view=rev
Log:
On the 'cmake' branch: Support RA-Serf and add Serf dependency.

* build/cmake/FindSerf.cmake: New CMake module for Serf.

* build/generator/gen_cmake.py
  (names to ignore): Remove libsvn_ra_serf from the list.

* CMakeLists.txt
  (SVN_BUILD_RA_SERF): Uncomment the option and remove TODO.
  (Serf): Add finding of the library and create `external-serf` alias.
  (configuration summary): Write SVN_BUILD_RA_SERF and Serf version to the
   summary.

Added:
    subversion/branches/cmake/build/cmake/FindSerf.cmake
Modified:
    subversion/branches/cmake/CMakeLists.txt
    subversion/branches/cmake/build/generator/gen_cmake.py

Modified: subversion/branches/cmake/CMakeLists.txt
URL: 
http://svn.apache.org/viewvc/subversion/branches/cmake/CMakeLists.txt?rev=1919150&r1=1919149&r2=1919150&view=diff
==============================================================================
--- subversion/branches/cmake/CMakeLists.txt (original)
+++ subversion/branches/cmake/CMakeLists.txt Thu Jul 11 15:38:21 2024
@@ -76,11 +76,10 @@ if (SVN_BUILD_RA_LOCAL)
   add_compile_definitions("SVN_LIBSVN_RA_LINKS_RA_LOCAL")
 endif()
 
-# TODO:
-# option(SVN_BUILD_RA_SERF "Build Subversion HTTP/WebDAV Protocol Repository 
Access Library" OFF)
-# if (SVN_BUILD_RA_SERF)
-#   add_compile_definitions("SVN_LIBSVN_RA_LINKS_RA_SERF")
-# endif()
+option(SVN_BUILD_RA_SERF "Build Subversion HTTP/WebDAV Protocol Repository 
Access Library" OFF)
+if (SVN_BUILD_RA_SERF)
+  add_compile_definitions("SVN_LIBSVN_RA_LINKS_RA_SERF")
+endif()
 
 option(SVN_BUILD_RA_SVN "Build Subversion SVN Protocol Repository Access 
Library" ON)
 if (SVN_BUILD_RA_SVN)
@@ -198,6 +197,12 @@ set(SVN_SQLITE_AMALGAMATION_ROOT "${CMAK
   CACHE STRING "Directory with sqlite amalgamation"
 )
 
+### Serf
+if (SVN_BUILD_RA_SERF)
+  find_package(Serf REQUIRED)
+  add_library(external-serf ALIAS Serf::Serf)
+endif()
+
 if(SVN_SQLITE_USE_AMALGAMATION)
   add_library(external-sqlite INTERFACE)
   find_path(SVN_SQLITE_AMALGAMATION_DIR
@@ -395,7 +400,7 @@ message(STATUS "    Build FS FS ........
 message(STATUS "    Build FS X .................... : ${SVN_BUILD_FS_X}")
 message(STATUS "    Build RA LOCAL ................ : ${SVN_BUILD_RA_LOCAL}")
 message(STATUS "    Build RA SVN .................. : ${SVN_BUILD_RA_SVN}")
-message(STATUS "    Build RA SERF ................. : NOT IMPLEMENTED, SERF 
v1.2.3 (TODO:)")
+message(STATUS "    Build RA SERF ................. : ${SVN_BUILD_RA_SERF}")
 message(STATUS "    Build Apache Modules .......... : NOT IMPLEMENTED, HTTPD 
v2.4.68 (TODO:)")
 message(STATUS "    Build programs ................ : ${SVN_BUILD_PROGRAMS}")
 message(STATUS "    Build tools ................... : ${SVN_BUILD_PROGRAMS}")
@@ -408,7 +413,7 @@ message(STATUS "    ZLIB ...............
 message(STATUS "    LZ4 ........................... : ${lz4_VERSION}")
 message(STATUS "    UTF8PROC ...................... : ${UTF8PROC_VERSION}")
 message(STATUS "    SQLITE3 ....................... : ${SQLite3_VERSION}")
-message(STATUS "    SERF .......................... : NOT IMPLEMENTED")
+message(STATUS "    SERF .......................... : ${Serf_VERSION}")
 message(STATUS "    HTTPD ......................... : NOT IMPLEMENTED")
 message(STATUS "    TODO: ......................... : Other dependecies")
 message(STATUS "  Bindings:")

Added: subversion/branches/cmake/build/cmake/FindSerf.cmake
URL: 
http://svn.apache.org/viewvc/subversion/branches/cmake/build/cmake/FindSerf.cmake?rev=1919150&view=auto
==============================================================================
--- subversion/branches/cmake/build/cmake/FindSerf.cmake (added)
+++ subversion/branches/cmake/build/cmake/FindSerf.cmake Thu Jul 11 15:38:21 
2024
@@ -0,0 +1,92 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# FindSerf.cmake -- CMake module for Serf library
+#
+
+find_path(Serf_INCLUDE_DIR
+  NAMES serf.h
+  PATH_SUFFIXES
+    include
+    include/serf-1
+)
+
+find_library(Serf_LIBRARY
+  NAMES serf-1
+  PATH_SUFFIXES lib
+)
+
+mark_as_advanced(
+  Serf_INCLUDE_DIR
+  Serf_LIBRARY
+)
+
+# TODO: Shared Serf
+
+if (Serf_INCLUDE_DIR AND EXISTS ${Serf_INCLUDE_DIR}/serf.h)
+  file(
+    STRINGS "${Serf_INCLUDE_DIR}/serf.h" VERSION_STRINGS
+    REGEX "#define (SERF_MAJOR_VERSION|SERF_MINOR_VERSION|SERF_PATCH_VERSION)"
+  )
+
+  string(REGEX REPLACE ".*SERF_MAJOR_VERSION +([0-9]+).*" "\\1" 
SERF_MAJOR_VERSION ${VERSION_STRINGS})
+  string(REGEX REPLACE ".*SERF_MINOR_VERSION +([0-9]+).*" "\\1" 
SERF_MINOR_VERSION ${VERSION_STRINGS})
+  string(REGEX REPLACE ".*SERF_PATCH_VERSION +([0-9]+).*" "\\1" 
SERF_PATCH_VERSION ${VERSION_STRINGS})
+
+  set(Serf_VERSION 
"${SERF_MAJOR_VERSION}.${SERF_MINOR_VERSION}.${SERF_PATCH_VERSION}")
+endif()
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(
+  Serf
+  REQUIRED_VARS
+    Serf_LIBRARY
+    Serf_INCLUDE_DIR
+  VERSION_VAR
+    Serf_VERSION
+)
+
+add_library(Serf::Serf STATIC IMPORTED)
+
+set_target_properties(Serf::Serf PROPERTIES
+  INTERFACE_INCLUDE_DIRECTORIES ${Serf_INCLUDE_DIR}
+  IMPORTED_LOCATION ${Serf_LIBRARY}
+)
+
+find_package(OpenSSL REQUIRED)
+find_package(APR REQUIRED)
+find_package(APRUtil REQUIRED)
+find_package(ZLIB REQUIRED)
+
+target_link_libraries(Serf::Serf INTERFACE
+  apr::apr
+  apr::aprutil
+  OpenSSL::SSL
+  ZLIB::ZLIB
+)
+
+if (WIN32)
+  target_link_libraries(Serf::Serf INTERFACE
+    crypt32.lib
+    rpcrt4.lib
+    mswsock.lib
+    secur32.lib
+    ws2_32.lib
+  )
+endif()

Modified: subversion/branches/cmake/build/generator/gen_cmake.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/cmake/build/generator/gen_cmake.py?rev=1919150&r1=1919149&r2=1919150&view=diff
==============================================================================
--- subversion/branches/cmake/build/generator/gen_cmake.py (original)
+++ subversion/branches/cmake/build/generator/gen_cmake.py Thu Jul 11 15:38:21 
2024
@@ -248,7 +248,6 @@ class Generator(gen_base.GeneratorBase):
       "svnxx-tests",
 
       "libsvn_fs_base",
-      "libsvn_ra_serf",
 
       "mod_authz_svn",
       "mod_dav_svn",


Reply via email to