fix #131: add build time option: CLIENT_PREFIX
authorMichael Wallner <mike@php.net>
Mon, 27 Feb 2023 14:55:15 +0000 (15:55 +0100)
committerMichael Wallner <mike@php.net>
Tue, 28 Feb 2023 07:22:42 +0000 (08:22 +0100)
24 files changed:
CMakeConfig.txt
CMakeLists.txt
docs/CMakeLists.txt
docs/conf.py.in
docs/source/bin/common/env.rst [new file with mode: 0644]
docs/source/bin/common/note_contrib_options.rst [new file with mode: 0644]
docs/source/bin/common/note_program_prefix.rst [new file with mode: 0644]
docs/source/bin/memaslap.rst
docs/source/bin/memcapable.rst
docs/source/bin/memcat.rst
docs/source/bin/memcp.rst
docs/source/bin/memdump.rst
docs/source/bin/memerror.rst
docs/source/bin/memexist.rst
docs/source/bin/memflush.rst
docs/source/bin/memparse.rst
docs/source/bin/memping.rst
docs/source/bin/memrm.rst
docs/source/bin/memslap.rst
docs/source/bin/memstat.rst
docs/source/bin/memtouch.rst
docs/source/libmemcached/memcached_analyze.rst
src/bin/CMakeLists.txt
test/CMakeLists.txt

index 714ee94e9be2a4e9bad17cd0574d85cb7ad52691..2a8617f1ad0614b44caf09b523dd1d41ab0849bf 100644 (file)
@@ -23,6 +23,9 @@ else()
     set(TARGET_NAMELINK_COMPONENT NAMELINK_COMPONENT dev DESTINATION ${CMAKE_INSTALL_LIBDIR})
 endif()
 
+set(CLIENT_PREFIX mem
+        CACHE STRING "client prefix (default mem; i.e.: memstat, memcp, memcat ...)")
+
 option(BUILD_SHARED_LIBS    "whether to build shared libraries"
         ON)
 option(BUILD_TESTING        "whether to enable build of the test suite"
index 1603c2c40793342462a5183219d9af5bff306320..1396a42a587a35afee82ca9ab37c4caa283260ea 100644 (file)
@@ -30,19 +30,19 @@ if(NOT BUILD_DOCSONLY)
     include(CMake/_Include.cmake)
 
     set(CLIENTS
-            memcapable
-            memcat
-            memcp
-            memdump
-            memerror
-            memexist
-            memflush
-            memparse
-            memping
-            memrm
-            memslap
-            memstat
-            memtouch
+            capable
+            cat
+            cp
+            dump
+            error
+            exist
+            flush
+            parse
+            ping
+            rm
+            slap
+            stat
+            touch
             )
 
     add_subdirectory(include)
index c2d6325ab75a0e7a57460de651184058be6c99aa..8671079358419e69ce58c1e65c10abd06f221df4 100644 (file)
@@ -50,7 +50,7 @@ else()
                 COMMAND
                     ${CMAKE_COMMAND} -E touch "${SPHINX_HTML_DIR}"
                 BYPRODUCTS ${SPHINX_HTML_DIR}
-                DEPENDS "${DOCS_SOURCE}"
+                DEPENDS "${DOCS_SOURCE}" conf.py.in
                 )
         add_custom_target(html ALL DEPENDS "${SPHINX_HTML_DIR}")
 
@@ -73,7 +73,7 @@ else()
                 COMMAND
                     ${CMAKE_COMMAND} -E touch "${SPHINX_MAN_DIR}"
                 BYPRODUCTS ${SPHINX_MAN_DIR}
-                DEPENDS "${DOCS_SOURCE}"
+                DEPENDS "${DOCS_SOURCE}" conf.py.in
                 )
         add_custom_target(man ALL DEPENDS "${SPHINX_MAN_DIR}")
 
