diff mbox series

[bug#54635,4/5] gnu: atomic-queue: Do not depend on boost when cross-compiling.

Message ID 20220330092313.23584-4-arunisaac@systemreboot.net
State Accepted
Headers show
Series Add wfmash | expand

Commit Message

Arun Isaac March 30, 2022, 9:23 a.m. UTC
* gnu/packages/cpp.scm (atomic-queue)[arguments]: When cross-compiling, add
do-not-check-for-boost phase and delete the build phase.
[native-inputs]: Do not include boost when cross-compiling.
---
 gnu/packages/cpp.scm | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

Comments

M March 30, 2022, 11:49 a.m. UTC | #1
Arun Isaac schreef op wo 30-03-2022 om 14:53 [+0530]:
> * gnu/packages/cpp.scm (atomic-queue)[arguments]: When cross-compiling, add
> do-not-check-for-boost phase and delete the build phase.
> [native-inputs]: Do not include boost when cross-compiling.

I think it's simpler and less tedious to just always include test
dependencies in native-inputs, without special-casing cross-
compilation.  WYDT?

Also, being header-only does not per-se mean ‘no building’.  E.g., what
if some of the headers are generated?  I think it's a bit simpler and
less likely to cause trouble to just always run the build phase, even
if sometimes it is a no-op.

Greetings,
Maxime.
Arun Isaac March 31, 2022, 7:24 a.m. UTC | #2
> I think it's simpler and less tedious to just always include test
> dependencies in native-inputs, without special-casing cross-
> compilation.  WYDT?

Sure, agreed!

> Also, being header-only does not per-se mean ‘no building’.  E.g., what
> if some of the headers are generated?  I think it's a bit simpler and
> less likely to cause trouble to just always run the build phase, even
> if sometimes it is a no-op.

Agreed too!

Will address both in the next version of my patchset.
diff mbox series

Patch

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index eb48902034..649a57b0d5 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -1294,6 +1294,21 @@  (define-public atomic-queue
      `(#:configure-flags '("-Dbenchmarks=false")
        #:phases
        (modify-phases %standard-phases
+         ,@(if (%current-target-system)
+               `(;; boost is a test dependency. We don't run tests when
+                 ;; cross-compiling. So, do not check for it.
+                 (add-after 'unpack 'do-not-check-for-boost
+                   (lambda _
+                     (substitute* "meson.build"
+                       (("unit_test_framework =" all)
+                        (string-append "# " all))
+                       ((", unit_test_framework") ""))))
+                 ;; atomic-queue is a header-only library. Excepting the
+                 ;; tests, no building is required. And since we don't run
+                 ;; tests when cross-compiling, delete the build phase
+                 ;; entirely.
+                 (delete 'build))
+               '())
          (replace 'check
            (lambda* (#:key tests? #:allow-other-keys)
              (when tests?
@@ -1303,9 +1318,11 @@  (define-public atomic-queue
              (copy-recursively "../source/include/atomic_queue"
                                (string-append (assoc-ref outputs "out")
                                               "/include/atomic_queue")))))))
-     (native-inputs
-      (list boost
-            pkg-config))
+    (native-inputs
+     (cons pkg-config
+           (if (%current-target-system)
+               '()
+               (list boost))))
     (home-page "https://github.com/max0x7ba/atomic_queue")
     (synopsis "C++ lockless queue")
     (description