Author: brane
Date: Thu Jul  3 11:51:23 2025
New Revision: 1926939

URL: http://svn.apache.org/viewvc?rev=1926939&view=rev
Log:
On the user-defined-authn branch: sync with trunk r1926938

Modified:
    serf/branches/user-defined-authn/   (props changed)
    serf/branches/user-defined-authn/CMakeLists.txt
    serf/branches/user-defined-authn/README
    serf/branches/user-defined-authn/SConstruct
    serf/branches/user-defined-authn/build/FindAPR.cmake
    serf/branches/user-defined-authn/build/check.py
    serf/branches/user-defined-authn/test/test_all.c

Propchange: serf/branches/user-defined-authn/
------------------------------------------------------------------------------
  Merged /serf/trunk:r1926884-1926938

Modified: serf/branches/user-defined-authn/CMakeLists.txt
URL: 
http://svn.apache.org/viewvc/serf/branches/user-defined-authn/CMakeLists.txt?rev=1926939&r1=1926938&r2=1926939&view=diff
==============================================================================
--- serf/branches/user-defined-authn/CMakeLists.txt (original)
+++ serf/branches/user-defined-authn/CMakeLists.txt Thu Jul  3 11:51:23 2025
@@ -467,14 +467,20 @@ install(FILES ${HEADERS} DESTINATION "${
 
 # Generate the pkg-config module file.
 if(NOT SERF_WINDOWS)
+  set(SERF_PC_FILE "serf-${SERF_MAJOR_VERSION}.pc")
+
   # Use a separate variable scope for the substitutions in serf.pc.in.
   function(make_pkgconfig)
-    set(PREFIX ${CMAKE_INSTALL_PREFIX})
+    # Use a relative prefix to create a relocatable PC file.
+    file(RELATIVE_PATH relfragment "/${SERF_INSTALL_PKGCONFIG}" "/")
+    file(TO_CMAKE_PATH "\${pcfiledir}/${relfragment}" relprefix)
+
+    set(PREFIX ${relprefix})
     set(INCLUDE_SUBDIR ${SERF_INCLUDE_SUBDIR})
     set(LIBDIR \${prefix}/${SERF_INSTALL_LIBRARIES})
     set(VERSION ${SERF_VERSION})
     set(MAJOR ${SERF_MAJOR_VERSION})
-    set(SERF_INTERFACE_LIBS
+    set(LIBS
       ${APR_LDFLAGS}
       ${APR_LIBRARIES}
       ${APR_EXTRALIBS}
@@ -484,16 +490,13 @@ if(NOT SERF_WINDOWS)
       ${GSSAPI_LIBRARIES}
       ${ZLIB_LIBRARIES}
       )
-    list(REMOVE_DUPLICATES SERF_INTERFACE_LIBS)
-    unset(LIBS)
-    foreach(DEPLIB ${SERF_INTERFACE_LIBS})
-      string(APPEND LIBS " ${DEPLIB}")
-    endforeach()
-    configure_file("build/serf.pc.in" "serf-${SERF_MAJOR_VERSION}.pc" @ONLY)
+    list(REMOVE_DUPLICATES LIBS)
+    list(JOIN LIBS " " LIBS)
+    configure_file("build/serf.pc.in" "${SERF_PC_FILE}" @ONLY)
   endfunction()
 
   make_pkgconfig()
-  install(FILES "${CMAKE_CURRENT_BINARY_DIR}/serf-${SERF_MAJOR_VERSION}.pc"
+  install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${SERF_PC_FILE}"
           DESTINATION "${SERF_INSTALL_PKGCONFIG}")
 endif()
 

Modified: serf/branches/user-defined-authn/README
URL: 
http://svn.apache.org/viewvc/serf/branches/user-defined-authn/README?rev=1926939&r1=1926938&r2=1926939&view=diff
==============================================================================
--- serf/branches/user-defined-authn/README (original)
+++ serf/branches/user-defined-authn/README Thu Jul  3 11:51:23 2025
@@ -23,14 +23,25 @@ the same features.
 
 1.1.1 SCons build system
 
-You must use at least SCons version 2.3. If it is not installed
+You must use at least SCons version 2.3.5. If it is not installed
 on your system, then you can install it onto your system. If you do not
 have permissions, then you can download and install the "local"
 version into your home directory. When installed privately, simply
 create a symlink for 'scons' in your PATH to /path/to/scons/scons.py.
 
 Fetch the scons-local package:
-  http://prdownloads.sourceforge.net/scons/scons-local-2.3.0.tar.gz
+  http://prdownloads.sourceforge.net/scons/scons-local-2.3.5.tar.gz
+  
+Alternatively create a virtual Python environment and install SCons via
+pip (replace the path ~/scons_venv with your preferred path):
+
+  $ python -m venv ~/scons_venv
+  $ ~/scons_venv/bin/pip install scons
+
+In the build instructions below, make sure to include the full path to your
+virtual environment:
+
+  $ ~/scons_venv/bin/scons [...see below...]
 
 
 1.1.2 Building Apache Serf using SCons
@@ -57,7 +68,7 @@ to apu-1-config in $APU or $APU/bin/apu-
 OPENSSL should specify the root of the install (e.g., /opt/local). The
 includes will be found $OPENSSL/include/openssl and libraries at $OPENSSL/lib.
 
-OPENSSL should specify the root of the install. The includes will be found
+ZLIB should specify the root of the install. The includes will be found
 $ZLIB/include and libraries at $ZLIB/lib.
 
 The BROTLI and GSSAPI dependencies are optional.
@@ -123,7 +134,7 @@ $ scons -c
 
 Get the sources, either a release tarball or by checking out the
 official repository. The CMake build system currently only exists in
-trunk and it will be included in the 1.4 release.
+trunk and it will be included in the 1.5 release.
 
 The process for building on Unix and Windows is the same.
 

Modified: serf/branches/user-defined-authn/SConstruct
URL: 
http://svn.apache.org/viewvc/serf/branches/user-defined-authn/SConstruct?rev=1926939&r1=1926938&r2=1926939&view=diff
==============================================================================
--- serf/branches/user-defined-authn/SConstruct (original)
+++ serf/branches/user-defined-authn/SConstruct Thu Jul  3 11:51:23 2025
@@ -96,6 +96,15 @@ def createPathIsDirCreateWithTarget(targ
       return PathVariable.PathAccept(key, val, env)
   return my_validator
 
+def filter_cflags(env, cmd, unique=0):
+  '''Filter all debugging, optimization and warning flags from 'cmd'.'''
+  cmd = re.sub(r'(^|\s)-[gOW]\S*', '', cmd)
+  return env.MergeFlags(cmd, unique)
+
+def unsubstable(string):
+  '''There are things that SCons just shouldn't Subst.'''
+  return string.replace('$', '$$')
+
 # default directories
 if sys.platform == 'win32':
   default_incdir='..'
@@ -538,11 +547,13 @@ else:
     ### we should use --cc, but that is giving some scons error about an 
implicit
     ### dependency upon gcc. probably ParseConfig doesn't know what to do with
     ### the apr-1-config output
-    env.ParseConfig('$APR --cflags --cppflags --ldflags --includes'
-                    ' --link-ld --libs', unique=0)
+
+    env.ParseConfig('$APR --cflags --cppflags --includes'
+                    ' --ldflags --link-ld --libs',
+                    filter_cflags)
     if apr_major < 2:
-      env.ParseConfig('$APU --ldflags --includes --link-ld --libs',
-                      unique=0)
+      env.ParseConfig('$APU --includes --ldflags --link-ld --libs',
+                      filter_cflags)
 
     ### there is probably a better way to run/capture output.
     ### env.ParseConfig() may be handy for getting this stuff into the build
@@ -664,12 +675,14 @@ for d in env['LIBPATH']:
   env.Append(RPATH=[':'+d])
 
 # Set up the construction of serf-*.pc
+pkgprefix = os.path.relpath(env.subst('$PREFIX'), 
env.subst('$LIBDIR/pkgconfig'))
+pkglibdir = os.path.relpath(env.subst('$LIBDIR'), env.subst('$PREFIX'))
 pkgconfig = env.Textfile('serf-%d.pc' % (MAJOR,),
                          env.File('build/serf.pc.in'),
                          SUBST_DICT = {
                            '@MAJOR@': str(MAJOR),
-                           '@PREFIX@': re.escape(str(env['PREFIX'])),
-                           '@LIBDIR@': re.escape(str(env['LIBDIR'])),
+                           '@PREFIX@': unsubstable('${pcfiledir}/' + 
pkgprefix),
+                           '@LIBDIR@': unsubstable('${prefix}/' + pkglibdir),
                            '@INCLUDE_SUBDIR@': 'serf-%d' % (MAJOR,),
                            '@VERSION@': '%d.%d.%d' % (MAJOR, MINOR, PATCH),
                            '@LIBS@': '%s %s %s %s -lz' % (apu_libs, apr_libs,
@@ -738,7 +751,10 @@ test_app = ("%s %s %s %s") % (sys.execut
 test_env = {'PATH' : os.environ['PATH'],
             'srcdir' : src_dir}
 if sys.platform != 'win32':
-  test_env['LD_LIBRARY_PATH'] = ':'.join(tenv.get('LIBPATH', []))
+  os_library_path = os.environ.get('LD_LIBRARY_PATH')
+  os_library_path = [os_library_path] if os_library_path else []
+  ld_library_path = [tenv.subst(p) for p in tenv.get('LIBPATH', [])]
+  test_env['LD_LIBRARY_PATH'] = ':'.join(ld_library_path + os_library_path)
 env.AlwaysBuild(env.Alias('check', TEST_EXES, test_app, ENV=test_env))
 
 testall_files = [

Modified: serf/branches/user-defined-authn/build/FindAPR.cmake
URL: 
http://svn.apache.org/viewvc/serf/branches/user-defined-authn/build/FindAPR.cmake?rev=1926939&r1=1926938&r2=1926939&view=diff
==============================================================================
--- serf/branches/user-defined-authn/build/FindAPR.cmake (original)
+++ serf/branches/user-defined-authn/build/FindAPR.cmake Thu Jul  3 11:51:23 
2025
@@ -229,7 +229,7 @@ if(NOT _apru_include_only_utilities)
       _apru_config(${APR_CONFIG_EXECUTABLE} ${_varname} "${_regexp}" "${ARGN}")
     endmacro(_apr_invoke)
 
-    _apr_invoke(APR_CFLAGS     "(^| )-(g|O)[^ ]*" --cppflags --cflags)
+    _apr_invoke(APR_CFLAGS     "(^| )-[gOW][^ ]*" --cppflags --cflags)
     _apr_invoke(APR_INCLUDES   "(^| )-I"          --includes)
     _apr_invoke(APR_LDFLAGS    ""                 --ldflags)
     _apr_invoke(APR_LIBRARIES  ""                 --link-ld)

Modified: serf/branches/user-defined-authn/build/check.py
URL: 
http://svn.apache.org/viewvc/serf/branches/user-defined-authn/build/check.py?rev=1926939&r1=1926938&r2=1926939&view=diff
==============================================================================
--- serf/branches/user-defined-authn/build/check.py (original)
+++ serf/branches/user-defined-authn/build/check.py Thu Jul  3 11:51:23 2025
@@ -10,9 +10,9 @@
 #   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
@@ -60,8 +60,25 @@ if __name__ == '__main__':
       sys.exit(1)
 
   print("== Running the unit tests ==")
+
+  fails = 0
+  def print_exception(x):
+    global fails
+    print("ERROR: test(s) failed in '%s', exit code=%d"
+          % (' '.join(x.cmd), x.returncode))
+    fails += 1
+
   try:
-    subprocess.check_call(TEST_ALL_EXE)
+    suites = subprocess.check_output([TEST_ALL_EXE, '-L']).decode()
+    for suite in suites.splitlines():
+      testcase = (TEST_ALL_EXE, suite.strip())
+      print("==== %s %s" % testcase)
+      try:
+        subprocess.check_call(testcase)
+      except subprocess.CalledProcessError as x:
+        print_exception(x)
   except subprocess.CalledProcessError as x:
-    print("ERROR: test(s) failed in '%s', exit code=%d" % (x.cmd, 
x.returncode))
+    print_exception(x)
+
+  if fails > 0:
     sys.exit(1)

Modified: serf/branches/user-defined-authn/test/test_all.c
URL: 
http://svn.apache.org/viewvc/serf/branches/user-defined-authn/test/test_all.c?rev=1926939&r1=1926938&r2=1926939&view=diff
==============================================================================
--- serf/branches/user-defined-authn/test/test_all.c (original)
+++ serf/branches/user-defined-authn/test/test_all.c Thu Jul  3 11:51:23 2025
@@ -18,12 +18,12 @@
  * ====================================================================
  */
 
-#include "apr.h"
-#include "apr_pools.h"
+#include <stdlib.h>
+
+#include <apr.h>
 #include <apr_signal.h>
 
 #include "test_serf.h"
-#include <stdlib.h>
 
 static const struct testlist {
     const char *testname;
@@ -62,19 +62,22 @@ int main(int argc, char *argv[])
         if (!strcmp(argv[i], "-v")) {
             continue;
         }
-        if (!strcmp(argv[i], "-l")) {
+        if (!strcmp(argv[i], "-l") || !strcmp(argv[i], "-L")) {
+            const int details = !strcmp(argv[i], "-l");
             for (i = 0; tests[i].func != NULL; i++) {
                 CuSuite *suite;
-                int j = 0;
 
                 printf("%s\n", tests[i].testname);
-                suite = tests[i].func();
+                if (details) {
+                    int j;
 
-                for (j = 0; j < suite->count; j++) {
-                    printf("  %3d - %s\n", j+1, suite->list[j]->name);
-                }
+                    suite = tests[i].func();
+                    for (j = 0; j < suite->count; j++) {
+                        printf("  %3d - %s\n", j+1, suite->list[j]->name);
+                    }
 
-                printf("\n");
+                    printf("\n");
+                }
             }
             exit(0);
         }


Reply via email to