diff --git a/ports/libiconv/0002-Config-for-MSVC.patch b/ports/libiconv/0002-Config-for-MSVC.patch index 8ce2f683f62..0c90e50ef1c 100644 --- a/ports/libiconv/0002-Config-for-MSVC.patch +++ b/ports/libiconv/0002-Config-for-MSVC.patch @@ -1,57 +1,3 @@ -diff --git "a/config.h.in" "b/config.h.in" -index 207e487..56501ed 100644 ---- "a/config.h.in" -+++ "b/config.h.in" -@@ -27,7 +27,7 @@ - #undef DOUBLE_SLASH_IS_DISTINCT_ROOT - - /* Define as good substitute value for EILSEQ. */ --#undef EILSEQ -+//#undef EILSEQ - - /* Define to 1 to enable a few rarely used encodings. */ - #undef ENABLE_EXTRA -@@ -207,10 +207,10 @@ - #undef HAVE_MACH_O_DYLD_H - - /* Define to 1 if you have the `mbrtowc' function. */ --#undef HAVE_MBRTOWC -+#define HAVE_MBRTOWC 1 - - /* Define to 1 if you have the `mbsinit' function. */ --#undef HAVE_MBSINIT -+#define HAVE_MBSINIT 1 - - /* Define to 1 if declares mbstate_t. */ - #undef HAVE_MBSTATE_T -@@ -665,7 +665,7 @@ - #undef HAVE_WCHAR_T - - /* Define to 1 if you have the `wcrtomb' function. */ --#undef HAVE_WCRTOMB -+#define HAVE_WCRTOMB 1 - - /* Define to 1 if you have the header file. */ - #undef HAVE_WINSOCK2_H -@@ -683,7 +683,7 @@ - #undef HAVE__NSGETEXECUTABLEPATH - - /* Define as const if the declaration of iconv() needs const. */ --#undef ICONV_CONST -+#define ICONV_CONST const - - /* Define to the value of ${prefix}, as a string. */ - #undef INSTALLPREFIX -@@ -787,7 +787,7 @@ - #undef WINT_T_SUFFIX - - /* Define if the machine's byte ordering is little endian. */ --#undef WORDS_LITTLEENDIAN -+#define WORDS_LITTLEENDIAN 1 - - /* Define to 1 if on MINIX. */ - #undef _MINIX - diff --git "a/lib/loop_wchar.h" "b/lib/loop_wchar.h" index 6dc011b..158ccdd 100644 --- "a/lib/loop_wchar.h" diff --git a/ports/libiconv/CMakeLists.txt b/ports/libiconv/CMakeLists.txt index 0d2a2a4d332..be42843e33e 100644 --- a/ports/libiconv/CMakeLists.txt +++ b/ports/libiconv/CMakeLists.txt @@ -1,20 +1,5 @@ -## -## CMake support for libiconv -## based on the work here: https://github.com/vovythevov/libiconv-cmake -## - cmake_minimum_required(VERSION 3.0.0) -project(Libiconv) - -# -# Options -# - -# Config file -configure_file( - ${Libiconv_SOURCE_DIR}/config.h.in - ${Libiconv_BINARY_DIR}/config.h -) +project(libiconv C) if(BUILD_SHARED_LIBS) set(LIBICONV_DYNAMIC "1 /*LIBICONV_DYNAMIC*/") @@ -26,59 +11,37 @@ set(USE_MBSTATE_T "0 /*USE_MBSTATE_T*/") set(BROKEN_WCHAR_H "0 /*BROKEN_WCHAR_H*/") set(HAVE_VISIBILITY "0 /*HAVE_VISIBILITY*/") -include_directories(${Libiconv_SOURCE_DIR} ${Libiconv_BINARY_DIR}) +configure_file(config.h.in config.h) +file(READ "${CMAKE_CURRENT_BINARY_DIR}/config.h" _contents) +string(REPLACE "#undef HAVE_WORKING_O_NOFOLLOW" "#define HAVE_WORKING_O_NOFOLLOW 0" _contents "${_contents}") +string(REPLACE "#undef HAVE_MBRTOWC" "#define HAVE_MBRTOWC 1" _contents "${_contents}") +string(REPLACE "#undef HAVE_MBSINIT" "#define HAVE_MBSINIT 1" _contents "${_contents}") +string(REPLACE "#undef HAVE_WCRTOMB" "#define HAVE_WCRTOMB 1" _contents "${_contents}") +string(REPLACE "#undef ICONV_CONST" "#define ICONV_CONST const" _contents "${_contents}") +string(REPLACE "#undef EILSEQ" "" _contents "${_contents}") +string(REPLACE "#undef WORDS_LITTLEENDIAN" "#define WORDS_LITTLEENDIAN 1" _contents "${_contents}") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/config.h" "${_contents}") -# -# Build libcharset -# -set(libname libcharset) -set(libcharset_source_dir ${Libiconv_SOURCE_DIR}/libcharset) +configure_file(libcharset/include/localcharset.h.build.in localcharset.h) +configure_file(include/iconv.h.build.in iconv.h) -add_definitions(-DLIBDIR) - -configure_file( - ${Libiconv_SOURCE_DIR}/libcharset/include/localcharset.h.build.in - ${Libiconv_BINARY_DIR}/localcharset.h -) +include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) -set(${libname}_sources - ${libcharset_source_dir}/lib/localcharset.c - ${Libiconv_BINARY_DIR}/localcharset.h -) +add_definitions(-DLIBDIR -D_CRT_SECURE_NO_WARNINGS) -add_library(${libname} ${${libname}_sources}) -list(APPEND Libiconv_TARGETS ${libname}) -list(APPEND Libiconv_headers ${Libiconv_BINARY_DIR}/localcharset.h) +add_library(libcharset libcharset/lib/localcharset.c) -# -# Build libiconv -# -set(libname libiconv) +add_library(libiconv lib/iconv.c) +target_link_libraries(libiconv libcharset) -add_definitions(-D_CRT_SECURE_NO_WARNINGS) - -configure_file( - ${Libiconv_SOURCE_DIR}/include/iconv.h.build.in - ${Libiconv_BINARY_DIR}/iconv.h - ) - -set(${libname}_sources - ${Libiconv_SOURCE_DIR}/lib/iconv.c - ${Libiconv_BINARY_DIR}/iconv.h -) - -add_library(${libname} ${${libname}_sources}) -target_link_libraries(${libname} libcharset) -list(APPEND Libiconv_TARGETS ${libname}) -list(APPEND Libiconv_headers ${Libiconv_BINARY_DIR}/iconv.h) - -# -# Export targets -# -install(TARGETS ${Libiconv_TARGETS} +install(TARGETS libcharset libiconv RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) -install(FILES ${Libiconv_headers} DESTINATION include) +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/iconv.h + ${CMAKE_CURRENT_BINARY_DIR}/localcharset.h + DESTINATION include +) diff --git a/ports/libiconv/CONTROL b/ports/libiconv/CONTROL index 851c8dd0101..98076398038 100644 --- a/ports/libiconv/CONTROL +++ b/ports/libiconv/CONTROL @@ -1,3 +1,3 @@ Source: libiconv -Version: 1.14-1 +Version: 1.15 Description: GNU Unicode text conversion diff --git a/ports/libiconv/portfile.cmake b/ports/libiconv/portfile.cmake index 46bd2f9e90e..a79d7c074ff 100644 --- a/ports/libiconv/portfile.cmake +++ b/ports/libiconv/portfile.cmake @@ -1,9 +1,9 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libiconv-1.14) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libiconv-1.15) vcpkg_download_distfile(ARCHIVE - URLS "https://ftp.gnu.org/gnu/libiconv/libiconv-1.14.tar.gz" - FILENAME "libiconv-1.14.tar.gz" - SHA512 b96774fefc4fa1d07948fcc667027701373c34ebf9c4101000428e048addd85a5bb5e05e59f80eb783a3054a3a8a3c0da909450053275bbbf3ffde511eb3f387 + URLS "https://ftp.gnu.org/gnu/libiconv/libiconv-1.15.tar.gz" + FILENAME "libiconv-1.15.tar.gz" + SHA512 1233fe3ca09341b53354fd4bfe342a7589181145a1232c9919583a8c9979636855839049f3406f253a9d9829908816bb71fd6d34dd544ba290d6f04251376b1a ) vcpkg_extract_source_archive(${ARCHIVE}) @@ -19,6 +19,7 @@ vcpkg_apply_patches( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA ) vcpkg_install_cmake()