index 2c3c61307b35f8cdc2f554bc0ba3fc0513ed681e..690df35833c3a465d03ff3fe991b765d4af3e68c 100644 (file)
@@ -191,27 +191,46 @@ man_pages = [
   ('libmemcachedutil/memcached_pool'           ,'memcached_pool_st'                       ,u'libmemcached Documentation'          ,man_authors,3),
   ('libmemcachedutil/memcached_pool'           ,'memcached_pool'                          ,u'libmemcached Documentation'          ,man_authors,3),
 
-  ('bin/memcapable'                            , 'memcapable'                             , u'libmemcached Documentation'         , man_authors, 1),
-  ('bin/memcat'                                , 'memcat'                                 , u'libmemcached Documentation'         , man_authors, 1),
-  ('bin/memcp'                                 , 'memcp'                                  , u'libmemcached Documentation'         , man_authors, 1),
-  ('bin/memdump'                               , 'memdump'                                , u'libmemcached Documentation'         , man_authors, 1),
-  ('bin/memerror'                              , 'memerror'                               , u'libmemcached Documentation'         , man_authors, 1),
-  ('bin/memflush'                              , 'memflush'                               , u'libmemcached Documentation'         , man_authors, 1),
-  ('bin/memrm'                                 , 'memrm'                                  , u'libmemcached Documentation'         , man_authors, 1),
-  ('bin/memaslap'                              , 'memaslap'                               , u'libmemcached Documentation'         , man_authors, 1),
-  ('bin/memslap'                               , 'memslap'                                , u'libmemcached Documentation'         , man_authors, 1),
-  ('bin/memstat'                               , 'memstat'                                , u'libmemcached Documentation'         , man_authors, 1),
-  ('bin/memexist'                              , 'memexist'                               , u'libmemcached Documentation'         , man_authors, 1),
-  ('bin/memparse'                              , 'memparse'                               , u'libmemcached Documentation'         , man_authors, 1),
-  ('bin/memping'                               , 'memping'                                , u'libmemcached Documentation'         , man_authors, 1),
-  ('bin/memtouch'                              , 'memtouch'                               , u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memcapable'                            , 'memcapable'                             ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memcat'                                , 'memcat'                                 ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memcp'                                 , 'memcp'                                  ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memdump'                               , 'memdump'                                ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memerror'                              , 'memerror'                               ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memflush'                              , 'memflush'                               ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memrm'                                 , 'memrm'                                  ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memaslap'                              , 'memaslap'                               ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memslap'                               , 'memslap'                                ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memstat'                               , 'memstat'                                ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memexist'                              , 'memexist'                               ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memparse'                              , 'memparse'                               ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memping'                               , 'memping'                                ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memtouch'                              , 'memtouch'                               ,u'libmemcached Documentation'         , man_authors, 1),
   ]
 
+if '@CLIENT_PREFIX@' != 'mem' :
+    man_pages.extend([
+  ('bin/memcapable'                            , '@CLIENT_PREFIX@capable'                 ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memcat'                                , '@CLIENT_PREFIX@cat'                     ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memcp'                                 , '@CLIENT_PREFIX@cp'                      ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memdump'                               , '@CLIENT_PREFIX@dump'                    ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memerror'                              , '@CLIENT_PREFIX@error'                   ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memflush'                              , '@CLIENT_PREFIX@flush'                   ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memrm'                                 , '@CLIENT_PREFIX@rm'                      ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memaslap'                              , '@CLIENT_PREFIX@aslap'                   ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memslap'                               , '@CLIENT_PREFIX@slap'                    ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memstat'                               , '@CLIENT_PREFIX@stat'                    ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memexist'                              , '@CLIENT_PREFIX@exist'                   ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memparse'                              , '@CLIENT_PREFIX@parse'                   ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memping'                               , '@CLIENT_PREFIX@ping'                    ,u'libmemcached Documentation'         , man_authors, 1),
+  ('bin/memtouch'                              , '@CLIENT_PREFIX@touch'                   ,u'libmemcached Documentation'         , man_authors, 1),
+    ])
+
 rst_prolog = """
-.. |libhashkit_version| replace:: 1.0
-.. |libmemcached_version| replace:: 1.0
-.. |libmemcachedprotocol_version| replace:: 0.0
-.. |libmemcachedutil_version| replace:: 1.0
+.. |client_prefix| replace:: @CLIENT_PREFIX@
+.. |libhashkit_version| replace:: @LIBHASHKIT_VERSION_INC@
+.. |libmemcached_version| replace:: @LIBMEMCACHED_VERSION_INC@
+.. |libmemcachedprotocol_version| replace:: @LIBMEMCACHEDPROTOCOL_VERSION_INC@
+.. |libmemcachedutil_version| replace:: @LIBMEMCACHEDUTIL_VERSION_INC@
 """
 
 @SPHINX_CONF_APPEND@
