summaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorinfo@mode42.com <info@mode42.com>2026-08-08 03:54:55 +0000
committerinfo@mode42.com <info@mode42.com>2026-08-08 03:54:55 +0000
commit20cb29c2f8c5c87bc590896854a20b1473ceb358 (patch)
tree2857f41513a56ad41af97b57362639298aa7f033 /src/CMakeLists.txt
#2
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt204
1 files changed, 204 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..e26bbcd
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,204 @@
+if(HYBBX_BUILD_DAEMON)
+ add_library(hybbx_core STATIC
+ core/registry.c
+ core/service.c
+ core/config.c
+ core/instance.c
+ core/circuit.c
+ core/circuit_tcp.c
+ core/circuit_bridge.c
+ core/circuit_balance.c
+ core/bandwidth_policy.c
+ core/broadcast.c
+ core/link.c
+ core/command.c
+ core/command_parse.c
+ core/commands_registry.c
+ core/auth.c
+ core/password.c
+ core/crypto_config.c
+ core/crypto_backends.c
+ core/crypto.c
+ core/traffic.c
+ core/storage.c
+ core/storage_flatfile.c
+ core/storage_sql.c
+ core/mail_sql.c
+ core/proxymail.c
+ core/proxychat.c
+ core/session.c
+ core/chat.c
+ core/conference.c
+ core/mail.c
+ core/messages.c
+ core/mains_proxy.c
+ core/networks.c
+ core/instance.c
+ core/crdop.c
+ core/terminal.c
+ core/texts.c
+ core/util.c
+ core/log.c
+ core/monitor.c
+ core/max25.c
+ core/security.c
+ core/security_ban.c
+ core/daemon_wrap.c
+ core/privilege.c
+ core/rf_tx_pace.c
+ clients/circuit_client.c
+ clients/link_auth.c
+ ${CMAKE_SOURCE_DIR}/third_party/tinysha256/tinysha256.c
+ ${CMAKE_SOURCE_DIR}/third_party/monocypher/monocypher.c
+ ${CMAKE_SOURCE_DIR}/third_party/tinyaes/aes.c
+ ${CMAKE_SOURCE_DIR}/third_party/tinyaes/aes256gcm.c
+ )
+
+ if(HYBBX_HAVE_OPENSSL)
+ target_sources(hybbx_core PRIVATE core/crypto_openssl.c)
+ endif()
+
+ if(HYBBX_HAVE_LIBSODIUM)
+ target_sources(hybbx_core PRIVATE core/crypto_libsodium.c)
+ endif()
+
+ add_library(HyBBX::core ALIAS hybbx_core)
+
+ target_include_directories(hybbx_core
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
+ $<INSTALL_INTERFACE:${HYBBX_INSTALL_HOME}/include>
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/core
+ ${CMAKE_SOURCE_DIR}/third_party/tinysha256
+ ${CMAKE_SOURCE_DIR}/third_party/monocypher
+ ${CMAKE_SOURCE_DIR}/third_party/tinyaes
+ )
+
+ target_compile_definitions(hybbx_core
+ PRIVATE
+ HYBBX_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}
+ HYBBX_VERSION_MINOR=${PROJECT_VERSION_MINOR}
+ HYBBX_VERSION_PATCH=${PROJECT_VERSION_PATCH}
+ )
+
+ hybbx_apply_hardening(hybbx_core)
+
+ find_package(Threads REQUIRED)
+ target_link_libraries(hybbx_core PUBLIC Threads::Threads)
+
+ if(HYBBX_HAVE_OPENSSL)
+ target_compile_definitions(hybbx_core PRIVATE HYBBX_HAVE_OPENSSL)
+ target_link_libraries(hybbx_core PRIVATE OpenSSL::Crypto)
+ endif()
+
+ if(HYBBX_HAVE_LIBSODIUM)
+ target_compile_definitions(hybbx_core PRIVATE HYBBX_HAVE_LIBSODIUM)
+ target_include_directories(hybbx_core PRIVATE ${LIBSODIUM_INCLUDE_DIRS})
+ target_link_directories(hybbx_core PRIVATE ${LIBSODIUM_LIBRARY_DIRS})
+ target_link_libraries(hybbx_core PRIVATE ${LIBSODIUM_LIBRARIES})
+ endif()
+
+ if(HYBBX_HAVE_SQLITE)
+ target_compile_definitions(hybbx_core PRIVATE HYBBX_HAVE_SQLITE)
+ target_include_directories(hybbx_core PRIVATE ${SQLITE3_INCLUDE_DIRS})
+ target_link_directories(hybbx_core PRIVATE ${SQLITE3_LIBRARY_DIRS})
+ target_link_libraries(hybbx_core PRIVATE ${SQLITE3_LIBRARIES})
+ endif()
+
+ add_executable(hybbxd main.c instance_role_main.c)
+ add_executable(hybbxsd main.c instance_role_secondary.c)
+ add_executable(hybbxpd main.c instance_role_proxy.c)
+
+ foreach(_bin IN ITEMS hybbxd hybbxsd hybbxpd)
+ target_link_libraries(${_bin} PRIVATE hybbx_core)
+ hybbx_apply_hardening_executable(${_bin})
+ endforeach()
+
+ install(TARGETS hybbxd hybbxsd hybbxpd hybbx_core
+ EXPORT HyBBXTargets
+ RUNTIME DESTINATION ${HYBBX_INSTALL_HOME}
+ )
+
+ if(HYBBX_INSTALL_DEV)
+ install(TARGETS hybbx_core
+ EXPORT HyBBXTargets
+ LIBRARY DESTINATION ${HYBBX_INSTALL_HOME}/lib
+ ARCHIVE DESTINATION ${HYBBX_INSTALL_HOME}/lib
+ )
+
+ install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/hybbx
+ DESTINATION ${HYBBX_INSTALL_HOME}/include
+ FILES_MATCHING PATTERN "*.h"
+ )
+
+ install(EXPORT HyBBXTargets
+ FILE HyBBXTargets.cmake
+ NAMESPACE HyBBX::
+ DESTINATION ${HYBBX_INSTALL_HOME}/lib/cmake/HyBBX
+ )
+ endif()
+
+ install(FILES
+ ${CMAKE_SOURCE_DIR}/share/hybbx.ini.example
+ ${CMAKE_SOURCE_DIR}/share/hybbxd-main.ini.example
+ ${CMAKE_SOURCE_DIR}/share/hybbxsd-secondary.ini.example
+ ${CMAKE_SOURCE_DIR}/share/hybbxpd-proxy.ini.example
+ ${CMAKE_SOURCE_DIR}/share/hybbx-standalone.ini.example
+ ${CMAKE_SOURCE_DIR}/share/hybbx-main.ini.example
+ ${CMAKE_SOURCE_DIR}/share/hybbx-mesh.ini.example
+ ${CMAKE_SOURCE_DIR}/share/hybbx-secondary.ini.example
+ DESTINATION ${HYBBX_INSTALL_HOME}
+ )
+
+ install(FILES ${CMAKE_SOURCE_DIR}/share/hybbxd-main.ini.example
+ DESTINATION ${HYBBX_INSTALL_HOME}
+ RENAME hybbx.ini
+ )
+
+ install(FILES ${CMAKE_SOURCE_DIR}/share/commands.yaml
+ ${CMAKE_SOURCE_DIR}/share/areas.yaml
+ DESTINATION ${HYBBX_INSTALL_HOME}
+ )
+
+ install(DIRECTORY ${CMAKE_SOURCE_DIR}/text/
+ DESTINATION ${HYBBX_INSTALL_HOME}/text
+ FILES_MATCHING PATTERN "*.txt"
+ )
+
+ install(FILES ${CMAKE_SOURCE_DIR}/share/THIRD_PARTY_NOTICES.txt
+ DESTINATION ${HYBBX_INSTALL_HOME}
+ )
+
+ install(DIRECTORY ${CMAKE_SOURCE_DIR}/share/reverse-proxy/
+ DESTINATION ${HYBBX_INSTALL_HOME}/reverse-proxy
+ )
+
+ install(DIRECTORY ${CMAKE_SOURCE_DIR}/share/cgi/
+ DESTINATION ${HYBBX_INSTALL_HOME}/cgi
+ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+ )
+
+ install(FILES ${CMAKE_SOURCE_DIR}/share/data.gitkeep
+ DESTINATION ${HYBBX_INSTALL_HOME}/data
+ RENAME .gitkeep
+ )
+
+ install(FILES ${CMAKE_SOURCE_DIR}/share/logs.gitkeep
+ DESTINATION ${HYBBX_INSTALL_HOME}/logs
+ RENAME .gitkeep
+ )
+
+ install(DIRECTORY ${CMAKE_SOURCE_DIR}/share/fail2ban/
+ DESTINATION ${HYBBX_INSTALL_HOME}/fail2ban
+ )
+
+ install(PROGRAMS ${CMAKE_SOURCE_DIR}/scripts/hybbx.sh
+ DESTINATION ${HYBBX_INSTALL_HOME}
+ RENAME hybbx-start
+ )
+endif()
+
+if(HYBBX_BUILD_CLIENTS)
+ add_subdirectory(clients)
+endif()
git clone -b <branch> https://cgit.mode42.com/<repo>.git
git clone -b <branch> git://cgit.mode42.com/<repo>.git

info@mode42.com