Skip to content

Commit

Permalink
[libxml2] Improve pc file (#17747)
Browse files Browse the repository at this point in the history
* Use rcVersion.h.in from PORT_DIR directly

* Inject static linking deps into pc file

* x-add-version

* Insert requires pc modules directly

* x-add-version
  • Loading branch information
dg0yt committed May 19, 2021
1 parent 5e7278a commit 5554e3f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
9 changes: 8 additions & 1 deletion ports/libxml2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsSt
_WINSOCK_DEPRECATED_NO_WARNINGS
)
target_sources(libxml2 PRIVATE win32/libxml2.rc)
configure_file(rcVersion.h.in include/rcVersion.h @ONLY)
configure_file("${PORT_DIR}/rcVersion.h.in" include/rcVersion.h @ONLY)
endif()

target_compile_definitions(libxml2 PRIVATE
Expand Down Expand Up @@ -166,6 +166,13 @@ install(TARGETS libxml2
)

# pkgconfig
if(NOT Iconv_IS_BUILT_IN)
set(ICONV_LIBS "-liconv")
endif()
if(UNIX)
set(M_LIBS "-lm")
set(THREAD_LIBS "-pthread")
endif()
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\${prefix}")
set(libdir ${prefix}/${CMAKE_INSTALL_LIBDIR})
Expand Down
5 changes: 4 additions & 1 deletion ports/libxml2/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ vcpkg_from_github(
)

file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/rcVersion.h.in DESTINATION ${SOURCE_PATH})

if (VCPKG_TARGET_IS_UWP)
message(WARNING "Feature network couldn't be enabled on UWP, disable http and ftp automatically.")
Expand Down Expand Up @@ -35,6 +34,10 @@ if(VCPKG_TARGET_IS_WINDOWS)
endif()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libxml-2.0.pc" "-lxml2" "-llibxml2")
endif ()
if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libxml-2.0.pc" "\nRequires:\n" "\nRequires.private: liblzma zlib\n")
endif()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libxml-2.0.pc" "\nRequires:\n" "\nRequires.private: liblzma zlib\n")
vcpkg_fixup_pkgconfig()

vcpkg_copy_pdbs()
Expand Down
2 changes: 1 addition & 1 deletion ports/libxml2/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "libxml2",
"version-semver": "2.9.10",
"port-version": 6,
"port-version": 7,
"description": "Libxml2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform).",
"homepage": "https://xmlsoft.org/",
"dependencies": [
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3666,7 +3666,7 @@
},
"libxml2": {
"baseline": "2.9.10",
"port-version": 6
"port-version": 7
},
"libxmlmm": {
"baseline": "0.6.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/libxml2.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "f86ba7081b940af77e935875fbdf9cbf69446b9f",
"version-semver": "2.9.10",
"port-version": 7
},
{
"git-tree": "306378bea94b3a4b3c5992510b992b3690b87f52",
"version-semver": "2.9.10",
Expand Down

0 comments on commit 5554e3f

Please sign in to comment.