diff --git a/docs/source/bin/common/env.rst b/docs/source/bin/common/env.rst
new file mode 100644 (file)
index 0000000..ac1d42e
--- /dev/null
@@ -0,0 +1,7 @@
+ENVIRONMENT
+-----------
+
+.. envvar:: MEMCACHED_SERVERS
+
+    Specify a list of servers.
+
diff --git a/docs/source/bin/common/note_contrib_options.rst b/docs/source/bin/common/note_contrib_options.rst
new file mode 100644 (file)
index 0000000..3f8f2ab
--- /dev/null
@@ -0,0 +1,8 @@
+CONTRIBUTED PROGRAM
+...................
+
+This is a contributed program.
+
+This program doesn't follow the standard flag/option scheme.
+
diff --git a/docs/source/bin/common/note_program_prefix.rst b/docs/source/bin/common/note_program_prefix.rst
new file mode 100644 (file)
index 0000000..86d7099
--- /dev/null
@@ -0,0 +1,10 @@
+
+PROGRAM PREFIX
+..............
+
+The prefix of this program is variable, i.e. it can be configured at build time.
+
+Usually the client programs of ``libmemcached-awesome`` are prefixed with ``mem``, like ``memcat`` or ``memcp``.
+
+It can be configured, though, to replace the prefix with something else like ``mc``, in case of that,
+the client programs of ``libmemcached-awesome`` would be called ``mccat``, ``mccp``, etc. respectively. 
index ab311d7398e0cdb8c8b494779660145c27c062cb..6ac3e21a91038e1f661f45cb0df011eb27eed6ce 100644 (file)
@@ -5,7 +5,7 @@ memaslap - Load testing  and benchmarking a server
 SYNOPSIS
 --------
 
-memaslap [options]
+|client_prefix|\aslap [options]
 
 .. program:: memaslap
 
@@ -1000,13 +1000,11 @@ memaslap -s 127.0.0.1:11211,127.0.0.1:11212 -F config -t 2m
 
 memaslap -s 127.0.0.1:11211,127.0.0.1:11212 -F config -t 2m -p 2
 
-NOTE
-----
-
-This is a contributed program.
-
-This program doesn't follow the standard flag/option scheme.
+NOTES
+-----
 
+.. include:: common/note_program_prefix.rst
+.. include:: common/note_contrib_options.rst
 
 SEE ALSO
 --------
index 374c9c335e98b6a4d6b5a8788c03bfaffe88b31e..ed93bd1d659e8d87f751c2ed61c7eb1b86fec292 100644 (file)
@@ -6,7 +6,7 @@ SYNOPSIS
 
 .. program:: memcapable
 
-memcapable [options]
+|client_prefix|\capable [options]
 
 Check a memcached server's capabilities and compatibility.
 
@@ -39,10 +39,12 @@ OPTIONS
 
     Set the timeout for an IO operation to/from the server to \ *n*\  seconds.
 
-NOTE
-----
 
-This program doesn't follow the standard flag/option scheme.
+NOTES
+-----
+
+.. include:: common/note_program_prefix.rst
+.. include:: common/note_contrib_options.rst
 
 
 SEE ALSO
