svn commit: r1934025 - in subversion/trunk: . build/cmake build/generator/templates

[email protected]
Newsgroups gmane.comp.version-control.subversion.svn
Message-ID <177839872430.901341.1079139241553371428@svn03-he-fi>
Author: jun66j5
Date: Sun May 10 07:38:44 2026
New Revision: 1934025

Log:
cmake: Use apxs for building Apache modules on Unix environments.

* CMakeLists.txt
  (): Find Httpd package before `include(.../targets.cmake)`.

* build/cmake/FindHttpd.cmake
  (): Add license header, use `include(GNUInstallDirs)` for libexecdir,
  initialize variables using apxs on non-WIN32, and add `HTTPD_MODULES_DIR`
  cache variable.

* build/generator/templates/targets.cmake.ezt
  (Apache modules): Set empty to prefix of *.lib files on WIN32 and use
  `${HTTPD_MODULES_DIR}` for destination of *.so files.

Modified:
   subversion/trunk/CMakeLists.txt
   subversion/trunk/build/cmake/FindHttpd.cmake
   subversion/trunk/build/generator/templates/targets.cmake.ezt

Modified: subversion/trunk/CMakeLists.txt
==============================================================================
--- subversion/trunk/CMakeLists.txt	Sun May 10 07:31:28 2026	(r1934024)
+++ subversion/trunk/CMakeLists.txt	Sun May 10 07:38:44 2026	(r1934025)
@@ -298,6 +298,14 @@ if (NOT EXISTS "${CMAKE_SOURCE_DIR}/buil
   )
 endif()
 
+### Httpd
+
+if(SVN_ENABLE_APACHE_MODULES)
+  find_package(Httpd REQUIRED)
+  add_library(external-libhttpd ALIAS httpd::httpd)
+  add_library(external-mod_dav ALIAS httpd::mod_dav)
+endif()
+
 add_library(ra-libs INTERFACE)
 add_library(fs-libs INTERFACE)
 
@@ -497,14 +505,6 @@ elseif(SVN_ENABLE_TESTS)
   )
 endif()
 
-### Httpd
-
-if(SVN_ENABLE_APACHE_MODULES)
-  find_package(Httpd REQUIRED)
-  add_library(external-libhttpd ALIAS httpd::httpd)
-  add_library(external-mod_dav ALIAS httpd::mod_dav)
-endif()
-
 ### KWallet
 
 if(SVN_ENABLE_AUTH_KWALLET)

Modified: subversion/trunk/build/cmake/FindHttpd.cmake
==============================================================================
--- subversion/trunk/build/cmake/FindHttpd.cmake	Sun May 10 07:31:28 2026	(r1934024)
+++ subversion/trunk/build/cmake/FindHttpd.cmake	Sun May 10 07:38:44 2026	(r1934025)
@@ -1,62 +1,123 @@
-find_path(HTTPD_INCLUDE_DIR
-  NAMES httpd.h
-  PATH_SUFFIXES
-    include
-)
+#
+# 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.
+#
+# FindHttpd.cmake -- CMake module for Httpd library
+#
+
+include(GNUInstallDirs)
+
+if(WIN32)
+  find_path(HTTPD_INCLUDE_DIR
+    NAMES httpd.h
+    PATH_SUFFIXES
+      include
+  )
 
-find_library(HTTPD_LIBRARY
-  NAMES libhttpd
-  PATH_SUFFIXES lib
-)
+  find_library(HTTPD_LIBRARY
+    NAMES libhttpd
+    PATH_SUFFIXES lib
+  )
 
-find_file(HTTPD_DLL
-  NAMES libhttpd.dll
-  PATH_SUFFIXES bin
-)
+  find_library(MOD_DAV_LIBRARY
+    NAMES mod_dav
+    PATH_SUFFIXES lib
+  )
 
