[libidn2] Fixes for mingw and minor issues (#19002)

* Fix port's cmake buildsystem for mingw

* Install pc file for windows

* Modernize portfile

* Increment port-version

* x-add-version

* Use libunistring for non-windows

* CR and doc changes

* Update git-tree
This commit is contained in:
Kai Pastor 2021-07-26 20:02:24 +02:00 committed by GitHub
parent be01bbc3e1
commit b57e29a6ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 65 additions and 29 deletions

View File

@ -89,6 +89,12 @@ set(GL_SRC gl/rawmemchr.c
)
add_library(libidn2 ${LIB_SRC} ${UNISTR_SRC} ${GL_SRC})
set_target_properties(libidn2
PROPERTIES
OUTPUT_NAME idn2
PREFIX lib
IMPORT_PREFIX lib
)
target_include_directories(libidn2 PRIVATE . ./unistring ./gl)
target_link_libraries(libidn2 PRIVATE Iconv::Iconv)
@ -99,3 +105,13 @@ install(TARGETS libidn2
ARCHIVE DESTINATION lib)
install(FILES lib/idn2.h DESTINATION include)
# Install pc file
set(prefix "\${pcfiledir}/../..")
set(exec_prefix "\${prefix}")
set(includedir "\${prefix}/include")
set(libdir "\${prefix}/lib")
set(LTLIBICONV "")
set(LTLIBUNISTRING "")
configure_file("libidn2.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/libidn2.pc")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libidn2.pc" DESTINATION "lib/pkgconfig")

View File

@ -9,62 +9,64 @@ vcpkg_download_distfile(ARCHIVE
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
ARCHIVE "${ARCHIVE}"
REF ${IDN2_VERSION}
)
if (VCPKG_TARGET_IS_WINDOWS)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/string.h DESTINATION ${SOURCE_PATH}/gl)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
file(COPY "${CMAKE_CURRENT_LIST_DIR}/string.h" DESTINATION "${SOURCE_PATH}/gl")
configure_file(${CMAKE_CURRENT_LIST_DIR}/config.h ${SOURCE_PATH})
set(HAVE_ALLOCA_H 0)
configure_file("${CMAKE_CURRENT_LIST_DIR}/config.h" "${SOURCE_PATH}")
function(simple_copy_template_header FILE_PATH BASE_NAME)
if(NOT EXISTS ${FILE_PATH}/${BASE_NAME}.h)
if(EXISTS ${FILE_PATH}/${BASE_NAME}.in.h)
configure_file(${FILE_PATH}/${BASE_NAME}.in.h ${FILE_PATH}/${BASE_NAME}.h)
endif()
if(NOT EXISTS "${FILE_PATH}/${BASE_NAME}.h" AND EXISTS "${FILE_PATH}/${BASE_NAME}.in.h")
configure_file("${FILE_PATH}/${BASE_NAME}.in.h" "${FILE_PATH}/${BASE_NAME}.h")
endif()
endfunction()
# There seems to be no difference between source and destination files after 'configure'
# apart from auto-generated notification at the top. So why not just do a simple copy.
simple_copy_template_header(${SOURCE_PATH}/unistring uniconv)
simple_copy_template_header(${SOURCE_PATH}/unistring unictype)
simple_copy_template_header(${SOURCE_PATH}/unistring uninorm)
simple_copy_template_header(${SOURCE_PATH}/unistring unistr)
simple_copy_template_header(${SOURCE_PATH}/unistring unitypes)
simple_copy_template_header(${SOURCE_PATH}/unistring alloca)
simple_copy_template_header("${SOURCE_PATH}/unistring" uniconv)
simple_copy_template_header("${SOURCE_PATH}/unistring" unictype)
simple_copy_template_header("${SOURCE_PATH}/unistring" uninorm)
simple_copy_template_header("${SOURCE_PATH}/unistring" unistr)
simple_copy_template_header("${SOURCE_PATH}/unistring" unitypes)
simple_copy_template_header("${SOURCE_PATH}/unistring" alloca)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
"-DPACKAGE_VERSION=${IDN2_VERSION}"
)
vcpkg_install_cmake()
vcpkg_cmake_install()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
else()
set(ENV{GTKDOCIZE} true)
vcpkg_configure_make(
SOURCE_PATH ${SOURCE_PATH}
SOURCE_PATH "${SOURCE_PATH}"
AUTOCONFIG
COPY_SOURCE
OPTIONS
--with-libiconv-prefix=${CURRENT_INSTALLED_DIR}
"--with-libiconv-prefix=${CURRENT_INSTALLED_DIR}"
--disable-gtk-doc
--disable-doc
)
vcpkg_install_make()
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
endif()
vcpkg_fixup_pkgconfig()
# License and man
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libidn2 RENAME copyright)
file(INSTALL ${SOURCE_PATH}/doc/libidn2.pdf DESTINATION ${CURRENT_PACKAGES_DIR}/share/libidn2)
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/libidn2" RENAME copyright)
file(INSTALL "${SOURCE_PATH}/doc/libidn2.pdf" DESTINATION "${CURRENT_PACKAGES_DIR}/share/libidn2")

View File

@ -5,6 +5,10 @@ char * strchrnul (const char *s, int c_in);
int strverscmp (const char *s1, const char *s2);
void * rawmemchr (const void *s, int c_in);
#if defined(__MINGW32__)
#include <../include/string.h>
#elif defined(_WIN32)
#include <../ucrt/string.h>
#endif
#endif /* _GL_STRING_H */

View File

@ -1,10 +1,19 @@
{
"name": "libidn2",
"version": "2.3.0",
"port-version": 3,
"port-version": 4,
"description": "GNU Libidn is an implementation of the Stringprep, Punycode and IDNA 2003 specifications. Libidn's purpose is to encode and decode internationalized domain names.",
"homepage": "https://www.gnu.org/software/libidn/",
"dependencies": [
"libiconv"
"libiconv",
{
"name": "libunistring",
"platform": "!(windows | mingw)"
},
{
"name": "vcpkg-cmake",
"host": true,
"platform": "windows | mingw"
}
]
}

View File

@ -3270,7 +3270,7 @@
},
"libidn2": {
"baseline": "2.3.0",
"port-version": 3
"port-version": 4
},
"libigl": {
"baseline": "2.2.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "a73dca27190e239f6ff09db7124b885a23d732e4",
"version": "2.3.0",
"port-version": 4
},
{
"git-tree": "cad738e7d2fff6e1ac7c8a2bec14160aa127336f",
"version": "2.3.0",