diff mbox series

[bug#47972,1/6] gnu: Add boost-for-irods.

Message ID 20210423143201.12831-1-rekado@elephly.net
State Accepted
Headers show
Series [bug#47972,1/6] gnu: Add boost-for-irods. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Ricardo Wurmus April 23, 2021, 2:31 p.m. UTC
* gnu/packages/boost.scm (boost-for-irods): New variable.
---
 gnu/packages/boost.scm | 94 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 93 insertions(+), 1 deletion(-)

Comments

Maxime Devos April 24, 2021, 11:02 a.m. UTC | #1
Ricardo Wurmus schreef op vr 23-04-2021 om 16:31 [+0200]:
> *+;; Sadly, this is needed for irods.  It won't link with 1.69 or later.
> +(define-public boost-for-irods
> +    [...]
> +    (native-inputs
> +     `(("clang" ,clang-6)

> +       ("libcxx" ,libcxx+libcxxabi-6)
> +       ("libcxxabi" ,libcxxabi-6)
"libcxx" and "libcxxabi" look lik they should be in "inputs", but perhaps something
special is going on here.

> +       ("perl" ,perl)
> +       ("tcsh" ,tcsh)))
> +    (arguments
> +     `(#:tests? #f
> +       #:make-flags
> +       (list "threading=multi" "link=shared"
> +             "cxxflags=-stdlib=libc++"
> +             "--without-python"
> +
> +             ;; Set the RUNPATH to $libdir so that the libs find each other.
> +             (string-append "linkflags=-stdlib=libc++ -Wl,-rpath="
> +                            (assoc-ref %outputs "out") "/lib"))
> +       #:phases
> +       (modify-phases %standard-phases
> +         (delete 'bootstrap)
> +         (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
> +           (lambda* (#:key inputs #:allow-other-keys)
> +             (let ((gcc (assoc-ref inputs  "gcc")))

For cross-compilation, this should be (assoc-ref (or native-inputs inputs) "gcc").

> +               (setenv "CPLUS_INCLUDE_PATH"

Maybe you need to set "CROSS_CPLUS_INCLUDE_PATH" here instead, not sure though.

> +                       (string-join
> +                        (cons (string-append (assoc-ref inputs "libcxx")
> +                                             "/include/c++/v1")
> +                              ;; Hide GCC's C++ headers so that they do not interfere with
> +                              ;; the Clang headers.
> +                              (delete (string-append gcc "/include/c++")
> +                                      (string-split (getenv "CPLUS_INCLUDE_PATH")
> +                                                    #\:)))
> +                        ":"))
> +               (format #true
> +                       "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
> +                       (getenv "CPLUS_INCLUDE_PATH")))))
> +         (replace 'configure
> +           (lambda* (#:key inputs outputs #:allow-other-keys)
> +             (let ((icu (assoc-ref inputs "icu4c"))
> +                   (zlib (assoc-ref inputs "zlib"))
> +                   (out (assoc-ref outputs "out")))
> +               (substitute* '("libs/config/configure"
> +                              "libs/spirit/classic/phoenix/test/runtest.sh"
> +                              "tools/build/src/engine/execunix.c"
> +                              "tools/build/src/engine/Jambase"
> +                              "tools/build/src/engine/jambase.c")
> +                 (("/bin/sh") (which "sh")))

When cross-compiling, "which" looks in the 'native-inputs', and not 'inputs'.
For tools/**/*.c, you should use (string-append (assoc-ref inputs "bash") "/bin/sh")
or something like that.  If/when <https://issues.guix.gnu.org/47869> is merged,
you can write the simpler (which "sh" inputs) instead, but that's not (yet) the case.

> +
> +               (setenv "SHELL" (which "sh"))
> +               (setenv "CONFIG_SHELL" (which "sh"))
> +
> +               (invoke "./bootstrap.sh"
> +                       (string-append "--prefix=" out)
> +                       ;; Auto-detection looks for ICU only in traditional
> +                       ;; install locations.
> +                       (string-append "--with-icu=" icu)
> +                       "--with-toolset=clang"))))
> +         (replace 'build
> +           (lambda* (#:key inputs make-flags #:allow-other-keys)
> +             (let ((zlib (assoc-ref inputs "zlib")))

The ((zlib (assoc-ref ...))) binding seems unused here.

Greetings,
Maxime.
Ludovic Courtès June 10, 2021, 8:28 a.m. UTC | #2
Hi Ricardo,

Ricardo Wurmus <rekado@elephly.net> skribis:

> * gnu/packages/boost.scm (boost-for-irods): New variable.

[...]

> +;; Sadly, this is needed for irods.  It won't link with 1.69 or later.
> +(define-public boost-for-irods
> +  (package
> +    (name "boost-for-irods")
> +    (version "1.68.0")

For this and the other “for-irods” packages, how about:

  1. Inheriting from the original package (‘boost’ in this case), to at
     least avoid duplicating the synopsis, description, and license?

  2. Adding the ‘hidden?’ property, because they are not meant to be
     installed on their own?

Apart from that, it LGTM.

Thanks!

Ludo’.
Ricardo Wurmus June 14, 2021, 2:48 p.m. UTC | #3
Ludovic Courtès <ludovic.courtes@inria.fr> writes:

> Hi Ricardo,
>
> Ricardo Wurmus <rekado@elephly.net> skribis:
>
>> * gnu/packages/boost.scm (boost-for-irods): New variable.
>
> [...]
>
>> +;; Sadly, this is needed for irods.  It won't link with 1.69 
>> or later.
>> +(define-public boost-for-irods
>> +  (package
>> +    (name "boost-for-irods")
>> +    (version "1.68.0")
>
> For this and the other “for-irods” packages, how about:
>
>   1. Inheriting from the original package (‘boost’ in this 
>   case), to at
>      least avoid duplicating the synopsis, description, and 
>      license?
>
>   2. Adding the ‘hidden?’ property, because they are not meant 
>   to be
>      installed on their own?

Done.

I also addressed what I could of Maxime’s comments.  Thank you.

I split out the package variant of avro-cpp that is used by both 
irods packages and pushed the patch series to the “master” branch.
diff mbox series

Patch

diff --git a/gnu/packages/boost.scm b/gnu/packages/boost.scm
index a59bb01f3d..0ab62a4d90 100644
--- a/gnu/packages/boost.scm
+++ b/gnu/packages/boost.scm
@@ -7,7 +7,7 @@ 
 ;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
-;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2018, 2019, 2021 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2018 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2018, 2020 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
@@ -43,6 +43,7 @@ 
   #:use-module (gnu packages compression)
   #:use-module (gnu packages hurd)
   #:use-module (gnu packages icu4c)
+  #:use-module (gnu packages llvm)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages python)
   #:use-module (gnu packages shells)
@@ -201,6 +202,97 @@  across a broad spectrum of applications.")
     (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt"
                                 "Some components have other similar licences."))))
 
+;; Sadly, this is needed for irods.  It won't link with 1.69 or later.
+(define-public boost-for-irods
+  (package
+    (name "boost-for-irods")
+    (version "1.68.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "mirror://sourceforge/boost/boost/" version "/boost_"
+                    (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version)
+                    ".tar.bz2"))
+              (sha256
+               (base32
+                "1dyqsr9yb01y0nnjdq9b8q5s2kvhxbayk34832k5cpzn7jy30qbz"))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("icu4c" ,icu4c)
+       ("zlib" ,zlib)))
+    (native-inputs
+     `(("clang" ,clang-6)
+       ("libcxx" ,libcxx+libcxxabi-6)
+       ("libcxxabi" ,libcxxabi-6)
+       ("perl" ,perl)
+       ("tcsh" ,tcsh)))
+    (arguments
+     `(#:tests? #f
+       #:make-flags
+       (list "threading=multi" "link=shared"
+             "cxxflags=-stdlib=libc++"
+             "--without-python"
+
+             ;; Set the RUNPATH to $libdir so that the libs find each other.
+             (string-append "linkflags=-stdlib=libc++ -Wl,-rpath="
+                            (assoc-ref %outputs "out") "/lib"))
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'bootstrap)
+         (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((gcc (assoc-ref inputs  "gcc")))
+               (setenv "CPLUS_INCLUDE_PATH"
+                       (string-join
+                        (cons (string-append (assoc-ref inputs "libcxx")
+                                             "/include/c++/v1")
+                              ;; Hide GCC's C++ headers so that they do not interfere with
+                              ;; the Clang headers.
+                              (delete (string-append gcc "/include/c++")
+                                      (string-split (getenv "CPLUS_INCLUDE_PATH")
+                                                    #\:)))
+                        ":"))
+               (format #true
+                       "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
+                       (getenv "CPLUS_INCLUDE_PATH")))))
+         (replace 'configure
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((icu (assoc-ref inputs "icu4c"))
+                   (zlib (assoc-ref inputs "zlib"))
+                   (out (assoc-ref outputs "out")))
+               (substitute* '("libs/config/configure"
+                              "libs/spirit/classic/phoenix/test/runtest.sh"
+                              "tools/build/src/engine/execunix.c"
+                              "tools/build/src/engine/Jambase"
+                              "tools/build/src/engine/jambase.c")
+                 (("/bin/sh") (which "sh")))
+
+               (setenv "SHELL" (which "sh"))
+               (setenv "CONFIG_SHELL" (which "sh"))
+
+               (invoke "./bootstrap.sh"
+                       (string-append "--prefix=" out)
+                       ;; Auto-detection looks for ICU only in traditional
+                       ;; install locations.
+                       (string-append "--with-icu=" icu)
+                       "--with-toolset=clang"))))
+         (replace 'build
+           (lambda* (#:key inputs make-flags #:allow-other-keys)
+             (let ((zlib (assoc-ref inputs "zlib")))
+               (apply invoke "./b2"
+                      (format #f "-j~a" (parallel-job-count))
+                      make-flags))))
+         (replace 'install
+           (lambda* (#:key make-flags #:allow-other-keys)
+             (apply invoke "./b2" "install" make-flags))))))
+    (home-page "https://www.boost.org")
+    (synopsis "Peer-reviewed portable C++ source libraries")
+    (description
+     "A collection of libraries intended to be widely useful, and usable
+across a broad spectrum of applications.")
+    (license (license:x11-style "https://www.boost.org/LICENSE_1_0.txt"
+                                "Some components have other similar licences."))))
+
 (define-public boost-with-python2
   (package/inherit boost
     (name "boost-python2")