aboutsummaryrefslogtreecommitdiff
From: Tobias Geerinckx-Rice <me@tobias.gr>
Date: Sat, 03 Oct 2020 22:10:20 +0200
Subject: gnu: clamav: Add support for system tomsfastmath.

Adjusted from the original for clamav 0.103.0:

From 756ff89526b5ffaa7a4f49b1bbecf2ecbd6f85f9 Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Date: Wed, 11 Mar 2015 20:03:15 +0100
Subject: add support for system tomsfastmath

Patch-Name: add-support-for-system-tomsfastmath.patch
---
 configure.ac                           |    2 ++
 libclamav/Makefile.am                  |   10 ++++++++--
 libclamav/bignum.h                     |    6 +++++-
 libclamav/xdp.c                        |    2 +-
 m4/reorganization/libs/tomsfastmath.m4 |   12 ++++++++++++
 5 files changed, 28 insertions(+), 4 deletions(-)
 create mode 100644 m4/reorganization/libs/tomsfastmath.m4

diff -Naur a/configure.ac b/configure.ac
--- a/configure.ac	1970-01-01 01:00:01.000000000 +0100
+++ b/configure.ac	2020-10-03 22:04:00.535448352 +0200
@@ -94,6 +94,7 @@
 m4_include([m4/reorganization/libs/json.m4])
 m4_include([m4/reorganization/libs/pcre.m4])
 m4_include([m4/reorganization/libs/libmspack.m4])
+m4_include([m4/reorganization/libs/tomsfastmath.m4])
 
 if test "x$use_internal_mspack" = "xno"; then
     mspack_msg="External, $LIBMSPACK_CFLAGS $LIBMSPACK_LIBS"
@@ -361,6 +362,7 @@
 fi
 CL_MSG_STATUS([yara        ],[$enable_yara],[$enable_yara])
 CL_MSG_STATUS([fts         ],[yes],[$lfs_fts_msg])
+CL_MSG_STATUS([tomsfastmath],[yes],[$tomsfastmath_msg])
 
 
 # Yep, downgrading the compiler avoids the bug too:
diff -Naur a/libclamav/bignum.h b/libclamav/bignum.h
--- a/libclamav/bignum.h	1970-01-01 01:00:01.000000000 +0100
+++ b/libclamav/bignum.h	2020-10-03 22:04:00.535448352 +0200
@@ -1,9 +1,13 @@
 #ifndef BIGNUM_H_
 #define BIGNUM_H_
 
+#if HAVE_SYSTEM_TOMSFASTMATH
+#include <tfm.h>
+#else
 #define TFM_CHECK
-
 #include "bignum_fast.h"
+#endif
+
 typedef fp_int mp_int;
 #define mp_cmp fp_cmp
 #define mp_toradix_n(a, b, c, d) fp_toradix_n(a, b, c, d)
diff -Naur a/libclamav/Makefile.am b/libclamav/Makefile.am
--- a/libclamav/Makefile.am	1970-01-01 01:00:01.000000000 +0100
+++ b/libclamav/Makefile.am	2020-10-03 22:06:42.705447754 +0200
@@ -588,8 +588,10 @@
 	yara_clam.h
 endif
 
-libclamav_la_SOURCES += bignum.h\
-	bignum_fast.h\
+libclamav_la_SOURCES += bignum.h
+
+if !SYSTEM_TOMSFASTMATH
+libclamav_la_SOURCES += bignum_fast.h\
 	tomsfastmath/addsub/fp_add.c\
 	tomsfastmath/addsub/fp_add_d.c\
 	tomsfastmath/addsub/fp_addmod.c\
@@ -671,6 +673,10 @@
 	tomsfastmath/sqr/fp_sqr_comba_generic.c\
 	tomsfastmath/sqr/fp_sqr_comba_small_set.c\
 	tomsfastmath/sqr/fp_sqrmod.c
+else
+libclamav_la_CFLAGS += $(TOMSFASTMATH_CFLAGS)
+libclamav_la_LIBADD += $(TOMSFASTMATH_LIBS)
+endif
 
 .PHONY2: version.h.tmp
 version.c: version.h
