vcpkg/ports/libidn2/portfile.cmake
Kai Pastor 250d7a0827
[libidn2] Update, control nls/gettext, fix copyright (#27680)
* [gmime] Use pkg-config for libidn2

* Update, drop CMake, control nls/gettext, copyright

* Update versions

* Feature nls everywhere
2022-11-09 12:14:28 -08:00

79 lines
2.3 KiB
CMake

vcpkg_minimum_required(VERSION 2022-10-12) # for ${VERSION}
set(IDN2_FILENAME "libidn2-${VERSION}.tar.gz")
vcpkg_download_distfile(ARCHIVE
URLS "https://ftp.gnu.org/gnu/libidn/${IDN2_FILENAME}" "https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/libidn/${IDN2_FILENAME}"
FILENAME "${IDN2_FILENAME}"
SHA512 a6e90ccef56cfd0b37e3333ab3594bb3cec7ca42a138ca8c4f4ce142da208fa792f6c78ca00c01001c2bc02831abcbaf1cf9bcc346a5290fd7b30708f5a462f3
)
vcpkg_extract_source_archive(SOURCE_PATH
ARCHIVE "${ARCHIVE}"
SOURCE_BASE "v${VERSION}"
PATCHES
disable-subdirs.patch
fix-msvc.patch
fix-uwp.patch
)
vcpkg_list(SET options)
if("nls" IN_LIST FEATURES)
vcpkg_list(APPEND options "--enable-nls")
else()
set(ENV{AUTOPOINT} true) # true, the program
vcpkg_list(APPEND options "--disable-nls")
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_list(APPEND options "CPPFLAGS=\$CPPFLAGS -DIDN2_STATIC")
endif()
vcpkg_list(SET options_release)
vcpkg_list(SET options_debug)
if(NOT VCPKG_TARGET_IS_UWP)
vcpkg_list(APPEND options_release "--with-libunistring-prefix=${CURRENT_INSTALLED_DIR}")
vcpkg_list(APPEND options_debug "--with-libunistring-prefix=${CURRENT_INSTALLED_DIR}/debug")
endif()
set(ENV{GTKDOCIZE} true)
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
AUTOCONFIG
COPY_SOURCE # include dir order problem
USE_WRAPPERS
OPTIONS
${options}
--disable-gtk-doc
--disable-doc
--disable-gcc-warnings
OPTIONS_RELEASE
${options_release}
"--with-libiconv-prefix=${CURRENT_INSTALLED_DIR}"
OPTIONS_DEBUG
${options_debug}
"--with-libiconv-prefix=${CURRENT_INSTALLED_DIR}/debug"
"CFLAGS=\$CFLAGS -I${CURRENT_INSTALLED_DIR}/include"
)
vcpkg_install_make()
vcpkg_fixup_pkgconfig()
vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/idn2.h" "defined IDN2_STATIC" "1")
endif()
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/share"
"${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug"
)
vcpkg_install_copyright(
FILE_LIST
"${SOURCE_PATH}/COPYING"
"${SOURCE_PATH}/COPYING.LESSERv3"
"${SOURCE_PATH}/COPYINGv2"
"${SOURCE_PATH}/COPYING.unicode"
)