Subject: [bug#72881] [PATCH 3/3] gnu: lcrq: Add compiler optimizations.

From: [email-masked]
Date: Thu, 29 Aug 2024 14:39:20 -0700

From: Vagrant Cascadian <[email-masked]>

* gnu/packages/networking.scm (lcrq)[arguments]: Pass compiler optimizations
to configure. [phases]: Add 'speedtest phase.
---
 gnu/packages/networking.scm | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index 161cd7cb13..e78126b341 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -289,9 +289,20 @@ (define-public lcrq
     (arguments
      (list
       #:parallel-tests? #f
+      ;; Use recommended optimizations from lcrq README.md
+      #:configure-flags
+      #~(list (string-append "CFLAGS=-Wall -Wextra -pedantic -O3 -flto "
+                             "-funroll-loops -ffast-math -DNDEBUG"))
       #:make-flags
       #~(list (string-append "CC=" #$(cc-for-target))
               (string-append "PREFIX=" #$output))
+      #:phases
+      #~(modify-phases %standard-phases
+          ;; Leave some speed comparisons in the build log
+          (add-after 'check 'speedtest
+            (lambda _
+              (invoke "make" "-C" "test" "speedtest"
+                      (string-append "CC=" #$(cc-for-target))))))
       #:test-target "test"))
     (home-page "https://librecast.net/lcrq.html")
     (synopsis "Librecast RaptorQ library")
-- 
2.39.2