[winpr,timezone] outside definition timezone file

allow defining the filepath of timezone file in buildsystem adjusting it
without a required code change.
This commit is contained in:
akallabeth 2024-03-19 09:52:39 +01:00 committed by akallabeth
parent f4b7c59915
commit 92ed8b3916
2 changed files with 8 additions and 7 deletions

View File

@ -4,17 +4,17 @@ if((CMAKE_SYSTEM_NAME MATCHES "WindowsStore") AND (CMAKE_SYSTEM_VERSION MATCHES
add_definitions("-D_UWP")
set(CMAKE_WINDOWS_VERSION "WIN10" CACHE STRING "platform default")
endif()
# Enable 64bit file support on linux and FreeBSD.
if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
add_definitions("-D_FILE_OFFSET_BITS=64")
add_definitions("-DWINPR_TIMEZONE_FILE=\"/etc/timezone\"")
endif()
if("${CMAKE_SYSTEM_NAME}" MATCHES FREEBSD)
if("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD")
add_definitions("-D_FILE_OFFSET_BITS=64")
add_definitions("-DWINPR_TIMEZONE_FILE=\"/var/db/zoneinfo\"")
endif()
# Use Standard conforming getpwnam_r() on Solaris.
# Use Standard conforming getpwnam_r() on Solaris.
if("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS")
add_definitions("-D_POSIX_PTHREAD_SEMANTICS")
list(APPEND CMAKE_STANDARD_LIBRARIES rt)

View File

@ -247,10 +247,11 @@ static char* winpr_get_unix_timezone_identifier_from_file(void)
#else
FILE* fp = NULL;
char* tzid = NULL;
#if defined(__FreeBSD__) || defined(__OpenBSD__)
fp = winpr_fopen("/var/db/zoneinfo", "r");
#if !defined(WINPR_TIMEZONE_FILE)
#error \
"Please define WINPR_TIMEZONE_FILE with the path to your timezone file (e.g. /etc/timezone or similar)"
#else
fp = winpr_fopen("/etc/timezone", "r");
fp = winpr_fopen(WINPR_TIMEZONE_FILE, "r");
#endif
if (NULL == fp)