index 36f6a6bb2ef97c305a50c141e8310df7b1766d02..6bb5ebc80da717e12110b1a10d93e568cc8e9a74 100644 (file)
@@ -6,7 +6,7 @@ SYNOPSIS
 
 .. program:: memcat
 
-memcat [options] key [key...]
+|client_prefix|\cat [options] key [key...]
 
 Read and output the value of one key or the values of a set of keys.
 
@@ -28,12 +28,12 @@ OPTIONS
 .. include:: options/hash.rst
 .. include:: options/file_out.rst
 
-ENVIRONMENT
------------
+.. include:: common/env.rst
 
-.. envvar:: MEMCACHED_SERVERS
+NOTES
+-----
 
-    Specify a list of servers.
+.. include:: common/note_program_prefix.rst
 
 SEE ALSO
 --------
index 7d82a59090c3c0126502ca18e90506fed81f6835..9106d694c77f6f7c0fab897d980834a8aaacc9f7 100644 (file)
@@ -6,7 +6,7 @@ SYNOPSIS
 
 .. program:: memcp
 
-memcp [options] \-\-servers <hostname[:port]...> <file...>
+|client_prefix|\cp [options] \-\-servers <hostname[:port]...> <file...>
 
 Copy files to a collection of memcached servers.
 
@@ -49,14 +49,14 @@ OPTIONS
 .. option:: -/|--absolute
 
     Use absolute path (real path), instead of basename only.
-    
-    
-ENVIRONMENT
------------
 
-.. envvar:: MEMCACHED_SERVERS
 
-    Specify the list of servers.
+.. include:: common/env.rst
+
+NOTES
+-----
+
+.. include:: common/note_program_prefix.rst
 
 SEE ALSO
 --------
index a24e40854a3af60b6eb33ea41c3b6672806bcc8c..7724ad314f21be8c7bc80dd989bfe86875adbc65 100644 (file)
@@ -6,7 +6,7 @@ SYNOPSIS
 
 .. program:: memdump
 
-memdump [options]
+|client_prefix|\dump [options]
 
 Dump a list of keys from a server.
 
@@ -22,13 +22,14 @@ OPTIONS
 
 .. include:: options/common_get.rst
 .. include:: options/file_out.rst
-ENVIRONMENT
------------
 
-.. envvar:: MEMCACHED_SERVERS
 
-    Specify the list of servers.
+.. include:: common/env.rst
+
+NOTES
+-----
+
+.. include:: common/note_program_prefix.rst
 
 SEE ALSO
 --------
index caa6b497657d719f14cc6f39758598f472aafbb7..e00a5b75ad11f12e583c2cb164c9f69eaa5db214 100644 (file)
@@ -6,7 +6,7 @@ SYNOPSIS
 
 .. program:: memerror
 
-memerror [options] <error code>
+|client_prefix|\error [options] <error code>
 
 Translate a memcached error code into a string.
 
@@ -22,12 +22,13 @@ OPTIONS
 .. include:: options/all.rst
 .. include:: options/common.rst
 
-ENVIRONMENT
------------
 
-.. envvar:: MEMCACHED_SERVERS
+.. include:: common/env.rst
+
+NOTES
+-----
 
-    Specify the list of servers.
+.. include:: common/note_program_prefix.rst
 
 SEE ALSO
 --------
index 52832b16149abab2b3c1aeecb93dd349ef55b0ec..85b7fd08325fed4777df9f4a8b4bd1b263e76168 100644 (file)
@@ -6,7 +6,7 @@ SYNOPSIS
 
 .. program:: memexist
 
-memexist [options] <key>
+|client_prefix|\exist [options] <key>
 
 Check for the existence of a key.
 
@@ -21,12 +21,12 @@ OPTIONS
 .. include:: options/common_get.rst
 .. include:: options/hash.rst
 
-ENVIRONMENT
------------
+.. include:: common/env.rst
 
