diff --git a/CMakeLists.txt b/CMakeLists.txt index d74dbd1fa..547833746 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,6 +44,9 @@ set(FREERDP_VERSION_MINOR "0") set(FREERDP_VERSION_REVISION "1") set(FREERDP_VERSION "${FREERDP_VERSION_MAJOR}.${FREERDP_VERSION_MINOR}") set(FREERDP_VERSION_FULL "${FREERDP_VERSION}.${FREERDP_VERSION_REVISION}") +include(GetGitRevisionDescription) +git_describe(GIT_REVISION --match "[0-9]*" --abbrev=4 --tags --always) +message(STATUS "Git Revision ${GIT_REVISION}") # Default to release build type if(NOT CMAKE_BUILD_TYPE) @@ -105,10 +108,18 @@ endif() # Mac OS X if(APPLE) - include_directories(/opt/local/include) - link_directories(/opt/local/lib) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -mmacosx-version-min=10.4") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -framework CoreFoundation") + if(IS_DIRECTORY /opt/local/include) + include_directories(/opt/local/include) + link_directories(/opt/local/lib) + endif() + + option(WITH_CLANG "Build using clang" OFF) + if(WITH_CLANG) + set(CMAKE_C_COMPILER "clang") + endif() + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.4") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl-framework,CoreFoundation") endif() if(NOT WIN32) diff --git a/channels/rdpsnd/rdpsnd_main.c b/channels/rdpsnd/rdpsnd_main.c index c5a738316..b5088d6e7 100644 --- a/channels/rdpsnd/rdpsnd_main.c +++ b/channels/rdpsnd/rdpsnd_main.c @@ -505,12 +505,22 @@ static void rdpsnd_process_connect(rdpSvcPlugin* plugin) { default_data[0].data[0] = "alsa"; default_data[0].data[1] = "default"; + if (!rdpsnd_load_device_plugin(rdpsnd, "alsa", default_data)) { default_data[0].data[0] = "macaudio"; default_data[0].data[1] = "default"; + rdpsnd_load_device_plugin(rdpsnd, "macaudio", default_data); } + else + { + printf("rdpsnd: successfully loaded alsa plugin\n"); + } + } + else + { + printf("rdpsnd: successfully loaded pulseaudio plugin\n"); } } if (rdpsnd->device == NULL) diff --git a/cmake/AutoVersioning.cmake b/cmake/AutoVersioning.cmake index 04e6479ed..fe6e3399f 100644 --- a/cmake/AutoVersioning.cmake +++ b/cmake/AutoVersioning.cmake @@ -40,7 +40,8 @@ else() endif() # Check if has not commited changes - execute_process(COMMAND git update-index -q --refresh) + execute_process(COMMAND git update-index -q --refresh + ERROR_QUIET) execute_process(COMMAND git diff-index --name-only HEAD -- OUTPUT_VARIABLE CHANGED_SOURCE OUTPUT_STRIP_TRAILING_WHITESPACE diff --git a/cmake/GetGitRevisionDescription.cmake b/cmake/GetGitRevisionDescription.cmake new file mode 100644 index 000000000..8f0169fde --- /dev/null +++ b/cmake/GetGitRevisionDescription.cmake @@ -0,0 +1,106 @@ +# - Returns a version string from Git +# +# These functions force a re-configure on each git commit so that you can +# trust the values of the variables in your build system. +# +# get_git_head_revision( [ ...]) +# +# Returns the refspec and sha hash of the current head revision +# +# git_describe( [ ...]) +# +# Returns the results of git describe on the source tree, and adjusting +# the output so that it tests false if an error occurs. +# +# git_get_exact_tag( [ ...]) +# +# Returns the results of git describe --exact-match on the source tree, +# and adjusting the output so that it tests false if there was no exact +# matching tag. +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__get_git_revision_description) + return() +endif() +set(__get_git_revision_description YES) + +# We must run the following at "include" time, not at function call time, +# to find the path to this module rather than the path to a calling list file +get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) + +function(get_git_head_revision _refspecvar _hashvar) + set(GIT_PARENT_DIR "${CMAKE_SOURCE_DIR}") + set(GIT_DIR "${GIT_PARENT_DIR}/.git") + while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories + set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}") + get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH) + if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT) + # We have reached the root directory, we are not in git + set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE) + set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE) + return() + endif() + set(GIT_DIR "${GIT_PARENT_DIR}/.git") + endwhile() + set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data") + if(NOT EXISTS "${GIT_DATA}") + file(MAKE_DIRECTORY "${GIT_DATA}") + endif() + + if(NOT EXISTS "${GIT_DIR}/HEAD") + return() + endif() + set(HEAD_FILE "${GIT_DATA}/HEAD") + configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY) + + configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in" + "${GIT_DATA}/grabRef.cmake" + @ONLY) + include("${GIT_DATA}/grabRef.cmake") + + set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE) + set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE) +endfunction() + +function(git_describe _var) + if(NOT GIT_FOUND) + find_package(Git QUIET) + endif() + if(NOT GIT_FOUND) + set(${_var} "n/a" PARENT_SCOPE) + return() + endif() + get_git_head_revision(refspec hash) + if(NOT hash) + set(${_var} "n/a" PARENT_SCOPE) + return() + endif() + + execute_process(COMMAND "${GIT_EXECUTABLE}" describe ${hash} ${ARGN} + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + RESULT_VARIABLE res + OUTPUT_VARIABLE out + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT res EQUAL 0) + set(out "n/a") + endif() + + set(${_var} "${out}" PARENT_SCOPE) +endfunction() + +function(git_get_exact_tag _var) + git_describe(out --exact-match ${ARGN}) + set(${_var} "${out}" PARENT_SCOPE) +endfunction() diff --git a/cmake/GetGitRevisionDescription.cmake.in b/cmake/GetGitRevisionDescription.cmake.in new file mode 100644 index 000000000..888ce13aa --- /dev/null +++ b/cmake/GetGitRevisionDescription.cmake.in @@ -0,0 +1,38 @@ +# +# Internal file for GetGitRevisionDescription.cmake +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(HEAD_HASH) + +file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) + +string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) +if(HEAD_CONTENTS MATCHES "ref") + # named branch + string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") + if(EXISTS "@GIT_DIR@/${HEAD_REF}") + configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) + elseif(EXISTS "@GIT_DIR@/logs/${HEAD_REF}") + configure_file("@GIT_DIR@/logs/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) + set(HEAD_HASH "${HEAD_REF}") + endif() +else() + # detached HEAD + configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) +endif() + +if(NOT HEAD_HASH) + file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) + string(STRIP "${HEAD_HASH}" HEAD_HASH) +endif() diff --git a/config.h.in b/config.h.in index 2f19ea9d7..5d0a4a713 100644 --- a/config.h.in +++ b/config.h.in @@ -6,6 +6,7 @@ #define FREERDP_VERSION_MAJOR ${FREERDP_VERSION_MAJOR} #define FREERDP_VERSION_MINOR ${FREERDP_VERSION_MINOR} #define FREERDP_VERSION_REVISION ${FREERDP_VERSION_REVISION} +#define GIT_REVISION "${GIT_REVISION}" #define FREERDP_DATA_PATH "${FREERDP_DATA_PATH}" #define FREERDP_PLUGIN_PATH "${FREERDP_PLUGIN_PATH}" diff --git a/libfreerdp-core/nego.c b/libfreerdp-core/nego.c index 35283e1d5..e6d31bfd9 100644 --- a/libfreerdp-core/nego.c +++ b/libfreerdp-core/nego.c @@ -73,15 +73,25 @@ boolean nego_connect(rdpNego* nego) if (!nego->security_layer_negotiation_enabled) { DEBUG_NEGO("Security Layer Negotiation is disabled"); + /* attempt only the highest enabled protocol (see nego_attempt_*) */ nego->enabled_protocols[PROTOCOL_NLA] = 0; nego->enabled_protocols[PROTOCOL_TLS] = 0; nego->enabled_protocols[PROTOCOL_RDP] = 0; if(nego->state == NEGO_STATE_NLA) + { nego->enabled_protocols[PROTOCOL_NLA] = 1; + nego->selected_protocol = PROTOCOL_NLA; + } else if (nego->state == NEGO_STATE_TLS) + { nego->enabled_protocols[PROTOCOL_TLS] = 1; + nego->selected_protocol = PROTOCOL_TLS; + } else if (nego->state == NEGO_STATE_RDP) + { nego->enabled_protocols[PROTOCOL_RDP] = 1; + nego->selected_protocol = PROTOCOL_RDP; + } } if(!nego_send_preconnection_pdu(nego)) @@ -140,24 +150,25 @@ boolean nego_security_connect(rdpNego* nego) } else if (!nego->security_connected) { - if (nego->enabled_protocols[PROTOCOL_NLA] > 0 - && nego->selected_protocol == PROTOCOL_NLA) + if (nego->selected_protocol == PROTOCOL_NLA) { - DEBUG_NEGO("nego_security_connect with PROTOCOL_NLA\n"); + DEBUG_NEGO("nego_security_connect with PROTOCOL_NLA"); nego->security_connected = transport_connect_nla(nego->transport); } - else if (nego->enabled_protocols[PROTOCOL_TLS] > 0 - && nego->selected_protocol == PROTOCOL_TLS ) + else if (nego->selected_protocol == PROTOCOL_TLS ) { - DEBUG_NEGO("nego_security_connect with PROTOCOL_TLS\n"); + DEBUG_NEGO("nego_security_connect with PROTOCOL_TLS"); nego->security_connected = transport_connect_tls(nego->transport); } - else if (nego->enabled_protocols[PROTOCOL_RDP] > 0 - && nego->selected_protocol == PROTOCOL_RDP) + else if (nego->selected_protocol == PROTOCOL_RDP) { - DEBUG_NEGO("nego_security_connect with PROTOCOL_RDP\n"); + DEBUG_NEGO("nego_security_connect with PROTOCOL_RDP"); nego->security_connected = transport_connect_rdp(nego->transport); } + else + { + DEBUG_NEGO("cannot connect security layer because no protocol has been selected yet."); + } } return nego->security_connected; } diff --git a/libfreerdp-core/timezone.c b/libfreerdp-core/timezone.c index b09d5197a..df7b5b663 100644 --- a/libfreerdp-core/timezone.c +++ b/libfreerdp-core/timezone.c @@ -143,12 +143,10 @@ void rdp_write_client_time_zone(STREAM* s, rdpSettings* settings) rdp_write_system_time(s, &clientTimeZone->standardDate); /* StandardDate */ sbias = clientTimeZone->standardBias - clientTimeZone->bias; - if (sbias < 0) bias2c = (uint32) sbias; else bias2c = ~((uint32) sbias) + 1; - stream_write_uint32(s, bias2c); /* StandardBias */ /* daylightName (64 bytes) */ @@ -163,7 +161,6 @@ void rdp_write_client_time_zone(STREAM* s, rdpSettings* settings) bias2c = (uint32) sbias; else bias2c = ~((uint32) sbias) + 1; - stream_write_uint32(s, bias2c); /* DaylightBias */ xfree(standardName); diff --git a/libfreerdp-locale/timezone.c b/libfreerdp-locale/timezone.c index 639209366..f086ea8b9 100644 --- a/libfreerdp-locale/timezone.c +++ b/libfreerdp-locale/timezone.c @@ -1635,10 +1635,12 @@ TIME_ZONE_RULE_ENTRY* freerdp_get_current_time_zone_rule(TIME_ZONE_RULE_ENTRY* r { if ((rules[i].TicksStart <= windows_time) && (windows_time >= rules[i].TicksEnd)) { + /*printf("Got rule %d from table at %p with count %u\n", i, rules, count);*/ return &rules[i]; } } + printf("Unable to get current timezone rule\n"); return NULL; } @@ -1671,7 +1673,6 @@ void freerdp_time_zone_detect(TIME_ZONE_INFO* clientTimeZone) #else clientTimeZone->bias = 0; #endif - if (local_time->tm_isdst > 0) { clientTimeZone->standardBias = clientTimeZone->bias - 60; @@ -1696,6 +1697,7 @@ void freerdp_time_zone_detect(TIME_ZONE_INFO* clientTimeZone) TIME_ZONE_RULE_ENTRY* rule; rule = freerdp_get_current_time_zone_rule(tz->RuleTable, tz->RuleTableCount); + /* issue #574 -- temporarily disabled this block as it seems to be setting the wrong time if (rule != NULL) { clientTimeZone->standardBias = 0; @@ -1719,6 +1721,7 @@ void freerdp_time_zone_detect(TIME_ZONE_INFO* clientTimeZone) clientTimeZone->daylightDate.wSecond = rule->DaylightDate.wSecond; clientTimeZone->daylightDate.wMilliseconds = rule->DaylightDate.wMilliseconds; } + */ } xfree(tz); diff --git a/libfreerdp-utils/args.c b/libfreerdp-utils/args.c index 87df89fb1..20319be83 100644 --- a/libfreerdp-utils/args.c +++ b/libfreerdp-utils/args.c @@ -790,7 +790,7 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, } else if (strcmp("--version", argv[index]) == 0) { - printf("This is FreeRDP version %s\n", FREERDP_VERSION_FULL); + printf("This is FreeRDP version %s (git %s)\n", FREERDP_VERSION_FULL, GIT_REVISION); return FREERDP_ARGS_PARSE_VERSION; } else if (argv[index][0] != '-') diff --git a/winpr/CMakeLists.txt b/winpr/CMakeLists.txt index 3d8d5ea26..5446dba52 100644 --- a/winpr/CMakeLists.txt +++ b/winpr/CMakeLists.txt @@ -17,6 +17,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +if (APPLE) + # flat_namespace should be avoided, but is required for -undefined warning. Since WinPR currently has + # a lot of undefined symbols in use, use this hack until they're filled out. + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-flat_namespace,-undefined,warning") +endif() + add_subdirectory(crt) add_subdirectory(utils) add_subdirectory(heap)