Skip to content

Commit

Permalink
[libidn2] Support UNIX (microsoft#13708)
Browse files Browse the repository at this point in the history
* [libidn2] Support UNIX

* update baseline

* Add supports
  • Loading branch information
JackBoosY authored Sep 28, 2020
1 parent 7065866 commit 870d2cd
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 35 deletions.
2 changes: 1 addition & 1 deletion ports/getdns/CONTROL
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Version: 1.6.0
Build-Depends: libidn2, openssl
Description: GetDNS is a modern asynchronous DNS API
Homepage: https://getdnsapi.net/
Supports: !uwp
Supports: !uwp&windows

Feature: libevent
Description: libevent event loop integration
Expand Down
1 change: 1 addition & 0 deletions ports/gmime/CONTROL
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ Version: 3.2.6
Build-Depends: zlib, glib, libiconv, libidn2
Homepage: https://developer.gnome.org/gmime/
Description: GMime is a C/C++ library which may be used for the creation and parsing of messages using the Multipurpose Internet Mail Extension (MIME).
Supports: windows
3 changes: 2 additions & 1 deletion ports/libidn2/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Source: libidn2
Version: 2.2.0-1
Version: 2.2.0
Port-Version: 2
Build-Depends: libiconv
Homepage: https://www.gnu.org/software/libidn/
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.
78 changes: 47 additions & 31 deletions ports/libidn2/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,55 @@ vcpkg_extract_source_archive_ex(
REF ${IDN2_VERSION}
)

file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/string.h DESTINATION ${SOURCE_PATH}/gl)
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)

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()
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)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
)

vcpkg_install_cmake()

vcpkg_copy_pdbs()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)

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()
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)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
)

vcpkg_install_cmake()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
else()
vcpkg_configure_make(
SOURCE_PATH ${SOURCE_PATH}
COPY_SOURCE
OPTIONS
--with-libiconv-prefix=${CURRENT_INSTALLED_DIR}
)

vcpkg_install_make()

vcpkg_fixup_pkgconfig()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
endif()

# 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)

vcpkg_copy_pdbs()
2 changes: 0 additions & 2 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 +708,6 @@ libhdfs3:x64-linux=fail
libhydrogen:arm64-windows=fail
libics:arm-uwp=fail
libics:x64-uwp=fail
libidn2:x64-linux=fail
libidn2:x64-osx=fail
libigl:arm64-windows=fail
libigl:arm-uwp=fail
libigl:x64-uwp=fail
Expand Down

0 comments on commit 870d2cd

Please sign in to comment.