ClamAV: added recipe (#9630)

* ClamAV: added recipe
This commit is contained in:
Luca D'Amico
2023-10-18 08:58:11 +02:00
committed by GitHub
parent 79e2cb361d
commit b65d6dd631
2 changed files with 180 additions and 0 deletions

View File

@@ -0,0 +1,128 @@
SUMMARY="An open source antivirus engine"
DESCRIPTION="ClamAV is an open source antivirus engine for detecting \
trojans, viruses, malware & other malicious threats."
HOMEPAGE="https://www.clamav.net"
COPYRIGHT="2001-2007 Tomasz Kojm
2007-2023 Cisco Systems"
PACKAGER="Luca D'Amico <damico.luca91@live.it>"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://github.com/Cisco-Talos/clamav/archive/refs/tags/clamav-$portVersion.tar.gz"
CHECKSUM_SHA256="efe7e234fe29a96bf4da23336e38ea2989ed0be162342993e99a11901524f43f"
SOURCE_DIR="clamav-clamav-$portVersion"
PATCHES="clamav-$portVersion.patchset"
ARCHITECTURES="all ?x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
GLOBAL_WRITABLE_FILES="
settings/clamav/clamd.conf keep-old
settings/clamav/freshclam.conf keep-old
"
PROVIDES="
clamav$secondaryArchSuffix = $portVersion
cmd:clambc$secondaryArchSuffix = $portVersion
cmd:clamconf$secondaryArchSuffix = $portVersion
cmd:clamd$secondaryArchSuffix = $portVersion
cmd:clamdscan$secondaryArchSuffix = $portVersion
cmd:clamdtop$secondaryArchSuffix = $portVersion
cmd:clamscan$secondaryArchSuffix = $portVersion
cmd:clamsubmit$secondaryArchSuffix = $portVersion
cmd:freshclam$secondaryArchSuffix = $portVersion
cmd:sigtool$secondaryArchSuffix = $portVersion
lib:libclamav$secondaryArchSuffix = $portVersion
lib:libclamunrar$secondaryArchSuffix = $portVersion
lib:libclamunrar_iface$secondaryArchSuffix = $portVersion
lib:libfreshclam$secondaryArchSuffix = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libbz2$secondaryArchSuffix
lib:libcrypto$secondaryArchSuffix
lib:libcurl$secondaryArchSuffix
lib:libiconv$secondaryArchSuffix
lib:libjson_c$secondaryArchSuffix
lib:libmspack$secondaryArchSuffix
lib:libncurses$secondaryArchSuffix
lib:libpcre2_8$secondaryArchSuffix
lib:libssl$secondaryArchSuffix
lib:libxml2$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
PROVIDES_devel="
clamav${secondaryArchSuffix}_devel = $portVersion
cmd:clamav_config$secondaryArchSuffix = $portVersion
devel:libclamav$secondaryArchSuffix = $portVersion
devel:libclamunrar$secondaryArchSuffix = $portVersion
devel:libclamunrar_iface$secondaryArchSuffix = $portVersion
devel:libfreshclam$secondaryArchSuffix = $portVersion
"
REQUIRES_devel="
clamav$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libbz2$secondaryArchSuffix
devel:libcheck$secondaryArchSuffix
devel:libcrypto$secondaryArchSuffix
devel:libcurl$secondaryArchSuffix
devel:libiconv$secondaryArchSuffix
devel:libjson_c$secondaryArchSuffix
devel:libmspack$secondaryArchSuffix
devel:libncurses$secondaryArchSuffix
devel:libpcre2_8$secondaryArchSuffix
devel:libpthread_stubs$secondaryArchSuffix
devel:libssl$secondaryArchSuffix
devel:libxml2$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cargo
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:make
cmd:python3
"
BUILD()
{
cmake -Bbuild -S. -DCMAKE_BUILD_TYPE=Release \
$cmakeDirArgs \
-DENABLE_MILTER=OFF \
-DENABLE_EXTERNAL_MSPACK=ON \
-DAPP_CONFIG_DIRECTORY=$settingsDir/clamav \
-DDATABASE_DIRECTORY=$settingsDir/clamav/db
make -C build
}
INSTALL()
{
make -C build install
prepareInstalledDevelLibs libclamav \
libclamunrar \
libclamunrar_iface \
libfreshclam
fixPkgconfig
packageEntries devel "$developDir" \
$binDir/clamav-config
# install conf files
sed -i -e "/# Comment or remove the line below./d" \
-e "/Example/d" \
-e "s|#DatabaseDirectory /var/lib/clamav|DatabaseDirectory /boot/system/settings/clamav/db|" \
$settingsDir/clamav/clamd.conf.sample
sed -i -e "/# Comment or remove the line below./d" \
-e "/Example/d" \
-e "s|#DatabaseDirectory /var/lib/clamav|DatabaseDirectory /boot/system/settings/clamav/db|" \
-e "s|#DatabaseOwner clamav|DatabaseOwner user|" \
$settingsDir/clamav/freshclam.conf.sample
mv $settingsDir/clamav/clamd.conf.sample $settingsDir/clamav/clamd.conf
mv $settingsDir/clamav/freshclam.conf.sample $settingsDir/clamav/freshclam.conf
}

View File

@@ -0,0 +1,52 @@
From dc5efaa4fe8443afc08f5cf5d8a06f56d3640372 Mon Sep 17 00:00:00 2001
From: Luca D'Amico <damico.luca91@live.it>
Date: Tue, 17 Oct 2023 19:15:17 +0000
Subject: applying patch haiku-1.2.0.patch
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5426f38..be74d2b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -610,8 +610,10 @@ foreach(_cxx1x_flag -std=c++14 -std=c++11)
endif()
endforeach()
-# Always use '-fPIC'/'-fPIE' option.
-set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+# Always use '-fPIC'/'-fPIE' option if OS is not Haiku.
+if(NOT HAIKU)
+ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+endif()
# Checks for header files.
include(CheckIncludeFile)
diff --git a/libfreshclam/CMakeLists.txt b/libfreshclam/CMakeLists.txt
index 01b456c..218d74c 100644
--- a/libfreshclam/CMakeLists.txt
+++ b/libfreshclam/CMakeLists.txt
@@ -48,6 +48,10 @@ if(ENABLE_SHARED_LIB)
resolv
${APPLE_CORE_FOUNDATION}
${APPLE_SECURITY} )
+ elseif(HAIKU)
+ target_link_libraries( freshclam
+ PUBLIC
+ network )
elseif(UNIX)
if(HAVE_RESOLV_H AND NOT C_BSD) # BSD appears to have libresolv inside libc
target_link_libraries( freshclam
@@ -128,6 +132,10 @@ if(ENABLE_STATIC_LIB)
resolv
${APPLE_CORE_FOUNDATION}
${APPLE_SECURITY} )
+ elseif(HAIKU)
+ target_link_libraries( freshclam_static
+ PUBLIC
+ network )
elseif(UNIX)
if(HAVE_RESOLV_H AND NOT C_BSD) # BSD appears to have libresolv inside libc
target_link_libraries( freshclam_static
--
2.42.0