-find_library(MOD_DAV_LIBRARY
-  NAMES mod_dav
-  PATH_SUFFIXES lib
-)
+  if (HTTPD_INCLUDE_DIR AND EXISTS "${HTTPD_INCLUDE_DIR}/ap_release.h")
+    file(
+      STRINGS "${HTTPD_INCLUDE_DIR}/ap_release.h" VERSION_STRINGS
+      REGEX "#define (AP_SERVER_MAJORVERSION_NUMBER|AP_SERVER_MINORVERSION_NUMBER|AP_SERVER_PATCHLEVEL_NUMBER)"
+    )
 
-if (HTTPD_INCLUDE_DIR AND EXISTS "${HTTPD_INCLUDE_DIR}/ap_release.h")
-  file(
-    STRINGS "${HTTPD_INCLUDE_DIR}/ap_release.h" VERSION_STRINGS
-    REGEX "#define (AP_SERVER_MAJORVERSION_NUMBER|AP_SERVER_MINORVERSION_NUMBER|AP_SERVER_PATCHLEVEL_NUMBER)"
-  )
+    string(REGEX REPLACE ".*AP_SERVER_MAJORVERSION_NUMBER +([0-9]+).*" "\\1" HTTPD_VERSION_MAJOR ${VERSION_STRINGS})
+    string(REGEX REPLACE ".*AP_SERVER_MINORVERSION_NUMBER +([0-9]+).*" "\\1" HTTPD_VERSION_MINOR ${VERSION_STRINGS})
+    string(REGEX REPLACE ".*AP_SERVER_PATCHLEVEL_NUMBER +([0-9]+).*" "\\1" HTTPD_VERSION_PATCH ${VERSION_STRINGS})
 
-  string(REGEX REPLACE ".*AP_SERVER_MAJORVERSION_NUMBER +([0-9]+).*" "\\1" HTTPD_VERSION_MAJOR ${VERSION_STRINGS})
-  string(REGEX REPLACE ".*AP_SERVER_MINORVERSION_NUMBER +([0-9]+).*" "\\1" HTTPD_VERSION_MINOR ${VERSION_STRINGS})
-  string(REGEX REPLACE ".*AP_SERVER_PATCHLEVEL_NUMBER +([0-9]+).*" "\\1" HTTPD_VERSION_PATCH ${VERSION_STRINGS})
+    set(HTTPD_VERSION "${HTTPD_VERSION_MAJOR}.${HTTPD_VERSION_MINOR}.${HTTPD_VERSION_PATCH}")
+  endif()
+  set(_httpd_modules_dir "${CMAKE_INSTALL_BINDIR}")
+
+else()
+  find_program(APXS_EXECUTABLE
+               NAMES apxs2 apxs
+               PATH /usr/local/apache2/bin /usr/local/apache/bin /usr/bin /usr/sbin)
+
+  function(_APXS_CONFIG_VAR VARNAME OUTVAR)
+    execute_process(COMMAND "${APXS_EXECUTABLE}" -q ${VARNAME}
+                    RESULT_VARIABLE _APXS_SUCCESS
+                    OUTPUT_VARIABLE _APXS_OUTPUT
+                    OUTPUT_STRIP_TRAILING_WHITESPACE
+                    ERROR_QUIET)
+    set(${OUTVAR} "${_APXS_OUTPUT}" PARENT_SCOPE)
+  endfunction()
+
+  if(APXS_EXECUTABLE)
+    _APXS_CONFIG_VAR("HTTPD_VERSION" HTTPD_VERSION)
+    _APXS_CONFIG_VAR("INCLUDEDIR" HTTPD_INCLUDE_DIR)
+    set(_httpd_modules_dir "${CMAKE_INSTALL_LIBEXECDIR}")
+    set(HTTPD_FOUND TRUE)
+  endif()
 
