Skip to content

Commit

Permalink
Update libxml2 to 2.13.5
Browse files Browse the repository at this point in the history
IB-8259

Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma committed Jan 2, 2025
1 parent a708f24 commit f0dd115
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 82 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
- name: Prepare vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: e2edf52610d2c94d2038fe30b247ea5a26964e1b
vcpkgGitCommitId: e4644bd15436d406bba71928d086c809e5c9ca45
vcpkgJsonGlob: ./vcpkg.json
runVcpkgInstall: true
env:
Expand All @@ -100,7 +100,6 @@ jobs:
with:
name: ${{ matrix.target }}
path: |
build/macos/libdigidocpp*.*
libdigidocpp*.zip
fedora:
name: Build on Fedora ${{ matrix.container }}
Expand Down Expand Up @@ -187,7 +186,7 @@ jobs:
- name: Prepare vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: e2edf52610d2c94d2038fe30b247ea5a26964e1b
vcpkgGitCommitId: e4644bd15436d406bba71928d086c809e5c9ca45
vcpkgJsonGlob: ./vcpkg.json
runVcpkgInstall: true
runVcpkgFormatString: "[`install`, `--recurse`, `--clean-after-build`, `--x-install-root`, `$[env.VCPKG_INSTALLED_DIR]`, `--triplet`, `$[env.VCPKG_DEFAULT_TRIPLET]`, `--x-feature`, `tests`]"
Expand Down
30 changes: 13 additions & 17 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ else()
set(BUILD_VER 0)
endif()

add_definitions(
-DMAJOR_VER=${PROJECT_VERSION_MAJOR}
-DMINOR_VER=${PROJECT_VERSION_MINOR}
-DRELEASE_VER=${PROJECT_VERSION_PATCH}
-DBUILD_VER=${BUILD_VER}
)
set(VERSION ${PROJECT_VERSION}.${BUILD_VER})

configure_file( libdigidocpp.pc.cmake libdigidocpp.pc @ONLY )
Expand Down Expand Up @@ -63,14 +57,20 @@ set( CRYPTO_HEADER
)

add_library(digidocpp_ver INTERFACE)
target_sources(digidocpp_ver INTERFACE libdigidocpp.rc)
target_compile_definitions(digidocpp_ver INTERFACE
VERSION_STR="${VERSION}"
$<$<PLATFORM_ID:Windows>:VERSION=${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},${PROJECT_VERSION_PATCH},${BUILD_VER}>
$<$<PLATFORM_ID:Windows>:TARGET_NAME="$<TARGET_PROPERTY:NAME>">
$<$<PLATFORM_ID:Windows>:$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:APP>>
)

add_library(digidocpp_util STATIC
util/File.cpp
util/log.cpp
libdigidocpp.rc
)

target_link_libraries(digidocpp_util PRIVATE $<$<OR:$<PLATFORM_ID:Darwin>,$<PLATFORM_ID:iOS>>:-framework\ CoreFoundation>)
target_link_libraries(digidocpp_util PUBLIC digidocpp_ver PRIVATE $<$<OR:$<PLATFORM_ID:Darwin>,$<PLATFORM_ID:iOS>>:-framework\ CoreFoundation>)

