Github messages for voidlinux
 help / color / mirror / Atom feed
From: jcgruenhage <jcgruenhage@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] WIP: clamav: update to 1.0.1.
Date: Mon, 04 Sep 2023 12:02:09 +0200	[thread overview]
Message-ID: <20230904100209.26IAMEgisKkq65ms-vpXK4lm6CmFYEWisWe7ov3aAwg@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-41188@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 1595 bytes --]

There is an updated pull request by jcgruenhage against master on the void-packages repository

https://github.com/jcgruenhage/void-packages clamav-1.0.0_1
https://github.com/void-linux/void-packages/pull/41188

WIP: clamav: update to 1.0.1.
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->

### Things still to do:

 - [ ] Verify that this still works as before and I didn't accidentally change any options
 - [x] Tell cmake to put stuff where it belongs (conf dir -> `/etc` and database dir -> `/var/lib/_clamav`)
 - [x] add services for at least clamav and freshclam
 - [ ] fix cross compilation
 - [ ] fix musl

A patch file from https://github.com/void-linux/void-packages/pull/41188.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-clamav-1.0.0_1-41188.patch --]
[-- Type: text/x-diff, Size: 9403 bytes --]

From cc38e3de3850d9f3d59d0b788aecd9cf170cdb0f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Christian=20Gr=C3=BCnhage?=
 <jan.christian@gruenhage.xyz>
Date: Mon, 19 Dec 2022 19:14:24 +0100
Subject: [PATCH] clamav: update to 1.2.0.

---
 common/shlibs                              |  8 +-
 srcpkgs/clamav/files/clamd/log/run         |  1 +
 srcpkgs/clamav/files/clamd/run             |  4 +
 srcpkgs/clamav/files/freshclam/log/run     |  1 +
 srcpkgs/clamav/files/freshclam/run         |  4 +
 srcpkgs/clamav/files/link-fts.patch        | 12 +++
 srcpkgs/clamav/patches/rust-optimize.patch | 31 ++++++++
 srcpkgs/clamav/template                    | 89 ++++++++++++----------
 8 files changed, 107 insertions(+), 43 deletions(-)
 create mode 120000 srcpkgs/clamav/files/clamd/log/run
 create mode 100755 srcpkgs/clamav/files/clamd/run
 create mode 120000 srcpkgs/clamav/files/freshclam/log/run
 create mode 100755 srcpkgs/clamav/files/freshclam/run
 create mode 100644 srcpkgs/clamav/files/link-fts.patch
 create mode 100644 srcpkgs/clamav/patches/rust-optimize.patch

diff --git a/common/shlibs b/common/shlibs
index bde3b73b96676..6485331919bbe 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -2256,10 +2256,10 @@ libsfml-system.so.2.5 SFML-2.5.0_1
 libsfml-window.so.2.5 SFML-2.5.0_1
 libsfml-audio.so.2.5 SFML-2.5.0_1
 libsfml-graphics.so.2.5 SFML-2.5.0_1
-libclamav.so.9 clamav-0.103.1_2
-libclamunrar.so.9 clamav-0.103.1_2
-libclamunrar_iface.so.9 clamav-0.103.1_2
-libfreshclam.so.2 clamav-0.103.1_2
+libclamav.so.12 clamav-1.2.0_1
+libclamunrar.so.12 clamav-1.2.0_1
+libclamunrar_iface.so.12 clamav-1.2.0_1
+libfreshclam.so.3 clamav-1.2.0_1
 libqca-qt5.so.2 qca-qt5-2.1.3_1
 libqt5keychain.so.1 qtkeychain-qt5-0.7.0_1
 libphonon4qt5.so.4 phonon-qt5-4.8.3_1
