diff --git a/CMakeLists.txt b/CMakeLists.txt index 39d9106d8bfc..d0d31977e82f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,11 +153,6 @@ if (LEGACY_BUILD) endif () endif () - # use response files to prevent command-line-too-big errors for large libraries like iam - set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1) - set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES 1) - set(CMAKE_CXX_RESPONSE_FILE_LINK_FLAG "@") - if (COMMAND apply_pre_project_platform_settings) apply_pre_project_platform_settings() endif () @@ -173,6 +168,13 @@ if (LEGACY_BUILD) # build the sdk targets project("aws-cpp-sdk-all" VERSION "${PROJECT_VERSION}" LANGUAGES CXX) + if(NOT CMAKE_SYSTEM_NAME STREQUAL "AIX") + # use response files to prevent command-line-too-big errors for large libraries like iam + set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1) + set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES 1) + set(CMAKE_CXX_RESPONSE_FILE_LINK_FLAG "@") + endif() + find_package(Python3 COMPONENTS Interpreter Development) set(PYTHON3_CMD ${PYTHON_EXECUTABLE}) diff --git a/src/aws-cpp-sdk-core/CMakeLists.txt b/src/aws-cpp-sdk-core/CMakeLists.txt index c6a0f1c262ed..e2cf70269fed 100644 --- a/src/aws-cpp-sdk-core/CMakeLists.txt +++ b/src/aws-cpp-sdk-core/CMakeLists.txt @@ -321,6 +321,9 @@ elseif(PLATFORM_LINUX OR PLATFORM_APPLE) #add unix specific impl stuff here. file(GLOB PLATFORM_LINUX_SHARED_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/source/platform/linux-shared/*.cpp") + if(CMAKE_SYSTEM_NAME STREQUAL "AIX") + list(APPEND PLATFORM_LINUX_SHARED_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/source/platform/aix/*.cpp") + endif() file(GLOB AWS_NATIVE_SDK_LINUX_SHARED_SRC ${PLATFORM_LINUX_SHARED_SOURCE} diff --git a/src/aws-cpp-sdk-core/source/platform/aix/TimeHelper.cpp b/src/aws-cpp-sdk-core/source/platform/aix/TimeHelper.cpp new file mode 100644 index 000000000000..8ab073c02238 --- /dev/null +++ b/src/aws-cpp-sdk-core/source/platform/aix/TimeHelper.cpp @@ -0,0 +1,105 @@ +/* + This is free and unencumbered software released into the public domain. + + Anyone is free to copy, modify, publish, use, compile, sell, or + distribute this software, either in source code form or as a compiled + binary, for any purpose, commercial or non-commercial, and by any + means. + + In jurisdictions that recognize copyright laws, the author or authors + of this software dedicate any and all copyright interest in the + software to the public domain. We make this dedication for the benefit + of the public at large and to the detriment of our heirs and + successors. We intend this dedication to be an overt act of + relinquishment in perpetuity of all present and future rights to this + software under copyright law. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + For more information, please refer to + +*/ + +/* timegm() implementation for AIX platform. */ + +#include + +time_t timegm (struct tm *); +time_t timegm (struct tm *tm) +{ + static const int msum [2][12] = { + { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}, /* normal years */ + { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335} /* leap years */ + }; + static const int mlen [2][12] = { + { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, + { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} + }; + static const int tmstr_year= 1900; /* base of 'tm_year' in 'struct tm' */ + static const int epoch_year= 1970; /* unix timestamp epoch */ + static const int base_year= -9999; /* start of a 400-year period: used to be 1601, + but this allows larger range (in 64 bit) + mind you, this is proleptic Gregorian */ + int year, ytmp, dtmp, ytmpe, dtmpe; + int isleapyear; + long long t; + + if (!tm){ + errno = EINVAL; + return (time_t)-1; + } + + year = tm->tm_year + tmstr_year; + isleapyear= (year%4==0) - (year%100==0) + (year%400==0); + + if (year<-9999 || year>9999 || + tm->tm_mon<0 || tm->tm_mon>11 || + tm->tm_mday<1 || tm->tm_mday>mlen[isleapyear][tm->tm_mon] || + tm->tm_hour<0 || tm->tm_hour>23 || + tm->tm_min<0 || tm->tm_min>59 || + tm->tm_sec<0 || tm->tm_sec>59) { + + errno = EINVAL; + return (time_t)-1; + } +/* days between 'current year' and 'epoch_year' has to be calculated + in three steps: */ + +/* 1. days between current year and 'base_year' */ + ytmp = year - base_year; + dtmp = ytmp*365 + ytmp/4 - ytmp/100 + ytmp/400; + +/* 2. days between 'epoch year' and 'base_year' */ + ytmpe = epoch_year - base_year; + dtmpe = ytmpe*365 + ytmpe/4 - ytmpe/100 + ytmpe/400; + +/* 3. days between 'current year' and 'epoch_year' */ + t = dtmp - dtmpe; + + t += msum[isleapyear][tm->tm_mon]; + t += tm->tm_mday-1; + + tm->tm_wday = (t+4)%7;/* 0..6=Sun..Sat; adding 4 to adjust 1970.01.01.=Thursday; */ + if (tm->tm_wday<0) tm->tm_wday += 7; + tm->tm_yday = msum[isleapyear][tm->tm_mon] + tm->tm_mday-1; + tm->tm_isdst= 0; + + t = t*24 + tm->tm_hour; + t = t*60 + tm->tm_min; + t = t*60 + tm->tm_sec; + +#if LONG_MAX == 2147483647L + if (tLONG_MAX) { + errno = EOVERFLOW; + return (time_t)-1; + } +#endif + + return (time_t)t; +} diff --git a/tests/aws-cpp-sdk-core-tests/utils/FileSystemUtilsTest.cpp b/tests/aws-cpp-sdk-core-tests/utils/FileSystemUtilsTest.cpp index d54c8afb4741..feadde87dfe9 100644 --- a/tests/aws-cpp-sdk-core-tests/utils/FileSystemUtilsTest.cpp +++ b/tests/aws-cpp-sdk-core-tests/utils/FileSystemUtilsTest.cpp @@ -12,6 +12,9 @@ #include #include #endif +#ifdef _AIX +#define NAME_MAX 255 +#endif using namespace Aws; using namespace Aws::Utils;