From 279c932b674412961ef0cda15f9f76bf41a5fec4 Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Tue, 9 Oct 2012 19:31:54 +0200 Subject: [PATCH 01/11] fixup! Add install make rule. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 33b20e1..7a4ef05 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -182,7 +182,7 @@ endif() if (UNIX) 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( 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) install( TARGETS uhub-passwd RUNTIME DESTINATION bin ) From e7aa63f3bdb49e2787ba1c0f49f0d9b6c2797a0d Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Tue, 9 Oct 2012 22:09:25 +0200 Subject: [PATCH 02/11] Don't compile the utils files multiple times. --- CMakeLists.txt | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a4ef05..b7a8d54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,20 +91,22 @@ set (adcclient_SOURCES add_library(adc STATIC ${adc_SOURCES}) add_library(network STATIC ${network_SOURCES}) add_library(utils STATIC ${utils_SOURCES}) - +if(CMAKE_COMPILER_IS_GNUCC) + set_target_properties(utils PROPERTIES COMPILE_FLAGS -fPIC) +endif() add_dependencies(adc utils) add_dependencies(network utils) 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_welcome MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_welcome.c ${utils_SOURCES} ${network_SOURCES}) -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_auth_simple MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_auth_simple.c ${utils_SOURCES}) -add_library(mod_chat_history MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_chat_history.c ${utils_SOURCES}) -add_library(mod_chat_only MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_chat_only.c ${utils_SOURCES}) -add_library(mod_topic MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_topic.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 ${network_SOURCES}) +add_library(mod_logging MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_logging.c ${PROJECT_SOURCE_DIR}/adc/sid.c ${network_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 ) +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) if (SQLITE_SUPPORT) add_library(mod_auth_sqlite MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_auth_sqlite.c ${utils_SOURCES}) @@ -113,12 +115,15 @@ if (SQLITE_SUPPORT) target_link_libraries(mod_auth_sqlite sqlite3) target_link_libraries(uhub-passwd sqlite3) set_target_properties(mod_auth_sqlite PROPERTIES PREFIX "") + target_link_libraries(mod_auth_sqlite utils) if (UNIX) target_link_libraries(uhub pthread) endif() endif() + + if(WIN32) target_link_libraries(uhub ws2_32) target_link_libraries(mod_logging ws2_32) @@ -136,6 +141,13 @@ set_target_properties( PROPERTIES PREFIX "") 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) if(UNIX) add_library(adcclient STATIC ${adcclient_SOURCES}) From af083efb0c39e4716e4eb4aefe1bdeee3fdb572b Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Tue, 9 Oct 2012 22:14:38 +0200 Subject: [PATCH 03/11] fixup! Don't compile the utils files multiple times. --- CMakeLists.txt | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7a8d54..59c5cb1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,6 +93,7 @@ add_library(network STATIC ${network_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) @@ -101,21 +102,20 @@ add_dependencies(network utils) add_executable(uhub ${PROJECT_SOURCE_DIR}/core/main.c ${uhub_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 ${network_SOURCES}) -add_library(mod_logging MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_logging.c ${PROJECT_SOURCE_DIR}/adc/sid.c ${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 ${PROJECT_SOURCE_DIR}/adc/sid.c) 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 ) 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) if (SQLITE_SUPPORT) - add_library(mod_auth_sqlite MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_auth_sqlite.c ${utils_SOURCES}) - 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_library(mod_auth_sqlite MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_auth_sqlite.c) + add_executable(uhub-passwd ${PROJECT_SOURCE_DIR}/tools/uhub-passwd.c) - target_link_libraries(mod_auth_sqlite sqlite3) - target_link_libraries(uhub-passwd sqlite3) + target_link_libraries(mod_auth_sqlite sqlite3 utils) + target_link_libraries(uhub-passwd sqlite3 utils) set_target_properties(mod_auth_sqlite PROPERTIES PREFIX "") - target_link_libraries(mod_auth_sqlite utils) if (UNIX) target_link_libraries(uhub pthread) @@ -149,6 +149,9 @@ 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) add_library(adcclient STATIC ${adcclient_SOURCES}) add_executable(uhub-admin ${PROJECT_SOURCE_DIR}/tools/admin.c) From 53a5f5a2430f248223dd6598fed9e68dd0d742ef Mon Sep 17 00:00:00 2001 From: Boris Pek Date: Sat, 13 Oct 2012 18:48:24 +0300 Subject: [PATCH 04/11] Use directory /usr/lib/uhub/ instead of /var/lib/uhub/ in according with FHS (Filesystem Hierarchy Standard). --- CMakeLists.txt | 2 +- doc/plugins.conf | 10 +++++----- doc/uhub.spec | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 59c5cb1..a08ad4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -196,7 +196,7 @@ endif() if (UNIX) 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}/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) diff --git a/doc/plugins.conf b/doc/plugins.conf index e45f35c..491eb74 100644 --- a/doc/plugins.conf +++ b/doc/plugins.conf @@ -11,7 +11,7 @@ # Parameters: # 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 @@ -19,10 +19,10 @@ plugin /var/lib/uhub/mod_auth_sqlite.so "file=/etc/uhub/users.db" # Parameters: # file: path/filename for log file. # 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 -# plugin /var/lib/uhub/mod_example.so +# plugin /usr/lib/uhub/mod_example.so # A plugin sending a welcome message. # # 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' # %M - Minutes (00-59) (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. # @@ -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_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) -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" diff --git a/doc/uhub.spec b/doc/uhub.spec index 7c14237..7a487f9 100644 --- a/doc/uhub.spec +++ b/doc/uhub.spec @@ -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/sysconfig 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-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/ /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 mod_*.so $RPM_BUILD_ROOT/var/lib/uhub +install -m644 mod_*.so $RPM_BUILD_ROOT/usr/lib/uhub %files From dcfcf3110d0058a3aedfb90185622496103b8625 Mon Sep 17 00:00:00 2001 From: Boris Pek Date: Sat, 13 Oct 2012 19:10:16 +0300 Subject: [PATCH 05/11] Add possibility to specify UHUB_REVISION manually. --- CMakeLists.txt | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 59c5cb1..4fcc8b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -163,13 +163,20 @@ if(UNIX) endif() endif() -if(GIT_FOUND AND IS_DIRECTORY ".git") - execute_process(COMMAND ${GIT_EXECUTABLE} show -s --pretty=format:%h OUTPUT_VARIABLE UHUB_REVISION) - set (UHUB_GIT_VERSION "${UHUB_VERSION_MAJOR}.${UHUB_VERSION_MINOR}.${UHUB_VERSION_PATCH}-git-${UHUB_REVISION}") -else() - set (UHUB_GIT_VERSION "${UHUB_VERSION_MAJOR}.${UHUB_VERSION_MINOR}.${UHUB_VERSION_PATCH}-release") +if (NOT UHUB_REVISION AND GIT_FOUND) + execute_process(COMMAND ${GIT_EXECUTABLE} show -s --pretty=format:%h OUTPUT_VARIABLE UHUB_REVISION_TEMP) + if (UHUB_REVISION_TEMP) + set (UHUB_REVISION "git-${UHUB_REVISION_TEMP}") + 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 "Current uHub version: ${UHUB_GIT_VERSION}") + if(OPENSSL_FOUND) add_definitions(-DSSL_SUPPORT=1) include_directories(${OPENSSL_INCLUDE_DIR}) From 63171b0ce2afd9c5ad63e50791782ded651b8af4 Mon Sep 17 00:00:00 2001 From: Boris Pek Date: Sat, 13 Oct 2012 20:11:31 +0300 Subject: [PATCH 06/11] Simplify CMakeLists.txt --- CMakeLists.txt | 59 ++++++-------------------------------------------- 1 file changed, 7 insertions(+), 52 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 59c5cb1..77c6729 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,56 +32,15 @@ endif() include_directories("${PROJECT_SOURCE_DIR}") -set (network_SOURCES - ${PROJECT_SOURCE_DIR}/network/backend.c - ${PROJECT_SOURCE_DIR}/network/connection.c - ${PROJECT_SOURCE_DIR}/network/epoll.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/ipcalc.c +file (GLOB uhub_SOURCES ${PROJECT_SOURCE_DIR}/core/*.c) +list (REMOVE_ITEM uhub_SOURCES + ${PROJECT_SOURCE_DIR}/core/gen_config.c + ${PROJECT_SOURCE_DIR}/core/main.c ) -set (uhub_SOURCES - ${PROJECT_SOURCE_DIR}/core/auth.c - ${PROJECT_SOURCE_DIR}/core/command_parser.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 -) +file (GLOB adc_SOURCES ${PROJECT_SOURCE_DIR}/adc/*.c) +file (GLOB network_SOURCES ${PROJECT_SOURCE_DIR}/network/*.c) +file (GLOB utils_SOURCES ${PROJECT_SOURCE_DIR}/util/*.c) set (adcclient_SOURCES ${PROJECT_SOURCE_DIR}/tools/adcclient.c @@ -123,7 +82,6 @@ if (SQLITE_SUPPORT) endif() - if(WIN32) target_link_libraries(uhub ws2_32) target_link_libraries(mod_logging ws2_32) @@ -205,6 +163,3 @@ if (UNIX) endif() - - - From ddfbb919a789829cf213cd0eb4a511cbe868e9a5 Mon Sep 17 00:00:00 2001 From: Boris Pek Date: Sun, 14 Oct 2012 02:13:10 +0300 Subject: [PATCH 07/11] Fix build in Debian GNU/kFreeBSD. --- src/system.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system.h b/src/system.h index 12e5b3c..4e40094 100644 --- a/src/system.h +++ b/src/system.h @@ -124,7 +124,7 @@ #include #endif -#if defined(BSD_LIKE) || defined(__sun__) +#if ( defined(BSD_LIKE) && !defined(__FreeBSD_kernel__) ) || defined(__sun__) #undef HAVE_STRNDUP #undef HAVE_MEMMEM #endif From e6cb7a7e10cc54a1b730c796c0876a347832649b Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Sun, 14 Oct 2012 22:24:33 +0000 Subject: [PATCH 08/11] Revert "Add possibility to specify UHUB_REVISION manually." This reverts commit dcfcf3110d0058a3aedfb90185622496103b8625. --- CMakeLists.txt | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e14d09..2e8c11d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,20 +121,13 @@ if(UNIX) endif() endif() -if (NOT UHUB_REVISION AND GIT_FOUND) - execute_process(COMMAND ${GIT_EXECUTABLE} show -s --pretty=format:%h OUTPUT_VARIABLE UHUB_REVISION_TEMP) - if (UHUB_REVISION_TEMP) - set (UHUB_REVISION "git-${UHUB_REVISION_TEMP}") - endif() +if(GIT_FOUND AND IS_DIRECTORY ".git") + execute_process(COMMAND ${GIT_EXECUTABLE} show -s --pretty=format:%h OUTPUT_VARIABLE UHUB_REVISION) + set (UHUB_GIT_VERSION "${UHUB_VERSION_MAJOR}.${UHUB_VERSION_MINOR}.${UHUB_VERSION_PATCH}-git-${UHUB_REVISION}") +else() + set (UHUB_GIT_VERSION "${UHUB_VERSION_MAJOR}.${UHUB_VERSION_MINOR}.${UHUB_VERSION_PATCH}-release") 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 "Current uHub version: ${UHUB_GIT_VERSION}") - if(OPENSSL_FOUND) add_definitions(-DSSL_SUPPORT=1) include_directories(${OPENSSL_INCLUDE_DIR}) From 8b06a75d8eb01e061e8ecb91bdd378d68734c724 Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Mon, 15 Oct 2012 00:24:59 +0200 Subject: [PATCH 09/11] Revert "Add possibility to specify UHUB_REVISION manually." This reverts commit dcfcf3110d0058a3aedfb90185622496103b8625. --- CMakeLists.txt | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e14d09..2e8c11d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,20 +121,13 @@ if(UNIX) endif() endif() -if (NOT UHUB_REVISION AND GIT_FOUND) - execute_process(COMMAND ${GIT_EXECUTABLE} show -s --pretty=format:%h OUTPUT_VARIABLE UHUB_REVISION_TEMP) - if (UHUB_REVISION_TEMP) - set (UHUB_REVISION "git-${UHUB_REVISION_TEMP}") - endif() +if(GIT_FOUND AND IS_DIRECTORY ".git") + execute_process(COMMAND ${GIT_EXECUTABLE} show -s --pretty=format:%h OUTPUT_VARIABLE UHUB_REVISION) + set (UHUB_GIT_VERSION "${UHUB_VERSION_MAJOR}.${UHUB_VERSION_MINOR}.${UHUB_VERSION_PATCH}-git-${UHUB_REVISION}") +else() + set (UHUB_GIT_VERSION "${UHUB_VERSION_MAJOR}.${UHUB_VERSION_MINOR}.${UHUB_VERSION_PATCH}-release") 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 "Current uHub version: ${UHUB_GIT_VERSION}") - if(OPENSSL_FOUND) add_definitions(-DSSL_SUPPORT=1) include_directories(${OPENSSL_INCLUDE_DIR}) From deaadd053b7c45543fb4b9c4b861954973680d7f Mon Sep 17 00:00:00 2001 From: Boris Pek Date: Sat, 13 Oct 2012 19:10:16 +0300 Subject: [PATCH 10/11] Add possibility to specify UHUB_REVISION manually. --- CMakeLists.txt | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e8c11d..3ab4990 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,13 +121,23 @@ if(UNIX) endif() endif() -if(GIT_FOUND AND IS_DIRECTORY ".git") - execute_process(COMMAND ${GIT_EXECUTABLE} show -s --pretty=format:%h OUTPUT_VARIABLE UHUB_REVISION) - set (UHUB_GIT_VERSION "${UHUB_VERSION_MAJOR}.${UHUB_VERSION_MINOR}.${UHUB_VERSION_PATCH}-git-${UHUB_REVISION}") -else() - set (UHUB_GIT_VERSION "${UHUB_VERSION_MAJOR}.${UHUB_VERSION_MINOR}.${UHUB_VERSION_PATCH}-release") +if (NOT UHUB_REVISION AND GIT_FOUND) + execute_process(COMMAND ${GIT_EXECUTABLE} show -s --pretty=format:%h + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + OUTPUT_VARIABLE UHUB_REVISION_TEMP + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (UHUB_REVISION_TEMP) + set (UHUB_REVISION "git-${UHUB_REVISION_TEMP}") + 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 "Current uHub version: ${UHUB_GIT_VERSION}") + if(OPENSSL_FOUND) add_definitions(-DSSL_SUPPORT=1) include_directories(${OPENSSL_INCLUDE_DIR}) From 3a8c91004e7223be2f18adb26566a7c607f77345 Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Mon, 15 Oct 2012 20:27:43 +0200 Subject: [PATCH 11/11] fixup! Add possibility to specify UHUB_REVISION manually. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ab4990..8b93201 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,7 +136,7 @@ if (NOT UHUB_REVISION) endif() set (UHUB_GIT_VERSION "${UHUB_VERSION_MAJOR}.${UHUB_VERSION_MINOR}.${UHUB_VERSION_PATCH}-${UHUB_REVISION}") -message (STATUS "Current uHub version: ${UHUB_GIT_VERSION}") +message (STATUS "Configuring uhub version: ${UHUB_GIT_VERSION}") if(OPENSSL_FOUND) add_definitions(-DSSL_SUPPORT=1)