diff --git a/srcpkgs/clamav/files/clamd/log/run b/srcpkgs/clamav/files/clamd/log/run
new file mode 120000
index 0000000000000..3a5b4a586051d
--- /dev/null
+++ b/srcpkgs/clamav/files/clamd/log/run
@@ -0,0 +1 @@
+/usr/bin/vlogger
\ No newline at end of file
diff --git a/srcpkgs/clamav/files/clamd/run b/srcpkgs/clamav/files/clamd/run
new file mode 100755
index 0000000000000..ae2b1f0f5da66
--- /dev/null
+++ b/srcpkgs/clamav/files/clamd/run
@@ -0,0 +1,4 @@
+#!/bin/sh
+mkdir -p /run/clamav
+chown _clamav:_clamav /run/clamav
+exec clamd --foreground 2>&1
diff --git a/srcpkgs/clamav/files/freshclam/log/run b/srcpkgs/clamav/files/freshclam/log/run
new file mode 120000
index 0000000000000..3a5b4a586051d
--- /dev/null
+++ b/srcpkgs/clamav/files/freshclam/log/run
@@ -0,0 +1 @@
+/usr/bin/vlogger
\ No newline at end of file
diff --git a/srcpkgs/clamav/files/freshclam/run b/srcpkgs/clamav/files/freshclam/run
new file mode 100755
index 0000000000000..d42df2fb5db76
--- /dev/null
+++ b/srcpkgs/clamav/files/freshclam/run
@@ -0,0 +1,4 @@
+#!/bin/sh
+mkdir -p /run/clamav
+chown _clamav:_clamav /run/clamav
+exec freshclam --daemon --foreground 2>&1
diff --git a/srcpkgs/clamav/files/link-fts.patch b/srcpkgs/clamav/files/link-fts.patch
new file mode 100644
index 0000000000000..fe88e99c01952
--- /dev/null
+++ b/srcpkgs/clamav/files/link-fts.patch
@@ -0,0 +1,12 @@
+diff --git a/clamonacc/CMakeLists.txt b/clamonacc/CMakeLists.txt
+index e95e6d0..928b60a 100644
+--- a/clamonacc/CMakeLists.txt
++++ b/clamonacc/CMakeLists.txt
+@@ -47,6 +47,7 @@ set_target_properties( clamonacc PROPERTIES COMPILE_FLAGS "${WARNCFLAGS}" )
+ 
+ target_link_libraries( clamonacc
+     PRIVATE
++        fts
+         ClamAV::libclamav
+         ClamAV::common
+         CURL::libcurl )
diff --git a/srcpkgs/clamav/patches/rust-optimize.patch b/srcpkgs/clamav/patches/rust-optimize.patch
new file mode 100644
index 0000000000000..1c54b7da9260b
--- /dev/null
+++ b/srcpkgs/clamav/patches/rust-optimize.patch
@@ -0,0 +1,31 @@
+--- a/cmake/FindRust.cmake
++++ b/cmake/FindRust.cmake
+@@ -339,9 +339,7 @@
+         list(APPEND MY_CARGO_ARGS "--target" ${RUST_COMPILER_TARGET})
+     endif()
+ 
+-    if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
+         list(APPEND MY_CARGO_ARGS "--release")
+-    endif()
+ 
+     list(APPEND MY_CARGO_ARGS "--target-dir" ${ARGS_BINARY_DIRECTORY})
+     list(JOIN MY_CARGO_ARGS " " MY_CARGO_ARGS_STRING)
+@@ -443,18 +441,8 @@
+     list(APPEND CARGO_ARGS "--target" ${RUST_COMPILER_TARGET})
+ endif()
+ 
+-if(NOT CMAKE_BUILD_TYPE)
+-    set(CARGO_BUILD_TYPE "debug")
+-elseif(${CMAKE_BUILD_TYPE} STREQUAL "Release" OR ${CMAKE_BUILD_TYPE} STREQUAL "MinSizeRel")
+-    set(CARGO_BUILD_TYPE "release")
+-    list(APPEND CARGO_ARGS "--release")
+-elseif(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
+     set(CARGO_BUILD_TYPE "release")
+     list(APPEND CARGO_ARGS "--release")
+-    string(APPEND RUSTFLAGS " -g")
+-else()
+-    set(CARGO_BUILD_TYPE "debug")
+-endif()
+ string(STRIP "${RUSTFLAGS}" RUSTFLAGS)
+ 
+ find_package_handle_standard_args(Rust
diff --git a/srcpkgs/clamav/template b/srcpkgs/clamav/template
index 34fca27bca1db..2f7b6e2acb77c 100644
--- a/srcpkgs/clamav/template
+++ b/srcpkgs/clamav/template
@@ -1,65 +1,76 @@
 # Template file for 'clamav'
 pkgname=clamav
-version=0.103.8
-revision=4
-build_style=gnu-configure
-# XXX: system llvm is too new (< 3.7 required)
-# Shipped llvm does not build with gcc>=6
-configure_args="--sbindir=/usr/bin --libdir=/usr/lib
- --with-openssl=${XBPS_CROSS_BASE}/usr --with-pcre=${XBPS_CROSS_BASE}/usr
- --with-zlib=${XBPS_CROSS_BASE}/usr --with-libbz2-prefix=${XBPS_CROSS_BASE}/usr
- --with-system-libmspack=${XBPS_CROSS_BASE}/usr --with-libcurl=${XBPS_CROSS_BASE}/usr
- --enable-ipv6 --with-user=_clamav --with-group=_clamav"
+version=1.2.0
+revision=1
+build_style=cmake
+build_helper="qemu"
+configure_args="-DAPP_CONFIG_DIRECTORY=/etc
+ -DDATABASE_DIRECTORY=/var/lib/_clamav
+ -DENABLE_JSON_SHARED=ON
+ -DCLAMAV_USER=_clamav
+ -DCLAMAV_GROUP=_clamav
+ -DENABLE_APP=ON
+ -DENABLE_MILTER=ON
+ -DENABLE_CLAMONACC=ON
+ -DENABLE_MAN_PAGES=ON
+ -DENABLE_DOXYGEN=OFF
+ -DENABLE_EXAMPLES=ON
+ -DENABLE_TESTS=ON
+ -DENABLE_SHARED_LIB=ON
+ -DENABLE_SYSTEMD=OFF
+ -DENABLE_UNRAR=OFF"
 conf_files="/etc/clamd.conf /etc/freshclam.conf"
-hostmakedepends="flex pkg-config zip"
+hostmakedepends="flex pkg-config zip cargo python3"
 makedepends="json-c-devel libcurl-devel libmspack-devel libxml2-devel
- ncurses-devel pcre-devel tcl-devel"
+ ncurses-devel pcre2-devel tcl-devel check-devel libmilter-devel rust-std"
 short_desc="Clam Anti-Virus scanner"
-maintainer="Orphaned <orphan@voidlinux.org>"
+maintainer="Jan Christian Grünhage <jan.christian@gruenhage.xyz>"
 license="GPL-2.0-only"
 homepage="https://www.clamav.net/"
+changelog="https://raw.githubusercontent.com/Cisco-Talos/clamav/main/NEWS.md"
 distfiles="https://www.clamav.net/downloads/production/clamav-${version}.tar.gz"
-checksum=6f49da6ee927936de13d359e559d3944248e3a257d40b80b6c99ebe6fe8c8c3f
+checksum=97a192dffe141480b56cabf1063d79a9fc55cd59203241fa41bfc7a98a548020
 _clamav_homedir="/var/lib/_${pkgname}"
 _clamav_descr="ClamAV user"
 system_accounts="_clamav"
-make_check=ci-skip
 
-CPPFLAGS="-Wno-unused-local-typedefs"
 if [ "$CROSS_BUILD" ]; then
-	configure_args+=" --disable-mempool"
+	configure_args+=" -DRUSTFLAGS=${XBPS_CROSS_RUSTFLAGS}"
+	configure_args+=" -DRUST_COMPILER_TARGET=${XBPS_CROSS_RUST_TARGET}"
 fi
+
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	makedepends+=" musl-fts-devel"
-	LDFLAGS="-lfts"
+	configure_args+=" -DHAVE_SYSTEM_LFS_FTS=ON"
 fi
 
-do_configure() {
-	# Disable detection of sys/cdefs.h (it's obsolete)
-	sed -i configure -e 's; sys/cdefs\.h$;;'
-	sed -i configure -e 's;3\.7;3.9;'
-	# Enable IPv6 for cross builds
-	if [ "$CROSS_BUILD" ]; then
-		configure_args+=" have_cv_ipv6=yes"
+post_patch() {
+	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+		# CFLAGS="-lfts" doesn't work and we can't use
+		# a regular patch because it won't build on glibc
+		patch -Np1 < "${FILESDIR}/link-fts.patch"
 	fi
-	# Need to set PCRE_HOME to make --with-pcre=/usr work
-	PCRE_HOME=/usr ./configure ${configure_args}
 }
-post_install() {
-	# Enable and patch clamd configuration
-	mv -v ${PKGDESTDIR}/etc/clamd.conf.sample ${PKGDESTDIR}/etc/clamd.conf
-	vsconf etc/clamd.conf.sample
-	sed -i ${PKGDESTDIR}/etc/clamd.conf \
-		-e "s;^Example$;# Example;" \
-		-e "s;#DatabaseDirectory.*;DatabaseDirectory /var/lib/_${pkgname};"
 
-	# Enable and patch freshclam configuration
-	mv -v ${PKGDESTDIR}/etc/freshclam.conf.sample ${PKGDESTDIR}/etc/freshclam.conf
-	vsconf etc/freshclam.conf.sample
+post_install() {
+	vsv clamd
+	vsv freshclam
+	for service in clamd clamav-milter freshclam; do
+		# Enable and patch service configuration
+		mv -v ${PKGDESTDIR}/etc/${service}.conf.sample ${PKGDESTDIR}/etc/${service}.conf
+		vsconf etc/${service}.conf.sample
+		sed -i ${PKGDESTDIR}/etc/${service}.conf \
+			-e "s:^\(Example\)$:# \1:" \
+			-e "s:#DatabaseDirectory.*:DatabaseDirectory /var/lib/_${pkgname}:"
+	done
 	sed -i ${PKGDESTDIR}/etc/freshclam.conf \
-		-e "s;^Example$;# Example;" \
-		-e "s;#DatabaseDirectory.*;DatabaseDirectory /var/lib/_${pkgname};"
+		-e "s:.*\(PidFile\) .*:\1 /run/clamav/freshclam.pid:" \
+		-e "s:^\#\(NotifyClamd\).*:\1 /etc/clamd.conf:"
+	sed -i ${PKGDESTDIR}/etc/clamd.conf \
+		-e "s:.*\(PidFile\) .*:\1 /run/clamav/clamd.pid:" \
+		-e "s:.*\(LocalSocket\) .*:\1 /run/clamav/clamd.sock:"
 }
+
 clamav-devel_package() {
 	depends="${sourcepkg}>=${version}_${revision}"
 	short_desc+=" - development files"

  parent reply	other threads:[~2023-09-04 10:02 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-19 18:17 [PR PATCH] WIP: clamav: update to 1.0.0 jcgruenhage
2022-12-19 18:18 ` [PR PATCH] [Updated] " jcgruenhage
2022-12-19 20:04 ` jcgruenhage
2022-12-19 20:07 ` jcgruenhage
2022-12-21 23:29 ` jcgruenhage
2023-04-01  1:52 ` github-actions
2023-04-02  9:37 ` [PR PATCH] [Updated] WIP: clamav: update to 1.0.1 jcgruenhage
2023-04-02  9:38 ` jcgruenhage
2023-05-23 21:46 ` r-ricci
2023-05-25 22:21 ` r-ricci
2023-05-26 21:41 ` r-ricci
2023-05-31 20:55 ` r-ricci
2023-08-30  1:44 ` github-actions
2023-09-04  9:57 ` jcgruenhage
2023-09-04 10:02 ` jcgruenhage [this message]
2023-09-05 20:24 ` [PR REVIEW] " r-ricci
2023-09-06 23:48 ` r-ricci
2023-09-19  7:20 ` nsudsgaard
2023-09-19  7:43 ` nsudsgaard
2023-09-19  7:56 ` nsudsgaard
2023-09-19  7:57 ` nsudsgaard
2023-09-19  8:00 ` nsudsgaard
2023-09-19  8:01 ` nsudsgaard
2023-09-22 12:00 ` nsudsgaard
2023-09-22 12:00 ` nsudsgaard
2023-09-22 12:00 ` nsudsgaard
2023-09-22 12:00 ` nsudsgaard
2023-09-22 12:00 ` nsudsgaard
2023-09-22 12:00 ` nsudsgaard
2023-09-22 12:00 ` nsudsgaard
2023-09-22 12:00 ` nsudsgaard
2023-09-23  1:44 ` nsudsgaard
2023-09-23  2:45 ` nsudsgaard
2023-09-23  3:30 ` nsudsgaard
2023-09-23  5:51 ` nsudsgaard
2023-12-12  5:12 ` nsudsgaard
2023-12-12  5:12 ` nsudsgaard
2023-12-12  5:12 ` nsudsgaard
2023-12-12  5:12 ` nsudsgaard
2023-12-12  5:12 ` nsudsgaard
2024-03-12  1:44 ` github-actions
2024-03-14 11:46 ` [PR PATCH] [Closed]: " jcgruenhage
2024-03-14 11:46 ` jcgruenhage

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230904100209.26IAMEgisKkq65ms-vpXK4lm6CmFYEWisWe7ov3aAwg@z \
    --to=jcgruenhage@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).