golang: Update to 1.19.5
[feed/packages.git] / net / clamav / patches / 020-iconv.patch
1 --- a/CMakeLists.txt
2 +++ b/CMakeLists.txt
3 @@ -448,7 +448,7 @@ endif()
4
5 # libclamav feature dependencies
6 if(NOT WIN32)
7 - find_package(Iconv REQUIRED)
8 + find_package(Iconv)
9 # Set variable required by libclamav to use iconv
10 set(HAVE_ICONV 1)
11 endif()
12 --- a/libclamav/CMakeLists.txt
13 +++ b/libclamav/CMakeLists.txt
14 @@ -536,10 +536,39 @@ if(ENABLE_SHARED_LIB)
15 ClamAV::win32_compat
16 wsock32 ws2_32 )
17 else()
18 + if(Iconv_FOUND)
19 + if(NOT Iconv_IS_BUILT_IN)
20 + target_link_libraries(clamav PRIVATE Iconv::Iconv)
21 + set(CMAKE_REQUIRED_LIBRARIES "Iconv::Iconv")
22 + endif()
23 + else()
24 + # Sometime the build environment is not setup
25 + # in a way CMake can find Iconv on its own by default.
26 + # But if we simply link against iconv (-liconv), the build may succeed
27 + # due to other compiler/link flags.
28 + set(CMAKE_REQUIRED_LIBRARIES "iconv")
29 + check_c_source_compiles("
30 + #include <stddef.h>
31 + #include <iconv.h>
32 + int main() {
33 + char *a, *b;
34 + size_t i, j;
35 + iconv_t ic;
36 + ic = iconv_open(\"to\", \"from\");
37 + iconv(ic, &a, &i, &b, &j);
38 + iconv_close(ic);
39 + }
40 + "
41 + Iconv_EXPLICITLY_AT_ENV)
42 + if(Iconv_EXPLICITLY_AT_ENV)
43 + target_link_libraries(clamav PRIVATE iconv)
44 + else()
45 + message(FATAL_ERROR "Iconv is not found, make sure to provide it in the build environment")
46 + endif()
47 + endif()
48 target_link_libraries( clamav
49 PUBLIC
50 Threads::Threads
51 - Iconv::Iconv
52 ${CMAKE_DL_LIBS}
53 m )
54 endif()
55 @@ -556,8 +585,6 @@ if(ENABLE_SHARED_LIB)
56
57 if(WIN32)
58 set_target_properties( clamav PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON )
59 - else()
60 - target_link_libraries( clamav PUBLIC Iconv::Iconv )
61 endif()
62 if(WIN32)
63 install( TARGETS clamav DESTINATION . COMPONENT libraries )