1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Reorganise the stubs collection.

I made a specific subdirectory 'stubs' to keep all the link-time stub
modules in, like notiming.c. And I put _one_ run-time stub in it,
namely nullplug.c. But the rest of the runtime stubs went into utils.

I think it's better to keep all the stubs together, so I've moved all
the null*.c in utils into stubs (with the exception of nullstrcmp.c,
which means the 'null' in a different sense). Also, fiddled with the
naming to be a bit more consistent, and stated in the new CMakeLists
the naming policy that distinguishes no-*.c from null-*.c.
This commit is contained in:
Simon Tatham 2022-08-23 18:57:58 +01:00
parent d862d8d60d
commit 6a1b713e13
17 changed files with 52 additions and 26 deletions

View File

@ -15,6 +15,7 @@ add_library(utils STATIC
${GENERATED_COMMIT_C})
add_dependencies(utils cmake_commit_c)
add_subdirectory(utils)
add_subdirectory(stubs)
add_library(logging OBJECT
logging.c)
@ -33,7 +34,7 @@ add_library(crypto STATIC
add_subdirectory(crypto)
add_library(network STATIC
stubs/nullplug.c errsock.c logging.c x11disp.c
errsock.c logging.c x11disp.c
proxy/proxy.c
proxy/http.c
proxy/socks4.c
@ -55,7 +56,7 @@ add_library(guiterminal STATIC
$<TARGET_OBJECTS:logging>)
add_library(noterminal STATIC
stubs/noterm.c ldisc.c)
stubs/no-term.c ldisc.c)
add_library(all-backends OBJECT
pinger.c)
@ -140,7 +141,7 @@ installed_program(psftp)
add_executable(psocks
${platform}/psocks.c
psocks.c
stubs/norand.c
stubs/no-rand.c
proxy/nocproxy.c
proxy/nosshproxy.c
ssh/portfwd.c)

30
stubs/CMakeLists.txt Normal file
View File

@ -0,0 +1,30 @@
# This subdirectory is generally full of 'stubs' in the sense of
# functions and types that don't do anything interesting, and are
# substituted in some contexts for ones that do.
#
# Some of the files here, with names beginning 'no-', are substituted
# at link time, conditional on the application. For example, a program
# that doesn't use the timing subsystem but still includes a module
# that makes a passing reference to it (say, in a context that never
# turns out to be called) can link against no-timing.c in place of the
# real timing.c.
#
# Other files, with names beginning 'null-', provide non-functional
# implementations of a particular internal API, or a selection of
# non-functional methods for that API that real implementations can
# selectively use. Those are linked in to a program _alongside_ real
# implementations of the same API.
#
# So the cmake setup for this directory puts all the 'null-' files
# into the utils library (at the end of the link, where they'll be
# available everywhere), but doesn't mention the 'no-' files, because
# those will be selected manually by add_executable() commands
# elsewhere.
add_sources_from_current_dir(utils
null-lp.c
null-cipher.c
null-key.c
null-mac.c
null-plug.c
null-seat.c)

View File

@ -1,5 +1,5 @@
/*
* nocmdline.c - stubs in applications which don't do the
* no-cmdline.c - stubs in applications which don't do the
* standard(ish) PuTTY tools' command-line parsing
*/

View File

@ -1,5 +1,5 @@
/*
* notiming.c: stub version of timing API.
* no-timing.c: stub version of timing API.
*
* Used in any tool which needs a subsystem linked against the
* timing API but doesn't want to actually provide timing. For

View File

@ -53,7 +53,7 @@ add_sources_from_current_dir(agent
add_executable(fuzzterm
${CMAKE_SOURCE_DIR}/test/fuzzterm.c
${CMAKE_SOURCE_DIR}/logging.c
${CMAKE_SOURCE_DIR}/stubs/noprint.c
${CMAKE_SOURCE_DIR}/stubs/no-print.c
unicode.c
no-gtk.c)
be_list(fuzzterm FuZZterm)
@ -71,7 +71,7 @@ add_sources_from_current_dir(psocks no-gtk.c)
add_executable(psusan
psusan.c
${CMAKE_SOURCE_DIR}/stubs/nogss.c
${CMAKE_SOURCE_DIR}/stubs/no-gss.c
${CMAKE_SOURCE_DIR}/ssh/scpserver.c
no-gtk.c
pty.c)
@ -81,7 +81,7 @@ target_link_libraries(psusan
installed_program(psusan)
add_library(puttygen-common OBJECT
${CMAKE_SOURCE_DIR}/stubs/notiming.c
${CMAKE_SOURCE_DIR}/stubs/no-timing.c
keygen-noise.c
no-gtk.c
noise.c
@ -114,7 +114,7 @@ add_executable(uppity
${CMAKE_SOURCE_DIR}/ssh/scpserver.c
no-gtk.c
pty.c
${CMAKE_SOURCE_DIR}/stubs/nogss.c)
${CMAKE_SOURCE_DIR}/stubs/no-gss.c)
be_list(uppity Uppity)
target_link_libraries(uppity
eventloop sshserver keygen settings network crypto utils)
@ -135,7 +135,7 @@ if(GTK_FOUND)
add_executable(pterm
pterm.c
main-gtk-simple.c
${CMAKE_SOURCE_DIR}/stubs/nogss.c
${CMAKE_SOURCE_DIR}/stubs/no-gss.c
${CMAKE_SOURCE_DIR}/stubs/no-ca-config.c
${CMAKE_SOURCE_DIR}/proxy/nosshproxy.c
pty.c)
@ -149,8 +149,8 @@ if(GTK_FOUND)
add_executable(ptermapp
pterm.c
main-gtk-application.c
${CMAKE_SOURCE_DIR}/stubs/nocmdline.c
${CMAKE_SOURCE_DIR}/stubs/nogss.c
${CMAKE_SOURCE_DIR}/stubs/no-cmdline.c
${CMAKE_SOURCE_DIR}/stubs/no-gss.c
${CMAKE_SOURCE_DIR}/stubs/no-ca-config.c
${CMAKE_SOURCE_DIR}/proxy/nosshproxy.c
pty.c)
@ -176,7 +176,7 @@ if(GTK_FOUND)
add_executable(puttyapp
putty.c
main-gtk-application.c
${CMAKE_SOURCE_DIR}/stubs/nocmdline.c)
${CMAKE_SOURCE_DIR}/stubs/no-cmdline.c)
be_list(puttyapp PuTTY SSH SERIAL OTHERBACKENDS)
target_link_libraries(puttyapp
guiterminal eventloop sshclient otherbackends settings
@ -187,9 +187,9 @@ if(GTK_FOUND)
add_executable(puttytel
putty.c
main-gtk-simple.c
${CMAKE_SOURCE_DIR}/stubs/nogss.c
${CMAKE_SOURCE_DIR}/stubs/no-gss.c
${CMAKE_SOURCE_DIR}/stubs/no-ca-config.c
${CMAKE_SOURCE_DIR}/stubs/norand.c
${CMAKE_SOURCE_DIR}/stubs/no-rand.c
${CMAKE_SOURCE_DIR}/proxy/nocproxy.c
${CMAKE_SOURCE_DIR}/proxy/nosshproxy.c)
be_list(puttytel PuTTYtel SERIAL OTHERBACKENDS)
@ -210,7 +210,7 @@ else()
endif()
add_executable(pageant
pageant.c
${CMAKE_SOURCE_DIR}/stubs/nogss.c
${CMAKE_SOURCE_DIR}/stubs/no-gss.c
x11.c
noise.c
${CMAKE_SOURCE_DIR}/ssh/x11fwd.c

View File

@ -41,11 +41,6 @@ add_sources_from_current_dir(utils
marshal.c
memory.c
memxor.c
null_lp.c
nullcipher.c
nullkey.c
nullmac.c
nullseat.c
nullstrcmp.c
out_of_memory.c
parse_blocksize.c

View File

@ -116,9 +116,9 @@ add_executable(puttytel
window.c
putty.c
help.c
${CMAKE_SOURCE_DIR}/stubs/nogss.c
${CMAKE_SOURCE_DIR}/stubs/no-gss.c
${CMAKE_SOURCE_DIR}/stubs/no-ca-config.c
${CMAKE_SOURCE_DIR}/stubs/norand.c
${CMAKE_SOURCE_DIR}/stubs/no-rand.c
${CMAKE_SOURCE_DIR}/proxy/nocproxy.c
${CMAKE_SOURCE_DIR}/proxy/nosshproxy.c
puttytel.rc)
@ -134,7 +134,7 @@ installed_program(puttytel)
add_executable(puttygen
puttygen.c
${CMAKE_SOURCE_DIR}/stubs/notiming.c
${CMAKE_SOURCE_DIR}/stubs/no-timing.c
noise.c
no-jump-list.c
storage.c
@ -158,9 +158,9 @@ if(HAVE_CONPTY)
pterm.c
help.c
conpty.c
${CMAKE_SOURCE_DIR}/stubs/nogss.c
${CMAKE_SOURCE_DIR}/stubs/no-gss.c
${CMAKE_SOURCE_DIR}/stubs/no-ca-config.c
${CMAKE_SOURCE_DIR}/stubs/norand.c
${CMAKE_SOURCE_DIR}/stubs/no-rand.c
${CMAKE_SOURCE_DIR}/proxy/nosshproxy.c
pterm.rc)
be_list(pterm pterm)