Merge branch 'master' of github.com:janvidar/uhub
Conflicts: CMakeLists.txt
This commit is contained in:
commit
b9d43c784c
121
CMakeLists.txt
121
CMakeLists.txt
|
@ -40,57 +40,15 @@ endif()
|
||||||
|
|
||||||
include_directories("${PROJECT_SOURCE_DIR}")
|
include_directories("${PROJECT_SOURCE_DIR}")
|
||||||
|
|
||||||
set (network_SOURCES
|
file (GLOB uhub_SOURCES ${PROJECT_SOURCE_DIR}/core/*.c)
|
||||||
${PROJECT_SOURCE_DIR}/network/backend.c
|
list (REMOVE_ITEM uhub_SOURCES
|
||||||
${PROJECT_SOURCE_DIR}/network/connection.c
|
${PROJECT_SOURCE_DIR}/core/gen_config.c
|
||||||
${PROJECT_SOURCE_DIR}/network/epoll.c
|
${PROJECT_SOURCE_DIR}/core/main.c
|
||||||
${PROJECT_SOURCE_DIR}/network/kqueue.c
|
|
||||||
${PROJECT_SOURCE_DIR}/network/select.c
|
|
||||||
${PROJECT_SOURCE_DIR}/network/timeout.c
|
|
||||||
${PROJECT_SOURCE_DIR}/network/timer.c
|
|
||||||
${PROJECT_SOURCE_DIR}/network/network.c
|
|
||||||
${PROJECT_SOURCE_DIR}/network/openssl.c
|
|
||||||
${PROJECT_SOURCE_DIR}/network/ipcalc.c
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set (uhub_SOURCES
|
file (GLOB adc_SOURCES ${PROJECT_SOURCE_DIR}/adc/*.c)
|
||||||
${PROJECT_SOURCE_DIR}/core/auth.c
|
file (GLOB network_SOURCES ${PROJECT_SOURCE_DIR}/network/*.c)
|
||||||
${PROJECT_SOURCE_DIR}/core/command_parser.c
|
file (GLOB utils_SOURCES ${PROJECT_SOURCE_DIR}/util/*.c)
|
||||||
${PROJECT_SOURCE_DIR}/core/commands.c
|
|
||||||
${PROJECT_SOURCE_DIR}/core/config.c
|
|
||||||
${PROJECT_SOURCE_DIR}/core/eventqueue.c
|
|
||||||
${PROJECT_SOURCE_DIR}/core/hub.c
|
|
||||||
${PROJECT_SOURCE_DIR}/core/hubevent.c
|
|
||||||
${PROJECT_SOURCE_DIR}/core/inf.c
|
|
||||||
${PROJECT_SOURCE_DIR}/core/ioqueue.c
|
|
||||||
${PROJECT_SOURCE_DIR}/core/netevent.c
|
|
||||||
${PROJECT_SOURCE_DIR}/core/probe.c
|
|
||||||
${PROJECT_SOURCE_DIR}/core/route.c
|
|
||||||
${PROJECT_SOURCE_DIR}/core/user.c
|
|
||||||
${PROJECT_SOURCE_DIR}/core/usermanager.c
|
|
||||||
${PROJECT_SOURCE_DIR}/core/plugincallback.c
|
|
||||||
${PROJECT_SOURCE_DIR}/core/plugininvoke.c
|
|
||||||
${PROJECT_SOURCE_DIR}/core/pluginloader.c
|
|
||||||
)
|
|
||||||
|
|
||||||
set (adc_SOURCES
|
|
||||||
${PROJECT_SOURCE_DIR}/adc/message.c
|
|
||||||
${PROJECT_SOURCE_DIR}/adc/sid.c
|
|
||||||
)
|
|
||||||
|
|
||||||
set (utils_SOURCES
|
|
||||||
${PROJECT_SOURCE_DIR}/util/cbuffer.c
|
|
||||||
${PROJECT_SOURCE_DIR}/util/config_token.c
|
|
||||||
${PROJECT_SOURCE_DIR}/util/credentials.c
|
|
||||||
${PROJECT_SOURCE_DIR}/util/floodctl.c
|
|
||||||
${PROJECT_SOURCE_DIR}/util/getopt.c
|
|
||||||
${PROJECT_SOURCE_DIR}/util/list.c
|
|
||||||
${PROJECT_SOURCE_DIR}/util/log.c
|
|
||||||
${PROJECT_SOURCE_DIR}/util/memory.c
|
|
||||||
${PROJECT_SOURCE_DIR}/util/misc.c
|
|
||||||
${PROJECT_SOURCE_DIR}/util/rbtree.c
|
|
||||||
${PROJECT_SOURCE_DIR}/util/tiger.c
|
|
||||||
)
|
|
||||||
|
|
||||||
set (adcclient_SOURCES
|
set (adcclient_SOURCES
|
||||||
${PROJECT_SOURCE_DIR}/tools/adcclient.c
|
${PROJECT_SOURCE_DIR}/tools/adcclient.c
|
||||||
|
@ -100,27 +58,30 @@ set (adcclient_SOURCES
|
||||||
add_library(adc STATIC ${adc_SOURCES})
|
add_library(adc STATIC ${adc_SOURCES})
|
||||||
add_library(network STATIC ${network_SOURCES})
|
add_library(network STATIC ${network_SOURCES})
|
||||||
add_library(utils STATIC ${utils_SOURCES})
|
add_library(utils STATIC ${utils_SOURCES})
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCC)
|
||||||
|
set_target_properties(utils PROPERTIES COMPILE_FLAGS -fPIC)
|
||||||
|
set_target_properties(network PROPERTIES COMPILE_FLAGS -fPIC)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_dependencies(adc utils)
|
add_dependencies(adc utils)
|
||||||
add_dependencies(network utils)
|
add_dependencies(network utils)
|
||||||
|
|
||||||
add_executable(uhub ${PROJECT_SOURCE_DIR}/core/main.c ${uhub_SOURCES} )
|
add_executable(uhub ${PROJECT_SOURCE_DIR}/core/main.c ${uhub_SOURCES} )
|
||||||
|
|
||||||
add_library(mod_example MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_example.c ${utils_SOURCES})
|
add_library(mod_example MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_example.c)
|
||||||
add_library(mod_welcome MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_welcome.c ${utils_SOURCES} ${network_SOURCES})
|
add_library(mod_welcome MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_welcome.c)
|
||||||
add_library(mod_logging MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_logging.c ${utils_SOURCES} ${PROJECT_SOURCE_DIR}/adc/sid.c ${network_SOURCES})
|
add_library(mod_logging MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_logging.c ${PROJECT_SOURCE_DIR}/adc/sid.c)
|
||||||
add_library(mod_auth_simple MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_auth_simple.c ${utils_SOURCES})
|
add_library(mod_auth_simple MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_auth_simple.c )
|
||||||
add_library(mod_chat_history MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_chat_history.c ${utils_SOURCES})
|
add_library(mod_chat_history MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_chat_history.c )
|
||||||
add_library(mod_chat_only MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_chat_only.c ${utils_SOURCES})
|
add_library(mod_chat_only MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_chat_only.c)
|
||||||
add_library(mod_topic MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_topic.c ${utils_SOURCES})
|
add_library(mod_topic MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_topic.c)
|
||||||
|
|
||||||
if (SQLITE_SUPPORT)
|
if (SQLITE_SUPPORT)
|
||||||
add_library(mod_auth_sqlite MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_auth_sqlite.c ${utils_SOURCES})
|
add_library(mod_auth_sqlite MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_auth_sqlite.c)
|
||||||
add_executable(uhub-passwd ${PROJECT_SOURCE_DIR}/tools/uhub-passwd.c ${PROJECT_SOURCE_DIR}/util/misc.c ${PROJECT_SOURCE_DIR}/util/memory.c ${PROJECT_SOURCE_DIR}/util/log.c ${PROJECT_SOURCE_DIR}/util/list.c)
|
add_executable(uhub-passwd ${PROJECT_SOURCE_DIR}/tools/uhub-passwd.c)
|
||||||
|
|
||||||
target_link_libraries(mod_auth_sqlite sqlite3)
|
target_link_libraries(mod_auth_sqlite sqlite3 utils)
|
||||||
target_link_libraries(uhub-passwd sqlite3)
|
target_link_libraries(uhub-passwd sqlite3 utils)
|
||||||
set_target_properties(mod_auth_sqlite PROPERTIES PREFIX "")
|
set_target_properties(mod_auth_sqlite PROPERTIES PREFIX "")
|
||||||
|
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
|
@ -128,6 +89,7 @@ if (SQLITE_SUPPORT)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_link_libraries(uhub ws2_32)
|
target_link_libraries(uhub ws2_32)
|
||||||
target_link_libraries(mod_logging ws2_32)
|
target_link_libraries(mod_logging ws2_32)
|
||||||
|
@ -145,6 +107,16 @@ set_target_properties(
|
||||||
PROPERTIES PREFIX "")
|
PROPERTIES PREFIX "")
|
||||||
|
|
||||||
target_link_libraries(uhub ${CMAKE_DL_LIBS} adc network utils)
|
target_link_libraries(uhub ${CMAKE_DL_LIBS} adc network utils)
|
||||||
|
target_link_libraries(mod_example utils)
|
||||||
|
target_link_libraries(mod_welcome utils)
|
||||||
|
target_link_libraries(mod_auth_simple utils)
|
||||||
|
target_link_libraries(mod_chat_history utils)
|
||||||
|
target_link_libraries(mod_chat_only utils)
|
||||||
|
target_link_libraries(mod_logging utils)
|
||||||
|
target_link_libraries(mod_topic utils)
|
||||||
|
|
||||||
|
target_link_libraries(mod_welcome network)
|
||||||
|
target_link_libraries(mod_logging network)
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
add_library(adcclient STATIC ${adcclient_SOURCES})
|
add_library(adcclient STATIC ${adcclient_SOURCES})
|
||||||
|
@ -157,12 +129,22 @@ if(UNIX)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(GIT_FOUND AND IS_DIRECTORY ".git")
|
if (NOT UHUB_REVISION AND GIT_FOUND)
|
||||||
execute_process(COMMAND ${GIT_EXECUTABLE} show -s --pretty=format:%h OUTPUT_VARIABLE UHUB_REVISION)
|
execute_process(COMMAND ${GIT_EXECUTABLE} show -s --pretty=format:%h
|
||||||
set (UHUB_GIT_VERSION "${UHUB_VERSION_MAJOR}.${UHUB_VERSION_MINOR}.${UHUB_VERSION_PATCH}-git-${UHUB_REVISION}")
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
else()
|
OUTPUT_VARIABLE UHUB_REVISION_TEMP
|
||||||
set (UHUB_GIT_VERSION "${UHUB_VERSION_MAJOR}.${UHUB_VERSION_MINOR}.${UHUB_VERSION_PATCH}-release")
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
if (UHUB_REVISION_TEMP)
|
||||||
|
set (UHUB_REVISION "git-${UHUB_REVISION_TEMP}")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT UHUB_REVISION)
|
||||||
|
set (UHUB_REVISION "release")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set (UHUB_GIT_VERSION "${UHUB_VERSION_MAJOR}.${UHUB_VERSION_MINOR}.${UHUB_VERSION_PATCH}-${UHUB_REVISION}")
|
||||||
|
message (STATUS "Configuring uhub version: ${UHUB_GIT_VERSION}")
|
||||||
|
|
||||||
if(OPENSSL_FOUND)
|
if(OPENSSL_FOUND)
|
||||||
set(SSL_LIBS ${OPENSSL_LIBRARIES})
|
set(SSL_LIBS ${OPENSSL_LIBRARIES})
|
||||||
|
@ -200,8 +182,8 @@ endif()
|
||||||
|
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
install( TARGETS uhub RUNTIME DESTINATION bin )
|
install( TARGETS uhub RUNTIME DESTINATION bin )
|
||||||
install( TARGETS mod_example mod_welcome mod_logging mod_auth_simple mod_auth_sqlite mod_chat_history mod_chat_only mod_topic DESTINATION /var/lib/uhub/ OPTIONAL )
|
install( TARGETS mod_example mod_welcome mod_logging mod_auth_simple mod_auth_sqlite mod_chat_history mod_chat_only mod_topic DESTINATION /usr/lib/uhub/ OPTIONAL )
|
||||||
install( FILES ${CMAKE_SOURCE_DIR}/uhub.conf ${CMAKE_SOURCE_DIR}/plugins.conf ${CMAKE_SOURCE_DIR}/rules.txt ${CMAKE_SOURCE_DIR}/motd.txt DESTINATION /etc/uhub OPTIONAL )
|
install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.conf ${CMAKE_SOURCE_DIR}/doc/plugins.conf ${CMAKE_SOURCE_DIR}/doc/rules.txt ${CMAKE_SOURCE_DIR}/doc/motd.txt DESTINATION /etc/uhub OPTIONAL )
|
||||||
|
|
||||||
if (SQLITE_SUPPORT)
|
if (SQLITE_SUPPORT)
|
||||||
install( TARGETS uhub-passwd RUNTIME DESTINATION bin )
|
install( TARGETS uhub-passwd RUNTIME DESTINATION bin )
|
||||||
|
@ -209,6 +191,3 @@ if (UNIX)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
# Parameters:
|
# Parameters:
|
||||||
# file: path/filename for database.
|
# file: path/filename for database.
|
||||||
#
|
#
|
||||||
plugin /var/lib/uhub/mod_auth_sqlite.so "file=/etc/uhub/users.db"
|
plugin /usr/lib/uhub/mod_auth_sqlite.so "file=/etc/uhub/users.db"
|
||||||
|
|
||||||
|
|
||||||
# Log file writer
|
# Log file writer
|
||||||
|
@ -19,10 +19,10 @@ plugin /var/lib/uhub/mod_auth_sqlite.so "file=/etc/uhub/users.db"
|
||||||
# Parameters:
|
# Parameters:
|
||||||
# file: path/filename for log file.
|
# file: path/filename for log file.
|
||||||
# syslog: if true then syslog is used instead of writing to a file (Unix only)
|
# syslog: if true then syslog is used instead of writing to a file (Unix only)
|
||||||
plugin /var/lib/uhub/mod_logging.so "file=/var/log/uhub.log"
|
plugin /usr/lib/uhub/mod_logging.so "file=/var/log/uhub.log"
|
||||||
|
|
||||||
# A simple example plugin
|
# A simple example plugin
|
||||||
# plugin /var/lib/uhub/mod_example.so
|
# plugin /usr/lib/uhub/mod_example.so
|
||||||
# A plugin sending a welcome message.
|
# A plugin sending a welcome message.
|
||||||
#
|
#
|
||||||
# This plugin provides the following commands:
|
# This plugin provides the following commands:
|
||||||
|
@ -46,7 +46,7 @@ plugin /var/lib/uhub/mod_logging.so "file=/var/log/uhub.log"
|
||||||
# %p - 'am' or 'pm'
|
# %p - 'am' or 'pm'
|
||||||
# %M - Minutes (00-59) (Hub local time)
|
# %M - Minutes (00-59) (Hub local time)
|
||||||
# %S - Seconds (00-60) (Hub local time)
|
# %S - Seconds (00-60) (Hub local time)
|
||||||
plugin /var/lib/uhub/mod_welcome.so "motd=/etc/uhub/motd.txt rules=/etc/uhub/rules.txt"
|
plugin /usr/lib/uhub/mod_welcome.so "motd=/etc/uhub/motd.txt rules=/etc/uhub/rules.txt"
|
||||||
|
|
||||||
# Load the chat history plugin.
|
# Load the chat history plugin.
|
||||||
#
|
#
|
||||||
|
@ -58,5 +58,5 @@ plugin /var/lib/uhub/mod_welcome.so "motd=/etc/uhub/motd.txt rules=/etc/uhub/rul
|
||||||
# history_max: the maximum number of messages to keep in history
|
# history_max: the maximum number of messages to keep in history
|
||||||
# history_default: when !history is provided without arguments, then this default number of messages are returned.
|
# history_default: when !history is provided without arguments, then this default number of messages are returned.
|
||||||
# history_connect: the number of chat history messages to send when users connect (0 = do not send any history)
|
# history_connect: the number of chat history messages to send when users connect (0 = do not send any history)
|
||||||
plugin /var/lib/uhub/mod_chat_history.so "history_max=200 history_default=10 history_connect=5"
|
plugin /usr/lib/uhub/mod_chat_history.so "history_max=200 history_default=10 history_connect=5"
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ mkdir -p $RPM_BUILD_ROOT/etc/init.d
|
||||||
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
|
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
|
||||||
mkdir -p $RPM_BUILD_ROOT/etc/sysconfig
|
mkdir -p $RPM_BUILD_ROOT/etc/sysconfig
|
||||||
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1
|
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1
|
||||||
mkdir -p $RPM_BUILD_ROOT/var/lib/uhub
|
mkdir -p $RPM_BUILD_ROOT/usr/lib/uhub
|
||||||
|
|
||||||
install uhub $RPM_BUILD_ROOT/usr/bin/
|
install uhub $RPM_BUILD_ROOT/usr/bin/
|
||||||
install uhub-passwd $RPM_BUILD_ROOT/usr/bin/
|
install uhub-passwd $RPM_BUILD_ROOT/usr/bin/
|
||||||
|
@ -52,7 +52,7 @@ install -m644 doc/init.d.RedHat/etc/sysconfig/uhub $RPM_BUILD_ROOT/etc/sysconfi
|
||||||
install -m644 doc/init.d.RedHat/etc/logrotate.d/uhub $RPM_BUILD_ROOT/etc/logrotate.d/
|
install -m644 doc/init.d.RedHat/etc/logrotate.d/uhub $RPM_BUILD_ROOT/etc/logrotate.d/
|
||||||
/bin/gzip -9c doc/uhub.1 > doc/uhub.1.gz &&
|
/bin/gzip -9c doc/uhub.1 > doc/uhub.1.gz &&
|
||||||
install -m644 doc/uhub.1.gz $RPM_BUILD_ROOT/usr/share/man/man1
|
install -m644 doc/uhub.1.gz $RPM_BUILD_ROOT/usr/share/man/man1
|
||||||
install -m644 mod_*.so $RPM_BUILD_ROOT/var/lib/uhub
|
install -m644 mod_*.so $RPM_BUILD_ROOT/usr/lib/uhub
|
||||||
|
|
||||||
|
|
||||||
%files
|
%files
|
||||||
|
|
|
@ -129,7 +129,7 @@
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(BSD_LIKE) || defined(__sun__)
|
#if ( defined(BSD_LIKE) && !defined(__FreeBSD_kernel__) ) || defined(__sun__)
|
||||||
#undef HAVE_STRNDUP
|
#undef HAVE_STRNDUP
|
||||||
#undef HAVE_MEMMEM
|
#undef HAVE_MEMMEM
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue