Author: dsahlberg Date: Thu Jul 3 14:35:58 2025 New Revision: 1926941 URL: http://svn.apache.org/viewvc?rev=1926941&view=rev Log: On the PR-8 branch: Catch up with trunk r1926940
Modified: serf/branches/PR-8/ (props changed) serf/branches/PR-8/CMakeLists.txt serf/branches/PR-8/README serf/branches/PR-8/SConstruct serf/branches/PR-8/build/FindAPR.cmake serf/branches/PR-8/build/check.py serf/branches/PR-8/test/test_all.c Propchange: serf/branches/PR-8/ ------------------------------------------------------------------------------ Merged /serf/trunk:r1926893-1926940 Modified: serf/branches/PR-8/CMakeLists.txt URL: http://svn.apache.org/viewvc/serf/branches/PR-8/CMakeLists.txt?rev=1926941&r1=1926940&r2=1926941&view=diff ============================================================================== --- serf/branches/PR-8/CMakeLists.txt (original) +++ serf/branches/PR-8/CMakeLists.txt Thu Jul 3 14:35:58 2025 @@ -470,14 +470,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} @@ -487,16 +493,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/PR-8/README URL: http://svn.apache.org/viewvc/serf/branches/PR-8/README?rev=1926941&r1=1926940&r2=1926941&view=diff ============================================================================== --- serf/branches/PR-8/README (original) +++ serf/branches/PR-8/README Thu Jul 3 14:35:58 2025 @@ -68,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. Modified: serf/branches/PR-8/SConstruct URL: http://svn.apache.org/viewvc/serf/branches/PR-8/SConstruct?rev=1926941&r1=1926940&r2=1926941&view=diff ============================================================================== --- serf/branches/PR-8/SConstruct (original) +++ serf/branches/PR-8/SConstruct Thu Jul 3 14:35:58 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 @@ -667,12 +678,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, @@ -741,7 +754,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/PR-8/build/FindAPR.cmake URL: http://svn.apache.org/viewvc/serf/branches/PR-8/build/FindAPR.cmake?rev=1926941&r1=1926940&r2=1926941&view=diff ============================================================================== --- serf/branches/PR-8/build/FindAPR.cmake (original) +++ serf/branches/PR-8/build/FindAPR.cmake Thu Jul 3 14:35:58 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/PR-8/build/check.py URL: http://svn.apache.org/viewvc/serf/branches/PR-8/build/check.py?rev=1926941&r1=1926940&r2=1926941&view=diff ============================================================================== --- serf/branches/PR-8/build/check.py (original) +++ serf/branches/PR-8/build/check.py Thu Jul 3 14:35:58 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/PR-8/test/test_all.c URL: http://svn.apache.org/viewvc/serf/branches/PR-8/test/test_all.c?rev=1926941&r1=1926940&r2=1926941&view=diff ============================================================================== --- serf/branches/PR-8/test/test_all.c (original) +++ serf/branches/PR-8/test/test_all.c Thu Jul 3 14:35:58 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); }