From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladislav Shpilevoy Subject: [PATCH 2/2] Move 'core' and 'uuid' libs to src/lib Date: Mon, 25 Feb 2019 23:56:47 +0300 Message-Id: In-Reply-To: References: In-Reply-To: References: To: tarantool-patches@freelists.org Cc: vdavydov.dev@gmail.com List-ID: For the same reason why 'uri' was moved to src/lib - SWIM needs core and uuid, and SWIM will live in src/lib. This commit follows 'uri' relocation as a separate one because 'uri' relocation required some changes in the files, moved by this commit. Needed for #3234 --- CMakeLists.txt | 2 + src/CMakeLists.txt | 71 +++--------------------------- src/lib/CMakeLists.txt | 2 + src/lib/core/CMakeLists.txt | 49 +++++++++++++++++++++ src/{ => lib/core}/assoc.c | 0 src/{ => lib/core}/assoc.h | 0 src/{ => lib/core}/backtrace.cc | 0 src/{ => lib/core}/backtrace.h | 0 src/{ => lib/core}/cbus.c | 0 src/{ => lib/core}/cbus.h | 0 src/{ => lib/core}/clock.c | 0 src/{ => lib/core}/clock.h | 0 src/{ => lib/core}/coio.cc | 0 src/{ => lib/core}/coio.h | 0 src/{ => lib/core}/coio_buf.cc | 0 src/{ => lib/core}/coio_buf.h | 0 src/{ => lib/core}/coio_file.c | 0 src/{ => lib/core}/coio_file.h | 0 src/{ => lib/core}/coio_task.c | 0 src/{ => lib/core}/coio_task.h | 0 src/{ => lib/core}/coll.c | 0 src/{ => lib/core}/coll.h | 0 src/{ => lib/core}/coll_def.c | 0 src/{ => lib/core}/coll_def.h | 0 src/{ => lib/core}/diag.c | 0 src/{ => lib/core}/diag.h | 0 src/{ => lib/core}/errinj.c | 0 src/{ => lib/core}/errinj.h | 0 src/{ => lib/core}/evio.c | 0 src/{ => lib/core}/evio.h | 0 src/{ => lib/core}/exception.cc | 0 src/{ => lib/core}/exception.h | 0 src/{ => lib/core}/fiber.c | 0 src/{ => lib/core}/fiber.h | 0 src/{ => lib/core}/fiber_channel.c | 0 src/{ => lib/core}/fiber_channel.h | 0 src/{ => lib/core}/fiber_cond.c | 0 src/{ => lib/core}/fiber_cond.h | 0 src/{ => lib/core}/fiber_pool.c | 0 src/{ => lib/core}/fiber_pool.h | 0 src/{ => lib/core}/fio.c | 0 src/{ => lib/core}/fio.h | 0 src/{ => lib/core}/http_parser.c | 0 src/{ => lib/core}/http_parser.h | 0 src/{ => lib/core}/latch.c | 0 src/{ => lib/core}/latch.h | 0 src/{ => lib/core}/memory.c | 0 src/{ => lib/core}/memory.h | 0 src/{ => lib/core}/mpstream.c | 0 src/{ => lib/core}/mpstream.h | 0 src/{ => lib/core}/port.c | 0 src/{ => lib/core}/port.h | 0 src/{ => lib/core}/random.c | 0 src/{ => lib/core}/random.h | 0 src/{ => lib/core}/ratelimit.h | 0 src/{ => lib/core}/reflection.c | 0 src/{ => lib/core}/reflection.h | 0 src/{ => lib/core}/say.c | 0 src/{ => lib/core}/say.h | 0 src/{ => lib/core}/sio.c | 0 src/{ => lib/core}/sio.h | 0 src/{ => lib/core}/trigger.cc | 0 src/{ => lib/core}/trigger.h | 0 src/{ => lib/core}/util.c | 0 src/lib/uuid/CMakeLists.txt | 2 + src/{ => lib/uuid}/tt_uuid.c | 0 src/{ => lib/uuid}/tt_uuid.h | 0 src/lua/httpc.c | 2 +- test/unit/CMakeLists.txt | 4 +- 69 files changed, 65 insertions(+), 67 deletions(-) create mode 100644 src/lib/core/CMakeLists.txt rename src/{ => lib/core}/assoc.c (100%) rename src/{ => lib/core}/assoc.h (100%) rename src/{ => lib/core}/backtrace.cc (100%) rename src/{ => lib/core}/backtrace.h (100%) rename src/{ => lib/core}/cbus.c (100%) rename src/{ => lib/core}/cbus.h (100%) rename src/{ => lib/core}/clock.c (100%) rename src/{ => lib/core}/clock.h (100%) rename src/{ => lib/core}/coio.cc (100%) rename src/{ => lib/core}/coio.h (100%) rename src/{ => lib/core}/coio_buf.cc (100%) rename src/{ => lib/core}/coio_buf.h (100%) rename src/{ => lib/core}/coio_file.c (100%) rename src/{ => lib/core}/coio_file.h (100%) rename src/{ => lib/core}/coio_task.c (100%) rename src/{ => lib/core}/coio_task.h (100%) rename src/{ => lib/core}/coll.c (100%) rename src/{ => lib/core}/coll.h (100%) rename src/{ => lib/core}/coll_def.c (100%) rename src/{ => lib/core}/coll_def.h (100%) rename src/{ => lib/core}/diag.c (100%) rename src/{ => lib/core}/diag.h (100%) rename src/{ => lib/core}/errinj.c (100%) rename src/{ => lib/core}/errinj.h (100%) rename src/{ => lib/core}/evio.c (100%) rename src/{ => lib/core}/evio.h (100%) rename src/{ => lib/core}/exception.cc (100%) rename src/{ => lib/core}/exception.h (100%) rename src/{ => lib/core}/fiber.c (100%) rename src/{ => lib/core}/fiber.h (100%) rename src/{ => lib/core}/fiber_channel.c (100%) rename src/{ => lib/core}/fiber_channel.h (100%) rename src/{ => lib/core}/fiber_cond.c (100%) rename src/{ => lib/core}/fiber_cond.h (100%) rename src/{ => lib/core}/fiber_pool.c (100%) rename src/{ => lib/core}/fiber_pool.h (100%) rename src/{ => lib/core}/fio.c (100%) rename src/{ => lib/core}/fio.h (100%) rename src/{ => lib/core}/http_parser.c (100%) rename src/{ => lib/core}/http_parser.h (100%) rename src/{ => lib/core}/latch.c (100%) rename src/{ => lib/core}/latch.h (100%) rename src/{ => lib/core}/memory.c (100%) rename src/{ => lib/core}/memory.h (100%) rename src/{ => lib/core}/mpstream.c (100%) rename src/{ => lib/core}/mpstream.h (100%) rename src/{ => lib/core}/port.c (100%) rename src/{ => lib/core}/port.h (100%) rename src/{ => lib/core}/random.c (100%) rename src/{ => lib/core}/random.h (100%) rename src/{ => lib/core}/ratelimit.h (100%) rename src/{ => lib/core}/reflection.c (100%) rename src/{ => lib/core}/reflection.h (100%) rename src/{ => lib/core}/say.c (100%) rename src/{ => lib/core}/say.h (100%) rename src/{ => lib/core}/sio.c (100%) rename src/{ => lib/core}/sio.h (100%) rename src/{ => lib/core}/trigger.cc (100%) rename src/{ => lib/core}/trigger.h (100%) rename src/{ => lib/core}/util.c (100%) create mode 100644 src/lib/uuid/CMakeLists.txt rename src/{ => lib/uuid}/tt_uuid.c (100%) rename src/{ => lib/uuid}/tt_uuid.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index c2606de23..0e2784a57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -207,6 +207,8 @@ include_directories(${PROJECT_BINARY_DIR}/src) include_directories(${PROJECT_SOURCE_DIR}/src/lib) include_directories(${PROJECT_SOURCE_DIR}/src/lib/small) include_directories(${PROJECT_SOURCE_DIR}/src/lib/small/third_party) +include_directories(${PROJECT_SOURCE_DIR}/src/lib/uuid) +include_directories(${PROJECT_SOURCE_DIR}/src/lib/core) include_directories(${PROJECT_SOURCE_DIR}) # diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1abde73b3..06e150886 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -73,66 +73,9 @@ if(NOT "${DL_LIBRARY}" STREQUAL "DL_LIBRARY-NOTFOUND") set(generic_libraries ${generic_libraries} dl) endif() -set (core_sources - diag.c - say.c - memory.c - clock.c - fiber.c - backtrace.cc - cbus.c - fiber_pool.c - fiber_cond.c - fiber_channel.c - latch.c - sio.c - evio.c - coio.cc - coio_task.c - coio_file.c - coio_buf.cc - fio.c - cbus.c - exception.cc - errinj.c - reflection.c - assoc.c - util.c - random.c - trigger.cc - http_parser.c - coll.c - coll_def.c - mpstream.c - port.c - ) - -if (TARGET_OS_NETBSD) - # A workaround for "undefined reference to `__gcc_personality_v0'" - # on x86_64-rumprun-netbsd-gcc - set_source_files_properties(util.c PROPERTIES COMPILE_FLAGS - -fno-exceptions) -endif () - -add_library(core STATIC ${core_sources}) -target_link_libraries(core - salad small uri - ${LIBEV_LIBRARIES} - ${LIBEIO_LIBRARIES} - ${LIBCORO_LIBRARIES} - ${MSGPUCK_LIBRARIES} - ${generic_libraries}) - add_library(stat STATIC rmean.c latency.c histogram.c) target_link_libraries(stat core) -if (ENABLE_BACKTRACE AND NOT TARGET_OS_DARWIN) - target_link_libraries(core gcc_s ${UNWIND_LIBRARIES}) -endif() - -add_library(uuid STATIC tt_uuid.c) -target_link_libraries(uuid core bit) - add_library(scramble STATIC scramble.c) target_link_libraries(scramble core misc) @@ -183,11 +126,11 @@ set (server_sources set(api_headers ${CMAKE_BINARY_DIR}/src/trivia/config.h ${CMAKE_SOURCE_DIR}/src/trivia/util.h - ${CMAKE_SOURCE_DIR}/src/say.h - ${CMAKE_SOURCE_DIR}/src/fiber.h - ${CMAKE_SOURCE_DIR}/src/fiber_cond.h - ${CMAKE_SOURCE_DIR}/src/coio.h - ${CMAKE_SOURCE_DIR}/src/coio_task.h + ${CMAKE_SOURCE_DIR}/src/lib/core/say.h + ${CMAKE_SOURCE_DIR}/src/lib/core/fiber.h + ${CMAKE_SOURCE_DIR}/src/lib/core/fiber_cond.h + ${CMAKE_SOURCE_DIR}/src/lib/core/coio.h + ${CMAKE_SOURCE_DIR}/src/lib/core/coio_task.h ${CMAKE_SOURCE_DIR}/src/lua/utils.h ${CMAKE_SOURCE_DIR}/src/lua/error.h ${CMAKE_SOURCE_DIR}/src/lua/string.h @@ -204,8 +147,8 @@ set(api_headers ${CMAKE_SOURCE_DIR}/src/box/error.h ${CMAKE_SOURCE_DIR}/src/box/lua/call.h ${CMAKE_SOURCE_DIR}/src/box/lua/tuple.h - ${CMAKE_SOURCE_DIR}/src/latch.h - ${CMAKE_SOURCE_DIR}/src/clock.h + ${CMAKE_SOURCE_DIR}/src/lib/core/latch.h + ${CMAKE_SOURCE_DIR}/src/lib/core/clock.h ) rebuild_module_api(${api_headers}) diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index e06934486..6c06a393f 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -6,6 +6,8 @@ add_subdirectory(salad) add_subdirectory(csv) add_subdirectory(json) add_subdirectory(uri) +add_subdirectory(core) +add_subdirectory(uuid) if(ENABLE_BUNDLED_MSGPUCK) add_subdirectory(msgpuck EXCLUDE_FROM_ALL) endif() diff --git a/src/lib/core/CMakeLists.txt b/src/lib/core/CMakeLists.txt new file mode 100644 index 000000000..098861505 --- /dev/null +++ b/src/lib/core/CMakeLists.txt @@ -0,0 +1,49 @@ +set(core_sources + diag.c + say.c + memory.c + clock.c + fiber.c + backtrace.cc + cbus.c + fiber_pool.c + fiber_cond.c + fiber_channel.c + latch.c + sio.c + evio.c + coio.cc + coio_task.c + coio_file.c + coio_buf.cc + fio.c + exception.cc + errinj.c + reflection.c + assoc.c + util.c + random.c + trigger.cc + http_parser.c + coll.c + coll_def.c + mpstream.c + port.c +) + +if (TARGET_OS_NETBSD) + # A workaround for "undefined reference to `__gcc_personality_v0'" + # on x86_64-rumprun-netbsd-gcc + set_source_files_properties(util.c PROPERTIES COMPILE_FLAGS + -fno-exceptions) +endif() + +add_library(core STATIC ${core_sources}) + +target_link_libraries(core salad small uri ${LIBEV_LIBRARIES} + ${LIBEIO_LIBRARIES} ${LIBCORO_LIBRARIES} + ${MSGPUCK_LIBRARIES}) + +if (ENABLE_BACKTRACE AND NOT TARGET_OS_DARWIN) + target_link_libraries(core gcc_s ${UNWIND_LIBRARIES}) +endif() diff --git a/src/assoc.c b/src/lib/core/assoc.c similarity index 100% rename from src/assoc.c rename to src/lib/core/assoc.c diff --git a/src/assoc.h b/src/lib/core/assoc.h similarity index 100% rename from src/assoc.h rename to src/lib/core/assoc.h diff --git a/src/backtrace.cc b/src/lib/core/backtrace.cc similarity index 100% rename from src/backtrace.cc rename to src/lib/core/backtrace.cc diff --git a/src/backtrace.h b/src/lib/core/backtrace.h similarity index 100% rename from src/backtrace.h rename to src/lib/core/backtrace.h diff --git a/src/cbus.c b/src/lib/core/cbus.c similarity index 100% rename from src/cbus.c rename to src/lib/core/cbus.c diff --git a/src/cbus.h b/src/lib/core/cbus.h similarity index 100% rename from src/cbus.h rename to src/lib/core/cbus.h diff --git a/src/clock.c b/src/lib/core/clock.c similarity index 100% rename from src/clock.c rename to src/lib/core/clock.c diff --git a/src/clock.h b/src/lib/core/clock.h similarity index 100% rename from src/clock.h rename to src/lib/core/clock.h diff --git a/src/coio.cc b/src/lib/core/coio.cc similarity index 100% rename from src/coio.cc rename to src/lib/core/coio.cc diff --git a/src/coio.h b/src/lib/core/coio.h similarity index 100% rename from src/coio.h rename to src/lib/core/coio.h diff --git a/src/coio_buf.cc b/src/lib/core/coio_buf.cc similarity index 100% rename from src/coio_buf.cc rename to src/lib/core/coio_buf.cc diff --git a/src/coio_buf.h b/src/lib/core/coio_buf.h similarity index 100% rename from src/coio_buf.h rename to src/lib/core/coio_buf.h diff --git a/src/coio_file.c b/src/lib/core/coio_file.c similarity index 100% rename from src/coio_file.c rename to src/lib/core/coio_file.c diff --git a/src/coio_file.h b/src/lib/core/coio_file.h similarity index 100% rename from src/coio_file.h rename to src/lib/core/coio_file.h diff --git a/src/coio_task.c b/src/lib/core/coio_task.c similarity index 100% rename from src/coio_task.c rename to src/lib/core/coio_task.c diff --git a/src/coio_task.h b/src/lib/core/coio_task.h similarity index 100% rename from src/coio_task.h rename to src/lib/core/coio_task.h diff --git a/src/coll.c b/src/lib/core/coll.c similarity index 100% rename from src/coll.c rename to src/lib/core/coll.c diff --git a/src/coll.h b/src/lib/core/coll.h similarity index 100% rename from src/coll.h rename to src/lib/core/coll.h diff --git a/src/coll_def.c b/src/lib/core/coll_def.c similarity index 100% rename from src/coll_def.c rename to src/lib/core/coll_def.c diff --git a/src/coll_def.h b/src/lib/core/coll_def.h similarity index 100% rename from src/coll_def.h rename to src/lib/core/coll_def.h diff --git a/src/diag.c b/src/lib/core/diag.c similarity index 100% rename from src/diag.c rename to src/lib/core/diag.c diff --git a/src/diag.h b/src/lib/core/diag.h similarity index 100% rename from src/diag.h rename to src/lib/core/diag.h diff --git a/src/errinj.c b/src/lib/core/errinj.c similarity index 100% rename from src/errinj.c rename to src/lib/core/errinj.c diff --git a/src/errinj.h b/src/lib/core/errinj.h similarity index 100% rename from src/errinj.h rename to src/lib/core/errinj.h diff --git a/src/evio.c b/src/lib/core/evio.c similarity index 100% rename from src/evio.c rename to src/lib/core/evio.c diff --git a/src/evio.h b/src/lib/core/evio.h similarity index 100% rename from src/evio.h rename to src/lib/core/evio.h diff --git a/src/exception.cc b/src/lib/core/exception.cc similarity index 100% rename from src/exception.cc rename to src/lib/core/exception.cc diff --git a/src/exception.h b/src/lib/core/exception.h similarity index 100% rename from src/exception.h rename to src/lib/core/exception.h diff --git a/src/fiber.c b/src/lib/core/fiber.c similarity index 100% rename from src/fiber.c rename to src/lib/core/fiber.c diff --git a/src/fiber.h b/src/lib/core/fiber.h similarity index 100% rename from src/fiber.h rename to src/lib/core/fiber.h diff --git a/src/fiber_channel.c b/src/lib/core/fiber_channel.c similarity index 100% rename from src/fiber_channel.c rename to src/lib/core/fiber_channel.c diff --git a/src/fiber_channel.h b/src/lib/core/fiber_channel.h similarity index 100% rename from src/fiber_channel.h rename to src/lib/core/fiber_channel.h diff --git a/src/fiber_cond.c b/src/lib/core/fiber_cond.c similarity index 100% rename from src/fiber_cond.c rename to src/lib/core/fiber_cond.c diff --git a/src/fiber_cond.h b/src/lib/core/fiber_cond.h similarity index 100% rename from src/fiber_cond.h rename to src/lib/core/fiber_cond.h diff --git a/src/fiber_pool.c b/src/lib/core/fiber_pool.c similarity index 100% rename from src/fiber_pool.c rename to src/lib/core/fiber_pool.c diff --git a/src/fiber_pool.h b/src/lib/core/fiber_pool.h similarity index 100% rename from src/fiber_pool.h rename to src/lib/core/fiber_pool.h diff --git a/src/fio.c b/src/lib/core/fio.c similarity index 100% rename from src/fio.c rename to src/lib/core/fio.c diff --git a/src/fio.h b/src/lib/core/fio.h similarity index 100% rename from src/fio.h rename to src/lib/core/fio.h diff --git a/src/http_parser.c b/src/lib/core/http_parser.c similarity index 100% rename from src/http_parser.c rename to src/lib/core/http_parser.c diff --git a/src/http_parser.h b/src/lib/core/http_parser.h similarity index 100% rename from src/http_parser.h rename to src/lib/core/http_parser.h diff --git a/src/latch.c b/src/lib/core/latch.c similarity index 100% rename from src/latch.c rename to src/lib/core/latch.c diff --git a/src/latch.h b/src/lib/core/latch.h similarity index 100% rename from src/latch.h rename to src/lib/core/latch.h diff --git a/src/memory.c b/src/lib/core/memory.c similarity index 100% rename from src/memory.c rename to src/lib/core/memory.c diff --git a/src/memory.h b/src/lib/core/memory.h similarity index 100% rename from src/memory.h rename to src/lib/core/memory.h diff --git a/src/mpstream.c b/src/lib/core/mpstream.c similarity index 100% rename from src/mpstream.c rename to src/lib/core/mpstream.c diff --git a/src/mpstream.h b/src/lib/core/mpstream.h similarity index 100% rename from src/mpstream.h rename to src/lib/core/mpstream.h diff --git a/src/port.c b/src/lib/core/port.c similarity index 100% rename from src/port.c rename to src/lib/core/port.c diff --git a/src/port.h b/src/lib/core/port.h similarity index 100% rename from src/port.h rename to src/lib/core/port.h diff --git a/src/random.c b/src/lib/core/random.c similarity index 100% rename from src/random.c rename to src/lib/core/random.c diff --git a/src/random.h b/src/lib/core/random.h similarity index 100% rename from src/random.h rename to src/lib/core/random.h diff --git a/src/ratelimit.h b/src/lib/core/ratelimit.h similarity index 100% rename from src/ratelimit.h rename to src/lib/core/ratelimit.h diff --git a/src/reflection.c b/src/lib/core/reflection.c similarity index 100% rename from src/reflection.c rename to src/lib/core/reflection.c diff --git a/src/reflection.h b/src/lib/core/reflection.h similarity index 100% rename from src/reflection.h rename to src/lib/core/reflection.h diff --git a/src/say.c b/src/lib/core/say.c similarity index 100% rename from src/say.c rename to src/lib/core/say.c diff --git a/src/say.h b/src/lib/core/say.h similarity index 100% rename from src/say.h rename to src/lib/core/say.h diff --git a/src/sio.c b/src/lib/core/sio.c similarity index 100% rename from src/sio.c rename to src/lib/core/sio.c diff --git a/src/sio.h b/src/lib/core/sio.h similarity index 100% rename from src/sio.h rename to src/lib/core/sio.h diff --git a/src/trigger.cc b/src/lib/core/trigger.cc similarity index 100% rename from src/trigger.cc rename to src/lib/core/trigger.cc diff --git a/src/trigger.h b/src/lib/core/trigger.h similarity index 100% rename from src/trigger.h rename to src/lib/core/trigger.h diff --git a/src/util.c b/src/lib/core/util.c similarity index 100% rename from src/util.c rename to src/lib/core/util.c diff --git a/src/lib/uuid/CMakeLists.txt b/src/lib/uuid/CMakeLists.txt new file mode 100644 index 000000000..581e4495a --- /dev/null +++ b/src/lib/uuid/CMakeLists.txt @@ -0,0 +1,2 @@ +add_library(uuid STATIC tt_uuid.c) +target_link_libraries(uuid core bit) diff --git a/src/tt_uuid.c b/src/lib/uuid/tt_uuid.c similarity index 100% rename from src/tt_uuid.c rename to src/lib/uuid/tt_uuid.c diff --git a/src/tt_uuid.h b/src/lib/uuid/tt_uuid.h similarity index 100% rename from src/tt_uuid.h rename to src/lib/uuid/tt_uuid.h diff --git a/src/lua/httpc.c b/src/lua/httpc.c index e5b86b07c..dc61e4d09 100644 --- a/src/lua/httpc.c +++ b/src/lua/httpc.c @@ -39,7 +39,7 @@ #include "say.h" #include "lua/utils.h" #include "lua/httpc.h" -#include "src/fiber.h" +#include "core/fiber.h" /** Internal util functions * {{{ diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index 16739f75d..18118d374 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -123,9 +123,9 @@ add_executable(find_path.test find_path.c ) add_executable(reflection_c.test reflection_c.c unit.c - ${CMAKE_SOURCE_DIR}/src/reflection.c) + ${CMAKE_SOURCE_DIR}/src/lib/core/reflection.c) add_executable(reflection_cxx.test reflection_cxx.cc unit.c - ${CMAKE_SOURCE_DIR}/src/reflection.c) + ${CMAKE_SOURCE_DIR}/src/lib/core/reflection.c) add_executable(csv.test csv.c) target_link_libraries(csv.test csv) -- 2.17.2 (Apple Git-113)