On 2024/09/16 21:41, rin...@apache.org wrote:
> Author: rinrab
> Date: Mon Sep 16 12:41:13 2024
> New Revision: 1920717
> 
> URL: http://svn.apache.org/viewvc?rev=1920717&view=rev
> Log:
> Merge the `cmake` branch to trunk.

I'm trying to build all programs, tools, tests, swig-* bindings and apache
modules with cmake on Windows. However, building swig-pl stopped with the
following errors:

[[[
    22>Link:
            Creating library 
C:/usr/src/subversion/trunk-py312/out/Release/libperl_core.lib and object 
C:/usr/src/subversion/trunk-py312/out/Release/libperl_core.exp
    22>corePERL_wrap.obj : error LNK2019: unresolved external symbol 
svn_swig_pl_thunk_ssl_server_trust_prompt referenced in function 
_wrap_svn_auth_get_ssl_server_trust_prompt_provider 
[C:\usr\src\subversion\trunk-py312\out\perl_core.vcxproj]
    22>corePERL_wrap.obj : error LNK2019: unresolved external symbol 
svn_swig_pl_thunk_ssl_client_cert_prompt referenced in function 
_wrap_svn_auth_get_ssl_client_cert_prompt_provider 
[C:\usr\src\subversion\trunk-py312\out\perl_core.vcxproj]
    22>corePERL_wrap.obj : error LNK2019: unresolved external symbol 
svn_swig_pl_thunk_ssl_client_cert_pw_prompt referenced in function 
_wrap_svn_auth_get_ssl_client_cert_pw_prompt_provider 
[C:\usr\src\subversion\trunk-py312\out\perl_core.vcxproj]
]]]

It is caused by that libsvn_swig_perl.def is not same between vcnet and cmake.
The .def files directly are generated from CMakeLists.txt instead of
build/generator/extractor.py, but the pattern for the exported symbols is
changed. It is the root cause. The pattern should be same.

In CMakeLists.txt:
[[[
    set(func_regex "^([A-Za-z0-9_][A-Za-z0-9_* ]+[ *])?(svn[A-Za-z0-9_]+)\\(")
]]]

In build/generator/extractor.py:
[[[
_funcs = re.compile(r'^(?:(?:(?:\w+|\*) )+\*?)?((?:svn|apr)_[a-z_0-9]+)\s*\(', 
re.M)
]]]

The REGEX feature in cmake is poor but we could revise like the following
changes, otherwise we should use extractor.py:

[[[
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt      (revision 1920717)
+++ CMakeLists.txt      (working copy)
@@ -412,15 +412,16 @@
     set(def_file_path ${CMAKE_BINARY_DIR}/${target_name}.def)
 
     # see build/generator/extractor.py
-    set(func_regex "^([A-Za-z0-9_][A-Za-z0-9_* ]+[ *])?(svn[A-Za-z0-9_]+)\\(")
+    set(func_regex "(^|\n)((([A-Za-z0-9_]+|[*]) 
)+[*]?)?((svn|apr)_[a-z_0-9]+)[ \t\r\n]*\\(")
 
     set(defs)
     foreach(file ${ARGN})
-      file(STRINGS ${file} funcs REGEX "${func_regex}")
+      file(READ ${file} contents)
+      string(REGEX MATCHALL "${func_regex}" funcs ${contents})
 
       foreach(func_string ${funcs})
-        string(REGEX REPLACE "${func_regex}.*$" "\\2" func_name ${func_string})
-
+        string(REGEX MATCH "[A-Za-z0-9_]+[ \t\r\n]*\\($" func_name 
${func_string})
+        string(REGEX REPLACE "[ \t\r\n]*\\($" "" func_name ${func_name})
         list(APPEND defs "${func_name}")
       endforeach()
 
]]]

Thoughts?

-- 
Jun Omae <jun6...@gmail.com> (大前 潤)

Reply via email to