-.. envvar:: MEMCACHED_SERVERS
+NOTES
+-----
 
-    Specify the list of servers.
+.. include:: common/note_program_prefix.rst
 
 SEE ALSO
 --------
index b752b6eb8861613e8706229ee578d837019b6f17..dc04ca630854d422da44788ab32923238af3efa4 100644 (file)
@@ -4,7 +4,7 @@ memflush
 SYNOPSIS
 --------
 
-memflush [options]
+|client_prefix|\flush [options]
 
 .. program:: memflush
 
@@ -51,12 +51,13 @@ OPTIONS
 
 .. _memcached protocol documentation: https://github.com/memcached/memcached/blob/master/doc/protocol.txt
 
-ENVIRONMENT
------------
 
-.. envvar:: MEMCACHED_SERVERS
+.. include:: common/env.rst
+
+NOTES
+-----
 
-    Specify the list of servers.
+.. include:: common/note_program_prefix.rst
 
 SEE ALSO
 --------
index 4a6f41358323525a5615357811cdef1794cb82d6..4c96aae1371c9eff1cc42f1385f29207bc209f48 100644 (file)
@@ -6,7 +6,7 @@ SYNOPSIS
 
 .. program:: memparse
 
-memparse <option string>
+|client_prefix|\parse <option string>
 
 Parse and validate an option string.
 
@@ -20,6 +20,12 @@ OPTIONS
 
 None.
 
+NOTES
+-----
+.. include:: common/note_program_prefix.rst
+
+
 SEE ALSO
 --------
 
index aaae7a7a09410345c2089b6f39fd7b0d1db45166..fc08b27e87926f420c802e211d390db0d3f0def3 100644 (file)
@@ -4,7 +4,7 @@ memping
 SYNOPSIS
 --------
 
-memping [options] [server]
+|client_prefix|\ping [options] [server]
 
 .. program:: memping
 
@@ -27,12 +27,12 @@ OPTIONS
     Specify the list of servers as *hostname[:port][,hostname[:port]...]*.
 
 
-ENVIRONMENT
------------
+.. include:: common/env.rst
 
-.. envvar:: MEMCACHED_SERVERS
+NOTES
+-----
 
-    Specify the list of servers.
+.. include:: common/note_program_prefix.rst
 
 SEE ALSO
 --------
index 94da5a7be47ee7729ff62e89b72d6a6eaae1549d..88d8d2dcc6e4867e5cc8c1fd1f0d812f2e99a1a7 100644 (file)
@@ -4,7 +4,7 @@ memrm
 SYNOPSIS
 --------
 
-memrm [options] <key ...>
+|client_prefix|\rm [options] <key ...>
 
 .. program:: memrm
 
@@ -20,12 +20,12 @@ OPTIONS
 
 .. include:: options/common_set.rst
 
-ENVIRONMENT
------------
+.. include:: common/env.rst
 
-.. envvar:: MEMCACHED_SERVERS
+NOTES
+-----
 
-    Specify the list of servers.
+.. include:: common/note_program_prefix.rst
 
 SEE ALSO
 --------
index bd99ab4975d8c7b61141ed6a96ec6c5d16e70752..c5e8ba0208f44f4743cf47e90dc931d745885e89 100644 (file)
@@ -4,7 +4,7 @@ memslap
 SYNOPSIS
 --------
 
-memslap [options]
+|client_prefix|\slap [options]
 
 .. program::  memslap
 
@@ -50,12 +50,12 @@ OPTIONS
     Number of keys to load before executing tests (default: 10000).
 
 
-ENVIRONMENT
------------
+.. include:: common/env.rst
 
-.. envvar:: MEMCACHED_SERVERS
+NOTES
+-----
 
-    Specify the list of servers.
+.. include:: common/note_program_prefix.rst
 
 SEE ALSO
 --------