add_library(digidocpp_priv STATIC
crypto/Connect.cpp
Expand Down Expand Up @@ -149,18 +149,17 @@ set_target_properties(digidocpp PROPERTIES
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${PROJECT_VERSION}
MACOSX_FRAMEWORK_BUNDLE_VERSION ${BUILD_VER}
MACOSX_RPATH YES
COMPILE_DEFINITIONS TARGET_NAME="$<TARGET_NAME:digidocpp>"
POSITION_INDEPENDENT_CODE YES
)

target_include_directories(digidocpp
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
)
target_link_libraries(digidocpp PRIVATE ${CMAKE_DL_LIBS} minizip digidocpp_priv digidocpp_ver)
target_link_libraries(digidocpp PRIVATE ${CMAKE_DL_LIBS} minizip digidocpp_priv)

if( BUILD_TOOLS )
add_executable(digidoc-tool digidoc-tool.rc digidoc-tool.cpp)
add_executable(digidoc-tool digidoc-tool.cpp)
target_link_libraries(digidoc-tool digidocpp digidocpp_priv Threads::Threads)
configure_file( digidoc-tool.1.cmake digidoc-tool.1 )
endif()
Expand All @@ -181,8 +180,7 @@ if(SWIG_FOUND)
set(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}/java)
swig_add_library(digidoc_java LANGUAGE java SOURCES ../libdigidocpp.i)
target_include_directories(digidoc_java PRIVATE ${JAVA_INCLUDE_PATH} $<$<BOOL:${JAVA_INCLUDE_PATH2}>:${JAVA_INCLUDE_PATH2}>)
target_compile_definitions(digidoc_java PRIVATE TARGET_NAME="$<TARGET_NAME:digidoc_java>")
target_link_libraries(digidoc_java digidocpp digidocpp_util digidocpp_ver)
target_link_libraries(digidoc_java digidocpp digidocpp_util)
set_target_properties(digidoc_java PROPERTIES
INSTALL_RPATH $<$<PLATFORM_ID:Darwin>:/Library/Frameworks>
SWIG_COMPILE_DEFINITIONS $<$<PLATFORM_ID:Windows>:SWIGWIN>
Expand All @@ -197,8 +195,7 @@ if(SWIG_FOUND)
set(CMAKE_SWIG_FLAGS -py3)
set(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR})
swig_add_library(digidoc_python LANGUAGE python SOURCES ../libdigidocpp.i)
target_compile_definitions(digidoc_python PRIVATE TARGET_NAME="$<TARGET_NAME:digidoc_python>")
target_link_libraries(digidoc_python digidocpp digidocpp_util digidocpp_ver)
target_link_libraries(digidoc_python digidocpp digidocpp_util)
if(TARGET Python3::SABIModule)
target_compile_definitions(digidoc_python PRIVATE Py_LIMITED_API=0x03090000)
target_link_libraries(digidoc_python Python3::SABIModule)
Expand All @@ -225,8 +222,7 @@ if(SWIG_FOUND)
set(CMAKE_SWIG_FLAGS -namespace digidoc)
set(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}/csharp)
swig_add_library(digidoc_csharp LANGUAGE csharp SOURCES ../libdigidocpp.i)
target_compile_definitions(digidoc_csharp PRIVATE TARGET_NAME="$<TARGET_NAME:digidoc_csharp>")
target_link_libraries(digidoc_csharp digidocpp digidocpp_util digidocpp_ver)
target_link_libraries(digidoc_csharp digidocpp digidocpp_util)
set_target_properties(digidoc_csharp PROPERTIES
SWIG_COMPILE_DEFINITIONS $<$<PLATFORM_ID:Windows>:SWIGWIN>
INSTALL_RPATH $<$<PLATFORM_ID:Darwin>:/Library/Frameworks>
Expand Down
4 changes: 2 additions & 2 deletions src/Container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ string digidoc::userAgent() { return m_userAgent; }
* Returns libdigidocpp library version
*/
string digidoc::version() {
return FILE_VER_STR;
return VERSION_STR;
}

/**
Expand Down Expand Up @@ -121,7 +121,7 @@ void digidoc::initialize(const string &appInfo, const string &userAgent, initCal

INFO("Libxml2 version: %s", LIBXML_DOTTED_VERSION);
INFO("Xmlsec1 version: %s", XMLSEC_VERSION);
INFO("digidocpp version: %s", FILE_VER_STR);
INFO("digidocpp version: %s", VERSION_STR);

if(!Conf::instance())
Conf::init(new XmlConfCurrent);
Expand Down
6 changes: 3 additions & 3 deletions src/SignatureXAdES_LT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ void SignatureXAdES_LT::validate(const string &policy) const
try {
auto revocationValues = unsignedSignatureProperties()/"RevocationValues";
if(!revocationValues)
THROW_MAIN(exception, "RevocationValues object is missing")
THROW("RevocationValues object is missing");
if(revocationValues + 1)
THROW_MAIN(exception, "More than one RevocationValues object is not supported")
THROW("More than one RevocationValues object is not supported");
auto ocspValues = revocationValues/"OCSPValues";
if(!ocspValues)
THROW_MAIN(exception, "OCSPValues is missing")
THROW("OCSPValues is missing");

/*
* Find OCSP response that matches with signingCertificate.
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/Connect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ Connect::Connect(const string &_url, string _method, int _timeout, const vector<
else
addHeader("Host", host + ':' + port);
if(const auto &agent = userAgentData.empty() ? userAgent() : userAgentData; !agent.empty())
addHeader("User-Agent", "LIB libdigidocpp/" FILE_VER_STR " (" TARGET_ARCH ") APP " + agent);
addHeader("User-Agent", "LIB libdigidocpp/" VERSION_STR " (" TARGET_ARCH ") APP " + agent);
if(usessl == 0)
sendProxyAuth();
}
Expand Down
4 changes: 2 additions & 2 deletions src/digidoc-tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -995,13 +995,13 @@ static int tslcmd(int /*argc*/, char* /*argv*/[])
int main(int argc, char *argv[]) try
{
printf("Version\n");
printf(" digidoc-tool version: %s\n", FILE_VER_STR);
printf(" digidoc-tool version: %s\n", VERSION_STR);
printf(" libdigidocpp version: %s\n", version().c_str());

ToolConfig *conf = nullptr;
Conf::init(conf = new ToolConfig(argc, argv));
stringstream info;
info << "digidoc-tool/" << FILE_VER_STR << " (";
info << "digidoc-tool/" << VERSION_STR << " (";
#ifdef _WIN32
info << "Windows";
#elif __APPLE__
Expand Down
38 changes: 0 additions & 38 deletions src/digidoc-tool.rc

This file was deleted.

19 changes: 12 additions & 7 deletions src/libdigidocpp.rc
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
#include <winver.h>

#define VER_STR_HELPER(x) #x
#define VER_STR(x) VER_STR_HELPER(x)

VS_VERSION_INFO VERSIONINFO
FILEVERSION MAJOR_VER,MINOR_VER,RELEASE_VER,BUILD_VER
PRODUCTVERSION MAJOR_VER,MINOR_VER,RELEASE_VER,BUILD_VER
FILEVERSION VERSION
PRODUCTVERSION VERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS_NT_WINDOWS32
#ifdef APP
FILETYPE VFT_APP
#else
FILETYPE VFT_DLL
#endif
FILESUBTYPE VFT_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
Expand All @@ -22,12 +23,16 @@ BEGIN
BEGIN
VALUE "CompanyName", "RIA"
VALUE "FileDescription", TARGET_NAME
VALUE "FileVersion", VER_STR(MAJOR_VER.MINOR_VER.RELEASE_VER.BUILD_VER)
VALUE "FileVersion", VERSION_STR
VALUE "InternalName", TARGET_NAME
VALUE "LegalCopyright", "(C) 2009-2024 Estonian Information System Authority"
#ifdef APP
VALUE "OriginalFilename", TARGET_NAME ".exe"
#else
VALUE "OriginalFilename", TARGET_NAME ".dll"
#endif
VALUE "ProductName", TARGET_NAME
VALUE "ProductVersion", VER_STR(MAJOR_VER.MINOR_VER.RELEASE_VER.BUILD_VER)
VALUE "ProductVersion", VERSION_STR
END
END
BLOCK "VarFileInfo"
Expand Down
3 changes: 1 addition & 2 deletions src/util/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void Log::out(LogType type, const char *file, unsigned int line, const char *for
va_end(args);
}

void Log::dbgPrintfMemImpl(const char *msg, const void *ptr, size_t size, const char *file, int line)
void Log::dbgPrintfMemImpl(const char *msg, const unsigned char *data, size_t size, const char *file, int line)
{
Conf *conf = Conf::instance();
if(!conf || conf->logLevel() < DebugType)
Expand All @@ -119,7 +119,6 @@ void Log::dbgPrintfMemImpl(const char *msg, const void *ptr, size_t size, const
o = &f;
}

const unsigned char *data = (const unsigned char*)ptr;
*o << "DEBUG [" << File::fileName(file) << ':' << line << "] - " << msg << " { ";
*o << hex << uppercase << setfill('0');
for(size_t i = 0; i < size; ++i)
Expand Down
7 changes: 1 addition & 6 deletions src/util/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace digidoc

static std::string format(const char *fmt, ...);
static void out(LogType type, const char *file, unsigned int line, const char *format, ...);
static void dbgPrintfMemImpl(const char *msg, const void *ptr, size_t size, const char *file, int line);
static void dbgPrintfMemImpl(const char *msg, const unsigned char *data, size_t size, const char *file, int line);
static std::string formatArgList(const char *fmt, va_list args);
};
}
Expand All @@ -49,12 +49,7 @@ namespace digidoc
#define DEBUG(...) digidoc::Log::out(digidoc::Log::DebugType, __FILE__, __LINE__, __VA_ARGS__)
#define DEBUGMEM(msg, ptr, size) digidoc::Log::dbgPrintfMemImpl(msg, ptr, size, __FILE__, __LINE__)