-  set(HTTPD_VERSION "${HTTPD_VERSION_MAJOR}.${HTTPD_VERSION_MINOR}.${HTTPD_VERSION_PATCH}")
 endif()
 
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(
+set(HTTPD_MODULES_DIR "${_httpd_modules_dir}"
+    CACHE PATH "Install directory for Apache modules")
+
+find_package_handle_standard_args(
   Httpd
   REQUIRED_VARS
-    HTTPD_LIBRARY
     HTTPD_INCLUDE_DIR
-    MOD_DAV_LIBRARY
+    HTTPD_MODULES_DIR
   VERSION_VAR
     HTTPD_VERSION
 )
 
 if(HTTPD_FOUND)
   if(NOT TARGET httpd::httpd)
-    add_library(httpd::httpd SHARED IMPORTED)
+    add_library(httpd::httpd INTERFACE IMPORTED)
     set_target_properties(httpd::httpd PROPERTIES
       INTERFACE_INCLUDE_DIRECTORIES ${HTTPD_INCLUDE_DIR}
-      IMPORTED_LOCATION ${HTTPD_DLL}
-      IMPORTED_IMPLIB ${HTTPD_LIBRARY}
     )
+    if(WIN32)
+      set_target_properties(httpd::httpd PROPERTIES
+        INTERFACE_LINK_LIBRARIES ${HTTPD_LIBRARY}
+      )
+    elseif(APPLE)
+      target_link_options(httpd::httpd INTERFACE
+        "-Wl,-undefined,dynamic_lookup"
+      )
+    endif()
   endif()
 
   if(NOT TARGET httpd::mod_dav)
-    add_library(httpd::mod_dav STATIC IMPORTED)
+    add_library(httpd::mod_dav INTERFACE IMPORTED)
     set_target_properties(httpd::mod_dav PROPERTIES
       INTERFACE_INCLUDE_DIRECTORIES ${HTTPD_INCLUDE_DIR}
-      IMPORTED_LOCATION ${MOD_DAV_LIBRARY}
     )
+    if(WIN32)
+      set_target_properties(httpd::mod_dav PROPERTIES
+        INTERFACE_LINK_LIBRARIES ${MOD_DAV_LIBRARY}
+      )
+    elseif(APPLE)
+      target_link_options(httpd::mod_dav INTERFACE
+        "-Wl,-undefined,dynamic_lookup"
+      )
+    endif()
   endif()
+
 endif()

Modified: subversion/trunk/build/generator/templates/targets.cmake.ezt
==============================================================================
--- subversion/trunk/build/generator/templates/targets.cmake.ezt	Sun May 10 07:31:28 2026	(r1934024)
+++ subversion/trunk/build/generator/templates/targets.cmake.ezt	Sun May 10 07:38:44 2026	(r1934025)
@@ -49,7 +49,10 @@ if ([targets.enable_condition])[is targe
     [targets.msvc_export][end]
   )[end]
   set_target_properties([targets.name] PROPERTIES OUTPUT_NAME "[targets.output_name]")[if-any targets.is_apache_mod]
-  set_target_properties([targets.name] PROPERTIES PREFIX "" SUFFIX ".so")[else]
+  set_target_properties([targets.name] PROPERTIES PREFIX "" SUFFIX ".so")
+  if(WIN32)
+    set_target_properties([targets.name] PROPERTIES IMPORT_PREFIX "")
+  endif()[else]
   set_target_properties([targets.name] PROPERTIES SOVERSION "${SVN_SOVERSION}" VERSION "${SVN_SOVERSION}.${SVN_VER_MINOR}.${SVN_VER_PATCH}")[end]
   target_include_directories([targets.name] PUBLIC
     "${CMAKE_CURRENT_SOURCE_DIR}/subversion/include"
@@ -91,6 +94,8 @@ if ([targets.enable_condition])[is targe
   if (WIN32)
     target_sources([targets.name] PRIVATE build/win32/svn.rc)
   endif()[if-any targets.install_target]
-  install(TARGETS [targets.name])[end][end]
+  install(TARGETS [targets.name][if-any targets.is_apache_mod]
+    LIBRARY DESTINATION "${HTTPD_MODULES_DIR}"
+  [end])[end][end]
 endif()
 [end]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.