index 7c2b96251bd6dd8c44a294a134a4fc98e55d8a3d..61f4273ca512e6714ff213e8f7e581f0b1ccaacb 100644 (file)
@@ -4,7 +4,7 @@ memstat
 SYNOPSIS
 --------
 
-memstat [options] [stat args] 
+|client_prefix|\stat [options] [stat args] 
 
 .. program:: memstat
 
@@ -49,12 +49,12 @@ OPTIONS
     Iteration count of GETs sent by the latency test (default: 1000).
 
 
-ENVIRONMENT
------------
+.. include:: common/env.rst
 
-.. envvar:: MEMCACHED_SERVERS
+NOTES
+-----
 
-    Specify the list of servers.
+.. include:: common/note_program_prefix.rst
 
 SEE ALSO
 --------
index c9e03406916178086d7d9b8e3a79e183cf67d16d..fc5895ff5c69d321ebe4da8b3194a5bae345ed31 100644 (file)
@@ -6,7 +6,7 @@ SYNOPSIS
 
 .. program:: memtouch
 
-memtouch [options] <key>
+|client_prefix|\touch [options] <key>
 
 DESCRIPTION
 -----------
@@ -20,6 +20,13 @@ OPTIONS
 .. include:: options/hash.rst
 .. include:: options/expire.rst
 
+.. include:: common/env.rst
+
+NOTES
+-----
+
+.. include:: common/note_program_prefix.rst
+
 SEE ALSO
 --------
 
index 74c7541ca7785647e7d7cb9be9d0522648e596c9..0dc9842022c8629a3283528c7c4f3c9b2651a352 100644 (file)
@@ -28,7 +28,7 @@ structure.
 and sets the result to the `memcached_analysis_st` structure. The return value
 must be freed by the calling application.
 
-.. seealso:: :option:`memstat --analyze`
+.. seealso:: :option:`memstat -a|--analyze [<arg>]`
     A command line tool to analyze a memcached server.
 
 
index d28d821c3feac0c814419c121727ba233e20a77d..7f9e36e22efc2629e288ce75bbe053b3bc334f0a 100644 (file)
@@ -1,8 +1,8 @@
 add_subdirectory(common)
 
 foreach(CLIENT IN LISTS CLIENTS)
-    add_executable(${CLIENT} ${CLIENT}.cc)
-    set_property(TARGET ${CLIENT} PROPERTY CXX_STANDARD ${CXX_STANDARD})
+    add_executable(${CLIENT} mem${CLIENT}.cc)
+    set_property(TARGET ${CLIENT} OUTPUT_NAME ${CLIENT_PREFIX}${CLIENT} PROPERTY CXX_STANDARD ${CXX_STANDARD})
     target_include_directories(${CLIENT} PRIVATE ..)
     target_link_libraries(${CLIENT} PRIVATE libclient_common)
     if(CMAKE_INSTALL_RPATH)
@@ -14,9 +14,9 @@ endforeach()
 
 # extra sources
 
-target_sources(memcapable PRIVATE ../libmemcached/byteorder.cc)
+target_sources(capable PRIVATE ../libmemcached/byteorder.cc)
 
 # extra libs
 
-target_link_libraries(memping PRIVATE libmemcachedutil)
-target_link_libraries(memslap PRIVATE Threads::Threads)
+target_link_libraries(ping PRIVATE libmemcachedutil)
+target_link_libraries(slap PRIVATE Threads::Threads)
index efc3e70874ac759eb73ba2228e46a8841afc27b0..67cd47c69feef602275422af603ea0e8139f4d68 100644 (file)
@@ -70,7 +70,7 @@ endif()
 add_dependencies(runtests ${CLIENTS} timeout)
 if(TARGET memaslap)
     configure_set(HAVE_MEMASLAP 1)
-    add_dependencies(runtests memaslap)
+    add_dependencies(runtests aslap)
 endif()
 
 configure_file(${CONFIGURE_FILE_IN} ${CONFIGURE_FILE_OUT} @ONLY)