mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-26 17:41:09 +08:00
[clamav] Add new port (#14658)
* Added ClamAV port * Patch ClamAV's cmake files instead of doing things in portfile * Fix whitespace * Strip down package to really only build libclamav * Fix static build * Fix build on Linux * Remove libcurl linkage * fix copy-paste mistake * Disable static build * update version record Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
This commit is contained in:
parent
170e44d327
commit
7adc87efe1
6
ports/clamav/CONTROL
Normal file
6
ports/clamav/CONTROL
Normal file
@ -0,0 +1,6 @@
|
||||
Source: clamav
|
||||
Version: 0.103.0
|
||||
Homepage: https://www.clamav.net
|
||||
Description: ClamAV is an open-source anti-virus toolkit.
|
||||
Build-Depends: openssl, json-c, libxml2, pcre2, pthreads, zlib, bzip2
|
||||
Supports: !uwp & !static
|
26
ports/clamav/build.patch
Normal file
26
ports/clamav/build.patch
Normal file
@ -0,0 +1,26 @@
|
||||
diff --git a/cmake/FindCURSES.cmake b/cmake/FindCURSES.cmake
|
||||
index a0755c697..f60735a91 100644
|
||||
--- a/cmake/FindCURSES.cmake
|
||||
+++ b/cmake/FindCURSES.cmake
|
||||
@@ -107,7 +107,7 @@ else()
|
||||
set(CURSES_INCLUDE "<curses.h>")
|
||||
|
||||
find_library(CURSES_LIBRARY
|
||||
- NAMES curses
|
||||
+ NAMES curses pdcurses
|
||||
PATHS ${PC_PDCurses_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
diff --git a/cmake/FindPthreadW32.cmake b/cmake/FindPthreadW32.cmake
|
||||
index 4fded1eb7..0d44af310 100644
|
||||
--- a/cmake/FindPthreadW32.cmake
|
||||
+++ b/cmake/FindPthreadW32.cmake
|
||||
@@ -54,7 +54,7 @@ find_path(PThreadW32_INCLUDE_DIR
|
||||
PATH_SUFFIXES pthreadw32
|
||||
)
|
||||
find_library(PThreadW32_LIBRARY
|
||||
- NAMES pthreadVC2
|
||||
+ NAMES pthreadVC2 pthreadVC3
|
||||
PATHS ${PC_PThreadW32_LIBRARY_DIRS}
|
||||
)
|
||||
|
136
ports/clamav/cmakefiles.patch
Normal file
136
ports/clamav/cmakefiles.patch
Normal file
@ -0,0 +1,136 @@
|
||||
diff --git a/freshclam/CMakeLists.txt b/freshclam/CMakeLists.txt
|
||||
index 545d5d4ba..59cbbc4ce 100644
|
||||
--- a/freshclam/CMakeLists.txt
|
||||
+++ b/freshclam/CMakeLists.txt
|
||||
@@ -28,18 +28,8 @@ target_link_libraries(freshclam-bin
|
||||
ClamAV::libfreshclam
|
||||
ClamAV::libclamav
|
||||
ClamAV::shared )
|
||||
-if(WIN32)
|
||||
- install(TARGETS freshclam-bin DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
-else()
|
||||
- install(TARGETS freshclam-bin DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
-endif()
|
||||
|
||||
-# Install an empty database directory
|
||||
-if(WIN32)
|
||||
- INSTALL(CODE "FILE(MAKE_DIRECTORY \${ENV}\${CMAKE_INSTALL_PREFIX}/database)")
|
||||
-else()
|
||||
- INSTALL(CODE "FILE(MAKE_DIRECTORY \${ENV}\${CMAKE_INSTALL_PREFIX}/share/clamav)")
|
||||
-endif()
|
||||
+install(TARGETS freshclam-bin)
|
||||
|
||||
# now we rename resman-bin executable to resman using target properties
|
||||
set_target_properties( freshclam-bin
|
||||
diff --git a/libclamav/CMakeLists.txt b/libclamav/CMakeLists.txt
|
||||
index bb14510db..136ea308a 100644
|
||||
--- a/libclamav/CMakeLists.txt
|
||||
+++ b/libclamav/CMakeLists.txt
|
||||
@@ -564,11 +564,7 @@ if(ENABLE_SHARED_LIB)
|
||||
else()
|
||||
target_link_libraries( clamav PUBLIC Iconv::Iconv )
|
||||
endif()
|
||||
- if(WIN32)
|
||||
- install(TARGETS clamav DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
- else()
|
||||
- install(TARGETS clamav DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
- endif()
|
||||
+ install(TARGETS clamav)
|
||||
|
||||
if(LLVM_FOUND)
|
||||
target_link_directories( clamav PRIVATE ${LLVM_LIBRARY_DIRS} )
|
||||
@@ -609,11 +605,7 @@ if(ENABLE_STATIC_LIB)
|
||||
COMPILE_FLAGS "${WARNCFLAGS}"
|
||||
VERSION ${LIBCLAMAV_VERSION} SOVERSION ${LIBCLAMAV_SOVERSION})
|
||||
target_compile_definitions(clamav_static PUBLIC clamav_staticLIB)
|
||||
- if(WIN32)
|
||||
- install(TARGETS clamav_static DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
- else()
|
||||
- install(TARGETS clamav_static DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
- endif()
|
||||
+ install(TARGETS clamav_static)
|
||||
|
||||
add_library( ClamAV::libclamav_static ALIAS clamav_static )
|
||||
endif()
|
||||
diff --git a/libclammspack/CMakeLists.txt b/libclammspack/CMakeLists.txt
|
||||
index 1b5edbd4d..bba781d76 100644
|
||||
--- a/libclammspack/CMakeLists.txt
|
||||
+++ b/libclammspack/CMakeLists.txt
|
||||
@@ -73,11 +73,7 @@ endif()
|
||||
target_sources( mspack
|
||||
PUBLIC
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/mspack/mspack.h" )
|
||||
-if(WIN32)
|
||||
- install(TARGETS mspack DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
-else()
|
||||
- install(TARGETS mspack DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
-endif()
|
||||
+install(TARGETS mspack)
|
||||
|
||||
# Public (forwarded) dependencies.
|
||||
target_link_libraries( mspack
|
||||
diff --git a/libclamunrar/CMakeLists.txt b/libclamunrar/CMakeLists.txt
|
||||
index 03dbc3387..267690b1c 100644
|
||||
--- a/libclamunrar/CMakeLists.txt
|
||||
+++ b/libclamunrar/CMakeLists.txt
|
||||
@@ -90,10 +90,6 @@ target_link_libraries( clamunrar
|
||||
PUBLIC
|
||||
unrar_obj )
|
||||
|
||||
-if(WIN32)
|
||||
- install(TARGETS clamunrar DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
-else()
|
||||
- install(TARGETS clamunrar DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
-endif()
|
||||
+install(TARGETS clamunrar)
|
||||
|
||||
add_library( ClamAV::libclamunrar ALIAS clamunrar )
|
||||
diff --git a/libclamunrar_iface/CMakeLists.txt b/libclamunrar_iface/CMakeLists.txt
|
||||
index 42f81544d..61f21da33 100644
|
||||
--- a/libclamunrar_iface/CMakeLists.txt
|
||||
+++ b/libclamunrar_iface/CMakeLists.txt
|
||||
@@ -55,11 +55,7 @@ if(ENABLE_UNRAR)
|
||||
PUBLIC
|
||||
ClamAV::libclamunrar_iface_iface)
|
||||
|
||||
- if(WIN32)
|
||||
- install(TARGETS clamunrar_iface DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
- else()
|
||||
- install(TARGETS clamunrar_iface DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
- endif()
|
||||
+ install(TARGETS clamunrar_iface)
|
||||
|
||||
add_library( ClamAV::libclamunrar_iface ALIAS clamunrar_iface )
|
||||
-endif()
|
||||
\ No newline at end of file
|
||||
+endif()
|
||||
diff --git a/libfreshclam/CMakeLists.txt b/libfreshclam/CMakeLists.txt
|
||||
index 6fb711818..27321ceb4 100644
|
||||
--- a/libfreshclam/CMakeLists.txt
|
||||
+++ b/libfreshclam/CMakeLists.txt
|
||||
@@ -65,11 +65,7 @@ if(ENABLE_SHARED_LIB)
|
||||
set_target_properties(freshclam PROPERTIES
|
||||
COMPILE_FLAGS "${WARNCFLAGS}"
|
||||
VERSION ${LIBFRESHCLAM_VERSION} SOVERSION ${LIBFRESHCLAM_SOVERSION})
|
||||
- if(WIN32)
|
||||
- install(TARGETS freshclam DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
- else()
|
||||
- install(TARGETS freshclam DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
- endif()
|
||||
+ install(TARGETS freshclam)
|
||||
|
||||
add_library( ClamAV::libfreshclam ALIAS freshclam )
|
||||
endif()
|
||||
@@ -88,11 +84,7 @@ if(ENABLE_STATIC_LIB)
|
||||
COMPILE_FLAGS "${WARNCFLAGS}"
|
||||
VERSION ${LIBFRESHCLAM_VERSION} SOVERSION ${LIBFRESHCLAM_SOVERSION})
|
||||
target_compile_definitions(freshclam_static PUBLIC freshclam_staticLIB)
|
||||
- if(WIN32)
|
||||
- install(TARGETS freshclam_static DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
- else()
|
||||
- install(TARGETS freshclam_static DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
- endif()
|
||||
+ install(TARGETS freshclam_static)
|
||||
|
||||
add_library( ClamAV::libfreshclam_static ALIAS freshclam_static )
|
||||
endif()
|
38
ports/clamav/curl.patch
Normal file
38
ports/clamav/curl.patch
Normal file
@ -0,0 +1,38 @@
|
||||
commit 59516af244a840aa95a8f15f978ac24ec97178cf
|
||||
Author: jzaddach <jzaddach@cisco.com>
|
||||
Date: Fri Nov 27 14:24:31 2020 +0100
|
||||
|
||||
Fix curl usage
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index e85d03e20..9f1cd42c5 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -685,7 +685,7 @@ endif()
|
||||
|
||||
add_subdirectory( libclamav )
|
||||
|
||||
-if(NOT LIBCLAMAV_ONLY)
|
||||
+if(NOT ENABLE_LIBCLAMAV_ONLY)
|
||||
add_subdirectory( shared )
|
||||
|
||||
add_subdirectory( libfreshclam )
|
||||
diff --git a/shared/CMakeLists.txt b/shared/CMakeLists.txt
|
||||
index d9c8b6bfe..30df5a1a4 100644
|
||||
--- a/shared/CMakeLists.txt
|
||||
+++ b/shared/CMakeLists.txt
|
||||
@@ -59,9 +59,13 @@ target_link_libraries( shared_obj
|
||||
PUBLIC
|
||||
ClamAV::libclamav
|
||||
ZLIB::ZLIB
|
||||
- CURL::libcurl
|
||||
OpenSSL::SSL
|
||||
OpenSSL::Crypto )
|
||||
+if(CURL_FOUND)
|
||||
+ target_link_libraries( shared_obj
|
||||
+ PUBLIC
|
||||
+ CURL::libcurl )
|
||||
+endif()
|
||||
if(WIN32)
|
||||
target_link_libraries( shared_obj
|
||||
PUBLIC
|
38
ports/clamav/portfile.cmake
Normal file
38
ports/clamav/portfile.cmake
Normal file
@ -0,0 +1,38 @@
|
||||
vcpkg_fail_port_install(ON_TARGET "uwp")
|
||||
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO Cisco-Talos/clamav-devel
|
||||
REF clamav-0.103.0
|
||||
SHA512 488381202bdcea812c39d611e0a31eaf8f55c9c5d0a6400fd53dfa0da674a95672fdc9b290dc6157cb8f628d9f81846b5cc108eb1e44f6207d3c6f2659ba63c6
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
"build.patch"
|
||||
"cmakefiles.patch"
|
||||
"curl.patch"
|
||||
)
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
OPTIONS
|
||||
-DENABLE_LIBCLAMAV_ONLY=ON
|
||||
-DENABLE_DOCS=OFF
|
||||
-DENABLE_SHARED_LIB=ON
|
||||
-DENABLE_STATIC_LIB=OFF
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
||||
# Handle copyright
|
||||
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
|
||||
# On Linux, clamav will still build and install clamav-config
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
|
||||
endif()
|
||||
|
||||
vcpkg_copy_pdbs()
|
@ -1212,6 +1212,10 @@
|
||||
"baseline": "2019-11-30-1",
|
||||
"port-version": 0
|
||||
},
|
||||
"clamav": {
|
||||
"baseline": "0.103.0",
|
||||
"port-version": 0
|
||||
},
|
||||
"clapack": {
|
||||
"baseline": "3.2.1",
|
||||
"port-version": 17
|
||||
|
9
versions/c-/clamav.json
Normal file
9
versions/c-/clamav.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "30eb9215db50ee898f34f2405682017ac2424e58",
|
||||
"version-string": "0.103.0",
|
||||
"port-version": 0
|
||||
}
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user