Skip to content
Snippets Groups Projects
Commit 9fa56f9d authored by Georgios Bitzes's avatar Georgios Bitzes Committed by Pere Mato
Browse files

Make TDavixFile compatible with older davix versions again

parent 15c4226f
Branches
Tags
No related merge requests found
...@@ -1056,7 +1056,7 @@ if(davix OR builtin_davix) ...@@ -1056,7 +1056,7 @@ if(davix OR builtin_davix)
if(NOT davix) if(NOT davix)
set(davix ON CACHE BOOL "" FORCE) set(davix ON CACHE BOOL "" FORCE)
endif() endif()
set(DAVIX_VERSION 0.6.3) set(DAVIX_VERSION 0.6.4)
message(STATUS "Downloading and building Davix version ${DAVIX_VERSION}") message(STATUS "Downloading and building Davix version ${DAVIX_VERSION}")
string(REPLACE "-Wall " "" __cxxflags "${CMAKE_CXX_FLAGS}") # Otherwise it produces tones of warnings string(REPLACE "-Wall " "" __cxxflags "${CMAKE_CXX_FLAGS}") # Otherwise it produces tones of warnings
string(REPLACE "-W " "" __cxxflags "${__cxxflags}") string(REPLACE "-W " "" __cxxflags "${__cxxflags}")
...@@ -1069,8 +1069,7 @@ if(davix OR builtin_davix) ...@@ -1069,8 +1069,7 @@ if(davix OR builtin_davix)
DAVIX DAVIX
# http://grid-deployment.web.cern.ch/grid-deployment/dms/lcgutil/tar/davix/davix-embedded-${DAVIX_VERSION}.tar.gz # http://grid-deployment.web.cern.ch/grid-deployment/dms/lcgutil/tar/davix/davix-embedded-${DAVIX_VERSION}.tar.gz
URL ${repository_tarfiles}/davix-embedded-${DAVIX_VERSION}.tar.gz URL ${repository_tarfiles}/davix-embedded-${DAVIX_VERSION}.tar.gz
# Patch need. see https://github.com/cern-it-sdc-id/davix/issues/6 PATCH_COMMAND patch -p1 -i ${CMAKE_SOURCE_DIR}/cmake/patches/davix-${DAVIX_VERSION}.patch
# PATCH_COMMAND patch -p1 -i ${CMAKE_SOURCE_DIR}/cmake/patches/davix-${DAVIX_VERSION}.patch
CMAKE_CACHE_ARGS -DCMAKE_PREFIX_PATH:STRING=${OPENSSL_PREFIX} CMAKE_CACHE_ARGS -DCMAKE_PREFIX_PATH:STRING=${OPENSSL_PREFIX}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
......
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 56f830c..b1d308c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,6 +37,9 @@ set(VERSION_TAG "std")
# dependency mode
option(BOOST_EXTERNAL "Enable the usage of an external boost dependency" TRUE)
+# components
+option(ENABLE_TOOLS "enable or disable tools " TRUE)
+
# features
option(ENABLE_IPV6 "enable or disable IPv6 support " TRUE)
option(ENABLE_TCP_NODELAY "enable or disable tcp_nodelay" TRUE)
@@ -78,10 +81,10 @@ add_definitions( -D__DAVIX_INSIDE__) # protection flag
add_definitions( -D__STDC_LIMIT_MACROS ) # C99 limit macros
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAG_ENABLE}")
+include_directories( ${Boost_INCLUDE_DIRS})
include_directories( ${HTTPLIB_PKG_INCLUDE_DIRS} ${GLIB2_PKG_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/deps ${CMAKE_CURRENT_SOURCE_DIR}/deps/libneon/src/ )
include_directories( ${CMAKE_SOURCE_DIR}/include/davix )
include_directories( ${CMAKE_SOURCE_DIR}/src/libs/)
-include_directories( ${Boost_INCLUDE_DIRS})
add_subdirectory (src)
add_subdirectory (doc)
diff --git a/deps/libneon/src/CMakeLists.txt b/deps/libneon/src/CMakeLists.txt
index a412fee..1eb67db 100644
--- a/deps/libneon/src/CMakeLists.txt
+++ b/deps/libneon/src/CMakeLists.txt
@@ -16,4 +16,9 @@ endif(HAVE_GNUTLS)
add_library(neon STATIC ${src_neon} ${src_ssl})
+# if the static library is produced, then we need also to install the dependent libraries to be useful
+if(STATIC_LIBRARY)
+ install(TARGETS neon DESTINATION ${LIB_INSTALL_DIR} )
+endif()
+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e318b90..ed341d0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -28,7 +28,9 @@ link_directories(${HTTPLIB_PKG_LIBRARY_DIR} ${CRYPTO_PKG_LIBRARY_DIR}
add_subdirectory(copy)
add_subdirectory(libs)
add_subdirectory(xml)
-add_subdirectory(tools)
+if(ENABLE_TOOLS)
+ add_subdirectory(tools)
+endif()
add_subdirectory(neon)
SET(SRC_HTTP ${src_neon})
@@ -64,6 +66,9 @@ add_PkgConfigFile_for_Library("davix.pc" libdavix
CFLAGS " -D_FILE_OFFSET_BITS=64 "
DESCRIPTION "Libdavix, IO library for HTTP based protocols"
)
+#install pkgconfig
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/davix.pc
+ DESTINATION ${PKGCONFIG_FILES_DIR} )
endif(SHARED_LIBRARY)
@@ -86,8 +91,4 @@ endif(STATIC_LIBRARY)
SET(davix_tool_common_src "${davix_tool_common_src_up}" PARENT_SCOPE)
-#install pkgconfig
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/davix.pc
- DESTINATION ${PKGCONFIG_FILES_DIR} )
-
diff --git a/deps/boost_intern/src/CMakeLists.txt b/src/CMakeLists.txt
index 6e169bb..2426393 100644
--- a/deps/boost_intern/src/CMakeLists.txt
+++ b/deps/boost_intern/src/CMakeLists.txt
@@ -18,4 +18,9 @@ add_definitions( -fPIC )
add_definitions(-fvisibility=hidden)
add_library(boost_static_internal STATIC ${SRC_BOOST_ALL})
+# if the static library is produced, then we need also to install the dependent libraries to be useful
+if(STATIC_LIBRARY)
+ install(TARGETS boost_static_internal DESTINATION ${LIB_INSTALL_DIR} )
+endif()
+
endif(NOT Boost_FOUND)
--- davix-embedded-0.3.6/src/davixcontext.cpp 2014-08-12 12:18:14.000000000 +0200
+++ DAVIX/src/davixcontext.cpp 2015-12-01 11:09:22.069145677 +0100
@@ -30,7 +30,7 @@
-static const std::string _version = DAVIX_VERSION "-" DAVIX_VERSION_TAG;
+//static const std::string _version = DAVIX_VERSION "-" DAVIX_VERSION_TAG;
namespace Davix{
@@ -144,6 +144,7 @@
const std::string & version(){
+ static const std::string _version = DAVIX_VERSION "-" DAVIX_VERSION_TAG;
return _version;
}
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 62d2d53..2363692 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -92,7 +92,6 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/libs/)
add_subdirectory (src)
add_subdirectory (doc)
-add_subdirectory (dist)
add_subdirectory (test)
add_subdirectory (packaging)
...@@ -98,6 +98,9 @@ private: ...@@ -98,6 +98,9 @@ private:
void enableGridMode(); void enableGridMode();
void setAwsRegion(const std::string & region);
void setAwsToken(const std::string & token);
void setS3Auth(const std::string & secret, const std::string & access, void setS3Auth(const std::string & secret, const std::string & access,
const std::string & region, const std::string & token); const std::string & region, const std::string & token);
......
...@@ -286,6 +286,30 @@ void TDavixFileInternal::enableGridMode() ...@@ -286,6 +286,30 @@ void TDavixFileInternal::enableGridMode()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void TDavixFileInternal::setAwsRegion(const std::string & region) {
if(!region.empty()) {
#ifdef DAVIX_HAS_AWS_V4
Info("setAwsRegion", "Setting S3 Region to '%s' - v4 signature will be used", region.c_str());
davixParam->setAwsRegion(region);
#else
#warning "Using an old version of davix - no support for AWS v4 signatures. Configure ROOT with -builtin_davix to use a newer version."
Warning("setAwsRegion", "Unable to set AWS region, not supported by this version of davix");
#endif
}
}
void TDavixFileInternal::setAwsToken(const std::string & token) {
if(!token.empty()) {
#ifdef DAVIX_HAS_AWS_TOKEN
Info("setAwsToken", "Setting S3 STS temporary credentials");
davixParam->setAwsToken(token);
#else
#warning "Using an old version of davix - no support for AWS STS tokens. Configure ROOT with -builtin_davix to use a newer version."
Warning("setAwsToken", "Unable to set AWS token, not supported by this version of davix");
#endif
}
}
void TDavixFileInternal::setS3Auth(const std::string &secret, const std::string &access, void TDavixFileInternal::setS3Auth(const std::string &secret, const std::string &access,
const std::string &region, const std::string &token) const std::string &region, const std::string &token)
{ {
...@@ -297,8 +321,8 @@ void TDavixFileInternal::setS3Auth(const std::string &secret, const std::string ...@@ -297,8 +321,8 @@ void TDavixFileInternal::setS3Auth(const std::string &secret, const std::string
davixParam->setAwsAuthorizationKeys(secret, access); davixParam->setAwsAuthorizationKeys(secret, access);
davixParam->setProtocol(RequestProtocol::AwsS3); davixParam->setProtocol(RequestProtocol::AwsS3);
davixParam->setAwsRegion(region); setAwsRegion(region);
davixParam->setAwsToken(token); setAwsToken(token);
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
...@@ -331,13 +355,11 @@ void TDavixFileInternal::parseConfig() ...@@ -331,13 +355,11 @@ void TDavixFileInternal::parseConfig()
// need to set region? // need to set region?
if ( (env_var = gEnv->GetValue("Davix.S3.Region", getenv("S3_REGION"))) != NULL) { if ( (env_var = gEnv->GetValue("Davix.S3.Region", getenv("S3_REGION"))) != NULL) {
Info("parseConfig", "Setting S3 Region to '%s' - v4 signature will be used", env_var); setAwsRegion(env_var);
davixParam->setAwsRegion(env_var);
} }
// need to set STS token? // need to set STS token?
if( (env_var = gEnv->GetValue("Davix.S3.Token", getenv("S3_TOKEN"))) != NULL) { if( (env_var = gEnv->GetValue("Davix.S3.Token", getenv("S3_TOKEN"))) != NULL) {
Info("parseConfig", "Setting S3 STS temporary credentials"); setAwsToken(env_var);
davixParam->setAwsToken(env_var);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment