aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHleb Valoshka <375gnu@gmail.com>2020-01-07 01:42:52 +0300
committerdan-shaw <51385773+dan-shaw@users.noreply.github.com>2020-01-06 14:42:52 -0800
commit9d706789ce1bea0b89425fc66e24807160e1b806 (patch)
tree7cc46830a0c49563afc9257b01a5919d991249a3
parent2c7ff757a10a1d63e5fd6e295430f00bd67b902c (diff)
downloadvcpkg-9d706789ce1bea0b89425fc66e24807160e1b806.tar.gz
vcpkg-9d706789ce1bea0b89425fc66e24807160e1b806.zip
[libiconv] Make built libraries relocatable (#9229)
This is required to build libintl (gettext) with iconv support (see #8484). Also updated to the latest version 1.16.
-rw-r--r--ports/libiconv/0001-Add-export-definitions.patch34
-rw-r--r--ports/libiconv/0003-Add-export.patch12
-rw-r--r--ports/libiconv/CMakeLists.txt37
-rw-r--r--ports/libiconv/CONTROL2
-rw-r--r--ports/libiconv/portfile.cmake11
5 files changed, 49 insertions, 47 deletions
diff --git a/ports/libiconv/0001-Add-export-definitions.patch b/ports/libiconv/0001-Add-export-definitions.patch
deleted file mode 100644
index c59d15d9e..000000000
--- a/ports/libiconv/0001-Add-export-definitions.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-diff --git "a/include/iconv.h.build.in" "b/include/iconv.h.build.in"
-index 0feb068..74e5613 100644
---- "a/include/iconv.h.build.in"
-+++ "b/include/iconv.h.build.in"
-@@ -27,6 +27,12 @@
- #define LIBICONV_DLL_EXPORTED __attribute__((__visibility__("default")))
-+#elif defined(_WIN32) && @LIBICONV_DYNAMIC@
-+ #if defined(libiconv_EXPORTS)
-+ #define LIBICONV_DLL_EXPORTED __declspec(dllexport)
-+ #else
-+ #define LIBICONV_DLL_EXPORTED __declspec(dllimport)
-+ #endif
- #else
- #define LIBICONV_DLL_EXPORTED
- #endif
- extern LIBICONV_DLL_EXPORTED @DLL_VARIABLE@ int _libiconv_version; /* Likewise */
-
-diff --git "a/libcharset/include/localcharset.h.build.in" "b/libcharset/include/localcharset.h.build.in"
-index c691359..2a23585 100644
---- "a/libcharset/include/localcharset.h.build.in"
-+++ "b/libcharset/include/localcharset.h.build.in"
-@@ -24,6 +24,12 @@
- #define LIBCHARSET_DLL_EXPORTED __attribute__((__visibility__("default")))
-+#elif defined(_WIN32) && @LIBICONV_DYNAMIC@
-+ #if defined(libcharset_EXPORTS)
-+ #define LIBCHARSET_DLL_EXPORTED __declspec(dllexport)
-+ #else
-+ #define LIBCHARSET_DLL_EXPORTED __declspec(dllimport)
-+ #endif
- #else
- #define LIBCHARSET_DLL_EXPORTED
- #endif
-
-
diff --git a/ports/libiconv/0003-Add-export.patch b/ports/libiconv/0003-Add-export.patch
new file mode 100644
index 000000000..c8d131d2e
--- /dev/null
+++ b/ports/libiconv/0003-Add-export.patch
@@ -0,0 +1,12 @@
+diff -uNr libiconv-1.16/libcharset/include/libcharset.h.in libiconv-1.16-work/libcharset/include/libcharset.h.in
+--- libiconv-1.16/libcharset/include/libcharset.h.in 2018-09-17 19:07:42.000000000 +0300
++++ libiconv-1.16-work/libcharset/include/libcharset.h.in 2019-12-04 17:15:50.000000000 +0300
+@@ -33,7 +33,7 @@
+ by the corresponding pathname with the current prefix instead. Both
+ prefixes should be directory names without trailing slash (i.e. use ""
+ instead of "/"). */
+-extern void libcharset_set_relocation_prefix (const char *orig_prefix,
++extern void LIBCHARSET_DLL_EXPORTED libcharset_set_relocation_prefix (const char *orig_prefix,
+ const char *curr_prefix);
+
+
diff --git a/ports/libiconv/CMakeLists.txt b/ports/libiconv/CMakeLists.txt
index 3c2a6125c..489b4750d 100644
--- a/ports/libiconv/CMakeLists.txt
+++ b/ports/libiconv/CMakeLists.txt
@@ -25,10 +25,31 @@ if(WIN32)
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}")
+ string(REPLACE "#undef ENABLE_RELOCATABLE" "#define ENABLE_RELOCATABLE 1" _contents "${_contents}")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/config.h" "${_contents}")
configure_file(libcharset/include/localcharset.h.build.in localcharset.h)
+ configure_file(libcharset/include/libcharset.h.in libcharset.h)
configure_file(include/iconv.h.build.in iconv.h)
+
+ if(MSVC)
+ add_compile_options(/wd4018)
+ endif()
+
+ add_definitions(
+ -D_CRT_SECURE_NO_WARNINGS
+ -DLIBDIR=${LIBDIR}
+ -DINSTALLDIR=${INSTALLDIR}
+ -DNO_XMALLOC=1
+ -DENABLE_RELOCATABLE=1
+ -DIN_LIBRARY=1
+ )
+ if(BUILD_SHARED_LIBS)
+ add_definitions(
+ -DBUILDING_LIBCHARSET=1
+ -DBUILDING_LIBICONV=1
+ -DBUILDING_DLL=1)
+ endif()
else()
if(BUILD_SHARED_LIBS)
set(STATIC_SHARED --enable-shared --disable-static)
@@ -43,19 +64,23 @@ else()
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/autoconf
)
- configure_file(${CMAKE_CURRENT_BINARY_DIR}/autoconf/config.h config.h @ONLY)
+ configure_file(${CMAKE_CURRENT_BINARY_DIR}/autoconf/lib/config.h config.h @ONLY)
configure_file(${CMAKE_CURRENT_BINARY_DIR}/autoconf/include/iconv.h iconv.h @ONLY)
configure_file(${CMAKE_CURRENT_BINARY_DIR}/autoconf/libcharset/include/localcharset.h localcharset.h @ONLY)
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
-add_definitions(-DLIBDIR -D_CRT_SECURE_NO_WARNINGS)
-
-add_library(libcharset libcharset/lib/localcharset.c)
+add_library(libcharset libcharset/lib/localcharset.c libcharset/lib/relocatable-stub.c)
target_include_directories(libcharset PUBLIC $<INSTALL_INTERFACE:include>)
-add_library(libiconv lib/iconv.c)
+add_library(libiconv lib/iconv.c lib/relocatable.c)
+if(WIN32)
+ target_compile_definitions(libiconv PRIVATE
+ -Dset_relocation_prefix=libiconv_set_relocation_prefix
+ -Drelocate=libiconv_relocate -Drelocate2=libiconv_relocate2
+ )
+endif()
target_link_libraries(libiconv PRIVATE libcharset)
target_include_directories(libiconv PUBLIC $<INSTALL_INTERFACE:include>)
@@ -78,4 +103,4 @@ install(
FILE unofficial-iconv-config.cmake
NAMESPACE unofficial::iconv::
DESTINATION share/unofficial-iconv
-) \ No newline at end of file
+)
diff --git a/ports/libiconv/CONTROL b/ports/libiconv/CONTROL
index 48688767a..33bb805d8 100644
--- a/ports/libiconv/CONTROL
+++ b/ports/libiconv/CONTROL
@@ -1,4 +1,4 @@
Source: libiconv
-Version: 1.15-6
+Version: 1.16-1
Homepage: https://www.gnu.org/software/libiconv/
Description: GNU Unicode text conversion
diff --git a/ports/libiconv/portfile.cmake b/ports/libiconv/portfile.cmake
index 488cc3b2f..9027e2acf 100644
--- a/ports/libiconv/portfile.cmake
+++ b/ports/libiconv/portfile.cmake
@@ -1,26 +1,24 @@
-if(VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+if(NOT VCPKG_TARGET_IS_WINDOWS)
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/unofficial-iconv)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/unofficial-iconv-config.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/unofficial-iconv)
return()
endif()
-include(vcpkg_common_functions)
-
-set(LIBICONV_VERSION 1.15)
+set(LIBICONV_VERSION 1.16)
vcpkg_download_distfile(ARCHIVE
URLS "https://ftp.gnu.org/gnu/libiconv/libiconv-${LIBICONV_VERSION}.tar.gz" "https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/libiconv/libiconv-${LIBICONV_VERSION}.tar.gz"
FILENAME "libiconv-${LIBICONV_VERSION}.tar.gz"
- SHA512 1233fe3ca09341b53354fd4bfe342a7589181145a1232c9919583a8c9979636855839049f3406f253a9d9829908816bb71fd6d34dd544ba290d6f04251376b1a
+ SHA512 365dac0b34b4255a0066e8033a8b3db4bdb94b9b57a9dca17ebf2d779139fe935caf51a465d17fd8ae229ec4b926f3f7025264f37243432075e5583925bb77b7
)
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
REF ${LIBICONV_VERSION}
PATCHES
- 0001-Add-export-definitions.patch
0002-Config-for-MSVC.patch
+ 0003-Add-export.patch
)
#Since libiconv uses automake, make and configure, we use a custom CMake file
@@ -29,6 +27,7 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
+ OPTIONS -DINSTALLDIR=\"\" -DLIBDIR=\"\"
OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON
)