#define VER_STR_HELPER(x) #x
#define VER_STR(x) VER_STR_HELPER(x)
#define FILE_VER_STR VER_STR(MAJOR_VER.MINOR_VER.RELEASE_VER.BUILD_VER)

#define EXCEPTION_PARAMS(...) __FILE__, __LINE__, digidoc::Log::format(__VA_ARGS__)
#define EXCEPTION_ADD(_main, ...) _main.addCause(digidoc::Exception(EXCEPTION_PARAMS(__VA_ARGS__)))
#define THROW(...) throw digidoc::Exception(EXCEPTION_PARAMS(__VA_ARGS__))
#define THROW_CAUSE(_cause, ...) throw digidoc::Exception(EXCEPTION_PARAMS(__VA_ARGS__), _cause)
#define THROW_MAIN(_main, ...) { EXCEPTION_ADD(_main, __VA_ARGS__); throw _main; }
2 changes: 1 addition & 1 deletion vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"features": {
"tests": { "description": "Build tests", "dependencies": ["boost-test"] }
},
"builtin-baseline": "e2edf52610d2c94d2038fe30b247ea5a26964e1b",
"builtin-baseline": "e4644bd15436d406bba71928d086c809e5c9ca45",
"vcpkg-configuration": {
"overlay-triplets": ["./vcpkg-triplets"],
"overlay-ports": [
Expand Down

0 comments on commit f0dd115

Please sign in to comment.