Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 26 additions & 23 deletions ports/xmlsec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,34 +68,36 @@ target_include_directories(xmlsec1 PUBLIC
target_link_libraries(xmlsec1 PUBLIC LibXml2::LibXml2)
target_link_libraries(xmlsec1-openssl PUBLIC xmlsec1 OpenSSL::Crypto)

add_compile_definitions(inline=__inline)
add_compile_definitions(PACKAGE="xmlsec1")
add_compile_definitions(HAVE_STDIO_H)
add_compile_definitions(HAVE_STDLIB_H)
add_compile_definitions(HAVE_STRING_H)
add_compile_definitions(HAVE_CTYPE_H)
add_compile_definitions(HAVE_MALLOC_H)
add_compile_definitions(HAVE_MEMORY_H)
add_compile_definitions(XMLSEC_DEFAULT_CRYPTO="openssl")
add_compile_definitions(UNICODE)
add_compile_definitions(_UNICODE)
add_compile_definitions(_MBCS)
add_compile_definitions(_REENTRANT)
add_compile_definitions(
inline=__inline
PACKAGE="xmlsec1"
HAVE_STDIO_H
HAVE_STDLIB_H
HAVE_STRING_H
HAVE_CTYPE_H
HAVE_MALLOC_H
HAVE_MEMORY_H
XMLSEC_DEFAULT_CRYPTO="openssl"
UNICODE
_UNICODE
_MBCS
_REENTRANT
WIN32_LEAN_AND_MEAN
)

set_target_properties(xmlsec1 xmlsec1-openssl PROPERTIES VERSION ${XMLSEC_VERSION_MAJOR}.${XMLSEC_VERSION_MINOR})

set(XMLSEC_CORE_CFLAGS "")
set(XMLSEC_CORE_CFLAGS XMLSEC_NO_XSLT XMLSEC_CRYPTO_OPENSSL XMLSEC_NO_FTP XMLSEC_NO_HTTP)
if(NOT BUILD_SHARED_LIBS)
set(XMLSEC_CORE_CFLAGS "-DLIBXML_STATIC -DXMLSEC_STATIC -DXMLSEC_NO_CRYPTO_DYNAMIC_LOADING")
target_compile_definitions(xmlsec1 PUBLIC XMLSEC_STATIC XMLSEC_NO_CRYPTO_DYNAMIC_LOADING)
list(APPEND XMLSEC_CORE_CFLAGS XMLSEC_STATIC XMLSEC_NO_CRYPTO_DYNAMIC_LOADING)
endif()
set(XMLSEC_OPENSSL_CFLAGS ${XMLSEC_CORE_CFLAGS})
set(XMLSEC_OPENSSL_CFLAGS XMLSEC_NO_MD5 XMLSEC_NO_RIPEMD160 XMLSEC_NO_GOST XMLSEC_NO_GOST2012)

target_compile_definitions(xmlsec1
PRIVATE $<$<PLATFORM_ID:Windows>:XMLSEC_DL_WIN32>
PUBLIC XMLSEC_NO_XSLT XMLSEC_CRYPTO_OPENSSL
PUBLIC ${XMLSEC_CORE_CFLAGS}
)
target_compile_definitions(xmlsec1-openssl PUBLIC XMLSEC_NO_GOST XMLSEC_NO_GOST2012)
target_compile_definitions(xmlsec1-openssl PUBLIC ${XMLSEC_OPENSSL_CFLAGS})

install(TARGETS xmlsec1 xmlsec1-openssl
EXPORT unofficial-xmlsec-targets
Expand Down Expand Up @@ -153,11 +155,12 @@ set(libdir ${prefix}/${CMAKE_INSTALL_LIBDIR})
set(includedir ${prefix}/${CMAKE_INSTALL_INCLUDEDIR})
set(VERSION ${XMLSEC_VERSION})
set(LIBXML_MIN_VERSION ${LIBXML2_VERSION_STRING})
set(OPENSSL_LIBS "-lcrypto")
set(XMLSEC_CORE_CFLAGS "${XMLSEC_CORE_CFLAGS} -DXMLSEC_DL_LIBLTDL=1 -I\${includedir}/xmlsec1 -DXMLSEC_CRYPTO_OPENSSL=1")
list(JOIN XMLSEC_CORE_CFLAGS " -D" XMLSEC_CORE_CFLAGS)
set(XMLSEC_CORE_CFLAGS "-D${XMLSEC_CORE_CFLAGS} -I\${includedir}/xmlsec1")
set(XMLSEC_CORE_LIBS "-lxmlsec1 -lltdl")
set(XMLSEC_OPENSSL_CFLAGS "${XMLSEC_OPENSSL_CFLAGS} -I\${includedir}/xmlsec1")
set(XMLSEC_OPENSSL_LIBS "-L\${libdir} -lxmlsec1-openssl ${XMLSEC_CORE_LIBS} ${OPENSSL_LIBS}")
list(JOIN XMLSEC_OPENSSL_CFLAGS " -D" XMLSEC_OPENSSL_CFLAGS)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't this OpenSSL stuff coming from find_package? (I'm not saying this wrong per se, I just want to make sure I have an understanding of what's going on here before reviewing it incorrectly 😅)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am really not that familiar with pkg-config. Is there some sort of dependency system?
Upstream hardcodes also flags to pkg-config files.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pkg-config dependency system is the Requires and Requires.private fields.

(Isn't it possible to use vcpkg-make instead of maintaining a vcpkg CMakeLists.txt?)

Copy link
Contributor Author

@metsma metsma Feb 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed that pkg-config files were out of sync with cmake parameters and improve current situation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Isn't it possible to use vcpkg-make instead of maintaining a vcpkg CMakeLists.txt?)

The make handling has gotten a LOT better over time; if we can use upstream's build system we should if at all possible though. I don't think we should block someone trying to do a 'simple update' on changing the build system but this seems to already be doing a lot of surgery.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess, I'm not sure it does improve the current situation? This can't seem to make up its mind about whether it wants OpenSSL::OpenSSL or to hard code -lcrypto and friends. It seems like that can't be correct.

I'm all for 'code that isn't green doesn't necessarily have to change even if it does unfortunate things' but you made this code green :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I follow. Here's an example showing that the pkg-config vs cmake files are missing the compile definitions used. If this change is distracting, I can revert to the previous setup.
Current:

Name: xmlsec1
Version: 1.3.6
Description: XML Security Library implements XML Signature and XML Encryption standards
Requires: libxml-2.0 >= 2.13.5 
Cflags:  -DXMLSEC_DL_LIBLTDL=1 "-I${includedir}/xmlsec1" -DXMLSEC_CRYPTO_OPENSSL=1
Libs: "-L${libdir}" -lxmlsec1 -lltdl

Name: xmlsec1-openssl
Version: 1.3.6
Description: XML Security Library implements XML Signature and XML Encryption standards
Requires: libxml-2.0 >= 2.13.5 
Cflags:  "-I${includedir}/xmlsec1"
Libs: "-L${libdir}" -lxmlsec1-openssl -lxmlsec1 -lltdl -lcrypto


set_target_properties(unofficial::xmlsec::xmlsec1 PROPERTIES
  INTERFACE_COMPILE_DEFINITIONS "XMLSEC_NO_XSLT;XMLSEC_CRYPTO_OPENSSL"
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "LibXml2::LibXml2"
)

set_target_properties(unofficial::xmlsec::xmlsec1-openssl PROPERTIES
  INTERFACE_COMPILE_DEFINITIONS "XMLSEC_NO_GOST;XMLSEC_NO_GOST2012"
  INTERFACE_LINK_LIBRARIES "unofficial::xmlsec::xmlsec1;OpenSSL::Crypto"
)

New:

Name: xmlsec1
Version: 1.3.7
Description: XML Security Library implements XML Signature and XML Encryption standards
Requires: libxml-2.0 >= 2.13.5 
Cflags: -DXMLSEC_NO_XSLT -DXMLSEC_CRYPTO_OPENSSL "-I${includedir}/xmlsec1"
Libs: "-L${libdir}" -lxmlsec1 -lltdl

Name: xmlsec1-openssl
Version: 1.3.7
Description: XML Security Library implements XML Signature and XML Encryption standards
Requires: libxml-2.0 >= 2.13.5 
Cflags: -DXMLSEC_NO_XSLT -DXMLSEC_CRYPTO_OPENSSL "-I${includedir}/xmlsec1" -DXMLSEC_NO_MD5 -DXMLSEC_NO_RIPEMD160 -DXMLSEC_NO_GOST -DXMLSEC_NO_GOST2012
Libs: "-L${libdir}" -lxmlsec1-openssl -lxmlsec1 -lltdl -lcrypto


set_target_properties(unofficial::xmlsec::xmlsec1 PROPERTIES
  INTERFACE_COMPILE_DEFINITIONS "XMLSEC_NO_XSLT;XMLSEC_CRYPTO_OPENSSL"
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "LibXml2::LibXml2"
)

set_target_properties(unofficial::xmlsec::xmlsec1-openssl PROPERTIES
  INTERFACE_COMPILE_DEFINITIONS "XMLSEC_NO_MD5;XMLSEC_NO_RIPEMD160;XMLSEC_NO_GOST;XMLSEC_NO_GOST2012"
  INTERFACE_LINK_LIBRARIES "unofficial::xmlsec::xmlsec1;OpenSSL::Crypto"
)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it is easier dump the pkg-config changes to get the version pump accepted?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I think you've shown that the output at least isn't worse than what was here before.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(But I still think the correct thing to do is to get_target_properties or similar what the real flags should be out of OpenSSL::OpenSSL rather than assuming it will be exactly -lcrypto)

set(XMLSEC_OPENSSL_CFLAGS "${XMLSEC_CORE_CFLAGS} -D${XMLSEC_OPENSSL_CFLAGS}")
set(XMLSEC_OPENSSL_LIBS "-L\${libdir} -lxmlsec1-openssl ${XMLSEC_CORE_LIBS} -lcrypto")

configure_file(${PROJECT_SOURCE_DIR}/xmlsec.pc.in ${PROJECT_BINARY_DIR}/xmlsec1.pc @ONLY)
configure_file(${PROJECT_SOURCE_DIR}/xmlsec-openssl.pc.in ${PROJECT_BINARY_DIR}/xmlsec1-openssl.pc @ONLY)
Expand Down
2 changes: 1 addition & 1 deletion ports/xmlsec/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO lsh123/xmlsec
REF "${release_tag}"
SHA512 6e41c35042e5a74e135cfb7468aa5c09b3c9ba684ab2431ecedce950f7c99c92fc8765c1c8c2ddfd87718bd00f4a287028227da1e987f2ef17ce2594356e81af
SHA512 28130c10d79f652e3533e6ede5fdaab0f6db5a4bbaaca4713b62df9af2ae2d5314acf82d01f344f87faf95c12099fd77e0858cbe5232a96de1d531e6284ede1b
HEAD_REF master
PATCHES
pkgconfig_fixes.patch
Expand Down
2 changes: 1 addition & 1 deletion ports/xmlsec/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xmlsec",
"version": "1.3.6",
"version": "1.3.7",
"description": "XML Security Library is a C library based on LibXML2. The library supports major XML security standards.",
"homepage": "https://www.aleksey.com/xmlsec/",
"license": "X11 AND MPL-1.1",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -9993,7 +9993,7 @@
"port-version": 0
},
"xmlsec": {
"baseline": "1.3.6",
"baseline": "1.3.7",
"port-version": 0
},
"xnnpack": {
Expand Down
5 changes: 5 additions & 0 deletions versions/x-/xmlsec.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "981d2bea8296b17959768d20e8842643870b4cb6",
"version": "1.3.7",
"port-version": 0
},
{
"git-tree": "53a0926b6c125320e29773130a9992c43cfd9815",
"version": "1.3.6",
Expand Down