diff -Naur a/libclamav/xdp.c b/libclamav/xdp.c
--- a/libclamav/xdp.c	1970-01-01 01:00:01.000000000 +0100
+++ b/libclamav/xdp.c	2020-10-03 22:04:00.535448352 +0200
@@ -52,7 +52,7 @@
 #include "scanners.h"
 #include "conv.h"
 #include "xdp.h"
-#include "bignum_fast.h"
+#include "bignum.h"
 #include "filetypes.h"
 
 static char *dump_xdp(cli_ctx *ctx, const char *start, size_t sz);
diff -Naur a/m4/reorganization/libs/tomsfastmath.m4 b/m4/reorganization/libs/tomsfastmath.m4
--- a/m4/reorganization/libs/tomsfastmath.m4	1970-01-01 01:00:00.000000000 +0100
+++ b/m4/reorganization/libs/tomsfastmath.m4	2020-10-03 22:04:00.535448352 +0200
@@ -0,0 +1,12 @@
+dnl Check for system tomsfastmath
+PKG_CHECK_MODULES([TOMSFASTMATH], [tomsfastmath], [have_system_tomsfastmath=yes], [have_system_tomsfastmath=no])
+
+AM_CONDITIONAL([SYSTEM_TOMSFASTMATH], [test "x$have_system_tomsfastmath" = "xyes"])
+
+if test "x$have_system_tomsfastmath" = "xyes"; then
+    AC_DEFINE([HAVE_SYSTEM_TOMSFASTMATH], [1], [link against system-wide tomsfastmath library])
+    tomsfastmath_msg="External, $TOMSFASTMATH_CFLAGS $TOMSFASTMATH_LIBS"
+else
+    AC_DEFINE([HAVE_SYSTEM_TOMSFASTMATH], [0], [don't link against system-wide tomsfastmath library])
+    tomsfastmath_msg="Internal"
+fi
?id=1d84d7bf6052c0c80bd212d4524876576e9817d4'>build: Require Guile >= 2.0.13....* README, configure.ac, doc/guix.texi (Requirements): Increase minimum Guile version from 2.0.9 to 2.0.13. * config-daemon.ac: Remove use of 'GUIX_CHECK_UNBUFFERED_CBIP'. * m4/guix.m4 (GUIX_CHECK_UNBUFFERED_CBIP): Remove. * guix/build/download.scm (current-http-proxy): Remove. * guix/build/syscalls.scm (%libc-errno-pointer, errno): Remove. (syscall->procedure): Use #:return-errno unconditionally. * guix/hash.scm (open-sha256-input-port)[unbuffered]: Remove outdated comment. * guix/http-client.scm (when-guile<=2.0.5-or-otherwise-broken): Remove. <top level>: Remove 'when-guile<=2.0.5-or-otherwise-broken' block. * guix/scripts/substitute.scm (fetch): Remove 'guile-version>?' conditional. * tests/hash.scm (supports-unbuffered-cbip?): Remove. <top level>: Remove 'test-skip' call. Ludovic Courtès 2018-01-06build: Detect broken 'equal?' in Guile 2.2.1....Fixes <https://bugs.gnu.org/29903>. Reported by Mathieu Lirzin <mthl@gnu.org>. * m4/guix.m4 (GUIX_ASSERT_SYNTAX_OBJECT_EQUAL): New macro. * configure.ac: Use it. Ludovic Courtès 2017-06-30build: Remove check for broken (srfi srfi-37)....This was for Guile < 2.0.9 and we've been requiring 2.0.9+ for some time already. * configure.ac: Remove 'GUIX_CHECK_SRFI_37' use and 'INSTALL_SRFI_37' conditional. * Makefile.am: Remove code in "if INSTALL_SRFI_37". (EXTRA_DIST): Remove srfi/srfi-37.scm.in. * srfi/srfi-37.scm.in: Remove. * m4/guix.m4 (GUIX_CHECK_SRFI_37): Remove. Ludovic Courtès 2017-02-20gnu: Add bootstrap-binaries for 'aarch64-linux'....These bootstrap-binaries were built against commit 8f8f250bdca917b3ce38aa0902f01b19081859a4. * gnu/packages/bootstrap/aarch64-linux/bash, gnu/packages/bootstrap/aarch64-linux/mkdir, gnu/packages/bootstrap/aarch64-linux/xz, gnu/packages/bootstrap/aarch64-linux/tar: New files. * gnu/local.mk (bootstrap_aarch64_linuxdir) (dist_bootstrap_aarch64_linux_DATA) (nodist_bootstrap_aarch64_linux_DATA): New variables. (DISTCLEANFILES): Add $(nodist_bootstrap_aarch64_linux_DATA). (gnu/packages/bootstrap/aarch64-linux/guile-2.0.14.tar.xz): New target. * build-aux/download.scm (filename->uri): Add aarch64-linux entry. * gnu/packages/bootstrap.scm (raw-build): Use guile-2.0.14.tar.xz on aarch64-linux. (glibc-dynamic-linker, %bootstrap-coreutils&co, %boostrap-binutils) (%bootstrap-glibc, %bootstrap-gcc): Add aarch64-linux cases. * m4/guix.m4 (GUIX_SYSTEM_TYPE): Add aarch64 case. (GUIX_ASSERT_SUPPORTED_SYSTEM): Add aarch64-linux to supported list. * doc/guix.texi (GNU Distribution): Add aarch64-linux to the list of supported systems. * tests/packages.scm (package-search-derivation, snippet): Add aarch64 case. Efraim Flashner 2016-11-25offload: Use Guile-SSH instead of GNU lsh....* guix/scripts/offload.scm (<build-machine>)[ssh-options]: Remove. [host-key, host-key-type]: New fields. (%lsh-command, %lshg-command, user-lsh-private-key): Remove. (user-openssh-private-key, private-key-from-file*): New procedures. (host-key->type+key, open-ssh-session): New procedures. (remote-pipe): Remove 'mode' parameter. Rewrite in terms of 'open-ssh-session' etc. Update users. (send-files)[missing-files]: Rewrite using the bidirectional channel port. Remove call to 'call-with-compressed-output-port'. (retrieve-files): Remove call to 'call-with-decompressed-port'. (machine-load): Remove exit status logic. * doc/guix.texi (Requirements): Mention Guile-SSH. (Daemon Offload Setup): Document 'host-key' and 'private-key'. Show the default value on each @item line. * m4/guix.m4 (GUIX_CHECK_GUILE_SSH): New macro. * config-daemon.ac: Use 'GUIX_CHECK_GUILE_SSH'. Set 'HAVE_DAEMON_OFFLOAD_HOOK' as a function of that. Ludovic Courtès 2016-08-10build: Correctly determine the system type for GNU/Hurd systems....* m4/guix.m4 (GUIX_SYSTEM_TYPE): Add case for gnu. Manolis Ragkousis 2016-07-20Merge branch 'master' into core-updatesLudovic Courtès 2016-07-19Add (guix zlib)....* guix/zlib.scm, tests/zlib.scm: New files. * Makefile.am (MODULES): Add guix/zlib.scm. (SCM_TESTS): Add tests/zlib.scm. * m4/guix.m4 (GUIX_LIBGCRYPT_LIBDIR): New macro. * configure.ac (LIBGCRYPT_LIBDIR): Use it. Define and substitute 'LIBZ'. * guix/config.scm.in (%libz): New variable. Ludovic Courtès 2016-06-23build: Remove unneeded conditionals for (guix build syscalls)....* m4/guix.m4: Remove 'GUIX_CHECK_LIBC_MOUNT'. * configure.ac: Remove 'BUILD_SYSCALLS_MODULE'. * Makefile.am (MODULES): Add 'guix/build/syscalls.scm'. (EXTRA_DIST): Remove conditional on BUILD_SYSCALLS_MODULE. Manolis Ragkousis 2016-03-19build: Protect against misconfiguration of localstatedir....Suggested by Jookia <166291@gmail.com>. * m4/guix.m4 (GUIX_CURRENT_LOCALSTATEDIR, GUIX_CHECK_LOCALSTATEDIR): New macros. * config-daemon.ac: Use 'GUIX_CHECK_LOCALSTATEDIR'. * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): Add --localstatedir. * doc/guix.texi (Requirements): Mention --localstatedir. (The Store): Mention LOCALSTATEDIR as such. Ludovic Courtès 2016-01-13build: Use 127 as the Linux hash-bang limit....Reported by taylanbayirli@gmail.com (Taylan Ulrich Bayırlı/Kammer). * m4/guix.m4 (LINUX_HASH_BANG_LIMIT): Set to 127. Ludovic Courtès 2016-01-12build: 'make check' errors out if file name limits would be hit....* Makefile.am (SCM_TESTS, SH_TESTS, TESTS, AM_TESTS_ENVIRONMENT) (SCM_LOG_COMPILER, SH_LOG_COMPILER, AM_SCM_LOG_FLAGS) (AM_SH_LOG_FLAGS): Move within 'if CAN_RUN_TESTS'. (check-local) [!CAN_RUN_TESTS]: New target. * daemon.am (AM_TESTS_ENVIRONMENT, TESTS): Ditto. * m4/guix.m4 (GUIX_CHECK_FILE_NAME_LIMITS): Add parameter and set it. Ludovic Courtès 2016-01-12build: Warn against long hash bang lines for tests....* m4/guix.m4 (GUIX_TEST_HASH_BANG_LENGTH): New macro. (GUIX_CHECK_FILE_NAME_LIMITS): Use it. Warn against long hash bang lines in tests. Ludovic Courtès 2015-12-01build: Fix detection of ARM systems....Reported by Andreas Enge <andreas@enge.fr>. This fixes a regression introduced in 968ae903. * m4/guix.m4 (GUIX_SYSTEM_TYPE): Add extra square braquets around armv[7-9] pattern. Ludovic Courtès 2015-11-25build: Reject ARMv6 systems....Fixes <http://bugs.gnu.org/21987>. Reported by Martin Vahi <martin.vahi@softf1.com>. * m4/guix.m4 (GUIX_SYSTEM_TYPE): Restrict ARM systems to arm|armv[7-9]. Ludovic Courtès 2015-10-09build: Fix libgcrypt detection on FHS systems....Reported by Christopher Allan Webber <cwebber@dustycloud.org>. * m4/guix.m4 (GUIX_LIBGCRYPT_LIBDIR): Add "grep -e -L" to the pipeline to account for cases where the output of "libgcrypt-config --libs" lacks a -L flag. * configure.ac: When 'GUIX_LIBGCRYPT_LIBDIR' returns the empty string, set LIBGCRYPT_LIBDIR to "no". * config-daemon.ac: Add missing space. Ludovic Courtès 2015-10-06build: Automatically determine libgcrypt's file name....* m4/guix.m4 (GUIX_LIBGCRYPT_LIBDIR): New macro. * configure.ac: Use it when no --with-libgcrypt-* option was passed. * README: Do not recommend --with-libgcrypt-prefix. Co-authored-by: 宋文武 <iyzsong@gmail.com> Ludovic Courtès 2015-08-27build: Do not build (guix build syscalls) if 'mount' is missing from libc....This disables compilation of this module on GNU/Hurd. Reported by Manolis Ragkousis <manolis837@gmail.com>. * m4/guix.m4 (GUIX_CHECK_LIBC_MOUNT): New variable. * configure.ac: Use it. Define 'BUILD_SYSCALLS_MODULE' conditional. * Makefile.am (MODULES, EXTRA_DIST): Make 'guix/build/syscalls.scm' conditional on BUILD_SYSCALLS_MODULE. Ludovic Courtès 2015-05-19build: Make sure $CXX supports C++11....* m4/guix.m4 (GUIX_CHECK_CXX11, GUIX_ASSERT_CXX11): New macros. * config-daemon.ac: Use 'AC_LANG([C++])' and 'GUIX_ASSERT_CXX11'.C * doc/guix.texi (Requirements): Mention C++11 support. Ludovic Courtès 2015-02-24build: Reject or warn against file name length limit overruns....* m4/guix.m4 (GUIX_TEST_ROOT_DIRECTORY, LINUX_HASH_BANG_LIMIT, SOCKET_FILE_NAME_LIMIT, GUIX_SOCKET_FILE_NAME_LENGTH, GUIX_TEST_SOCKET_FILE_NAME_LENGTH, GUIX_HASH_BANG_LENGTH, GUIX_CHECK_FILE_NAME_LIMITS): New macros. * configure.ac: Use 'GUIX_CHECK_FILE_NAME_LIMITS'. * config-daemon.ac: Use 'GUIX_TEST_ROOT_DIRECTORY'. * test-env.in: Check socket name length and emit warning if it exceeds 107. Ludovic Courtès 2015-01-07gnu: Add bootstrap binaries for 'armhf-linux'....* gnu/packages/bootstrap/armhf-linux/bash, gnu/packages/bootstrap/armhf-linux/mkdir, gnu/packages/bootstrap/armhf-linux/tar, gnu/packages/bootstrap/armhf-linux/xz: New files. * gnu-system.am (bootstrap_armhf_linuxdir, dist_bootstrap_armhf_linux_DATA) (nodist_bootstrap_armhf_linux_DATA): New variables. (DISTCLEANFILES): Add $(nodist_bootstrap_armhf_linux_DATA). (gnu/packages/bootstrap/armhf-linux/guile-2.0.11.tar.xz): New target. * build-aux/download.scm (file-name->uri): Use newer date in URI for armhf-linux. * gnu/packages/bootstrap.scm (raw-build): Use "guile-2.0.11.tar.xz" on armhf-linux. (glibc-dynamic-linker, %bootstrap-coreutils&co, %bootstrap-binutils) (%bootstrap-glibc, %bootstrap-gcc): Add armhf-linux cases. * m4/guix.m4 (GUIX_SYSTEM_TYPE): Add armhf case. (GUIX_ASSERT_SUPPORTED_SYSTEM): Add armhf-linux to list of supported systems. * doc/guix.texi (GNU Distribution): Add armhf-linux to the list of supported systems. Mark H Weaver 2014-01-24Add 'guix offload' as a daemon build hook....* nix/nix-daemon/guix-daemon.cc (GUIX_OPT_NO_BUILD_HOOK): New macro. (options): Add '--no-build-hook'. (parse_opt): Handle it. (main)[HAVE_DAEMON_OFFLOAD_HOOK]: Set 'useBuildHook' by default. Set $NIX_BUILD_HOOK to our offload hook unless otherwise specified. [!HAVE_DAEMON_OFFLOAD_HOOK]: Clear 'useBuildHook'. * pre-inst-env.in: Set and export NIX_BUILD_HOOK. * nix/scripts/offload.in, guix/scripts/offload.scm: New files. * guix/ui.scm (show-guix-help)[internal?]: Add "offload". * config-daemon.ac: Call 'GUIX_CHECK_UNBUFFERED_CBIP'. Instantiate 'nix/scripts/offload'. Set 'BUILD_DAEMON_OFFLOAD' conditional, and optionally define 'HAVE_DEAMON_OFFLOAD_HOOK' cpp macro. * daemon.am (nodist_pkglibexec_SCRIPTS)[BUILD_DAEMON_OFFLOAD]: Add it. * Makefile.am (MODULES)[BUILD_DAEMON_OFFLOAD]: Add 'guix/scripts/offload.scm'. (EXTRA_DIST)[!BUILD_DAEMON_OFFLOAD]: Likewise. * m4/guix.m4 (GUIX_CHECK_UNBUFFERED_CBIP): New macro. * doc/guix.texi (Setting Up the Daemon): Move most of the body to... (Build Environment Setup): ... this. New subsection. (Daemon Offload Setup): New subsection. Ludovic Courtès 2013-11-03Add mips64el-linux to the list of supported systems....* m4/guix.m4 (GUIX_ASSERT_SUPPORTED_SYSTEM): Add mips64el-linux to the list of supported systems. Mark H Weaver 2013-07-17build: Provide a replacement (srfi srfi-37) when the user's one is broken....* srfi/srfi-37.scm.in: New file, taken from Guile 2.0.9. * m4/guix.m4: New macro. * configure.ac: Use it. Define Automake conditional `INSTALL_SRFI_37'. * Makefile.am (nobase_nodist_guilemodule_DATA)[INSTALL_SRFI_37]: Add srfi/srfi-37.scm. (GOBJECTS)[INSTALL_SRFI_37]: Add srfi/srfi-37.go. (srfi/srfi-37.scm)[INSTALL_SRFI_37]: New target. (EXTRA_DIST): Add srfi/srfi-37.scm.in. Ludovic Courtès 2013-07-05build: Bail out on unsupported platforms; add `--with-courage'....* m4/guix.m4 (GUIX_ASSERT_SUPPORTED_SYSTEM): New macro. * configure.ac: Use it. Ludovic Courtès 2013-07-05build: Correctly determine the system type for non-Linux systems....* m4/guix.m4 (GUIX_SYSTEM_TYPE): Find `sed'. Fix sed pattern in the non-Linux case. Ludovic Courtès 2013-05-10build: Make sure the user's Guile has all the required features....* m4/guix.m4 (GUIX_ASSERT_GUILE_FEATURES): New macro. * configure.ac: Use it. Ludovic Courtès 2013-01-10build: Print the Guix system type....* m4/guix.m4 (GUIX_SYSTEM_TYPE): Print the system type. Ludovic Courtès 2013-01-06Update a few more license headers....* distro/packages/openssl.scm, m4/guix.m4, nix/sync-with-upstream: Update headers. Ludovic Courtès 2012-12-06build: Capture configure-time settings in (guix config)....* configure.ac: Compute and substitute `guix_localstatedir'. * m4/guix.m4: Substitute `guix_system'. * guix/config.scm.in (%store-directory, %store-directory, %system): New variables. * guix/store.scm (%nix-state-dir): Remove. (%default-socket-path): Use %STATE-DIRECTORY as the default. (%store-prefix): Use %STORE-DIRECTORY as the default. * guix/utils.scm (%current-system): Default to %SYSTEM. Ludovic Courtès 2012-12-03build: Include a copy of Nix's libstore and daemon; build it....* configure.ac: Call `AC_USE_SYSTEM_EXTENSIONS', and `GUIX_SYSTEM_TYPE'. Add `--with-store-dir' option, and substitute `storedir'. Include `config-daemon.ac'. * config-daemon.ac: New file. * Makefile.am [BUILD_DAEMON]: Include `daemon.am'. * daemon.am: New file. * m4/guix.m4 (GUIX_SYSTEM_TYPE): New macro. * nix/libutil/gcrypt-hash.cc, nix/libutil/gcrypt-hash.hh, nix/libutil/md5.h, nix/libutil/sha1.h, nix/libutil/sha256.h, nix/nix-daemon/guix-daemon.cc, nix/nix-daemon/shared.hh: New files. Ludovic Courtès 2012-11-03build: Require GNU libgcrypt....* guix/utils.scm (sha256): Remove Coreutils- and libchop-based implementations. * README: Update accordingly. * m4/guix.m4: New file. * configure.ac: Use `GUIX_ASSERT_LIBGCRYPT_USABLE'. Set and substitute `LIBGCRYPT_PREFIX'. * Makefile.am (AM_DISTCHECK_CONFIGURE_FLAGS): Pass `--with-libgcrypt-prefix=$(LIBGCRYPT_PREFIX)'. Ludovic Courtès