Message ID | cfba62fdba849025d3b81b2186626a097b9a8fdc.1683389080.git.liliana.prikler@gmail.com |
---|---|
State | New |
Headers | show |
Series | Functional programming? In my C++?! It's more likely than you think! | expand |
Hi, Liliana Marie Prikler <liliana.prikler@gmail.com> writes: > * gnu/packages/cpp.scm (immer): New variable. > --- > gnu/packages/cpp.scm | 33 +++++++++++++++++++++++++++++++++ > 1 file changed, 33 insertions(+) > > diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm > index 023d1c0337..da3567b5ef 100644 > --- a/gnu/packages/cpp.scm > +++ b/gnu/packages/cpp.scm > @@ -67,6 +67,7 @@ (define-module (gnu packages cpp) > #:use-module (gnu packages) > #:use-module (gnu packages assembly) > #:use-module (gnu packages autotools) > + #:use-module (gnu packages bdw-gc) > #:use-module (gnu packages boost) > #:use-module (gnu packages build-tools) > #:use-module (gnu packages c) > @@ -1390,6 +1391,38 @@ (define-public libexpected > (home-page "https://tl.tartanllama.xyz/") > (license license:cc0))) > > +(define-public immer > + (package > + (name "immer") > + (version "0.8.0") > + (source (origin > + (method git-fetch) > + (uri (git-reference > + (url "https://github.com/arximboldi/immer") > + (commit (string-append "v" version)))) > + (file-name (git-file-name name version)) > + (sha256 > + (base32 "11km3l5h3rgsbj8yfyzk3fnx9na55l6zs2sxpx922yvlvs2blh27")) > + (modules '((guix build utils))) > + (snippet #~(begin > + (delete-file "tools/include/doctest.h") > + (delete-file "tools/include/catch.hpp") > + (substitute* (find-files "test" "\\.[cih]pp") > + (("<catch.hpp>") "<catch2/catch.hpp>") > + (("<doctest.h>") "<doctest/doctest.h>")) > + (substitute* (find-files "test/oss-fuzz" "\\.cpp") > + ;; someone used the wrong header :) > + (("<fmt/printf.h>") "<fmt/ostream.h>")))))) Did you report the wrong header usage upstream? A less intrusive fix for the catch/doctest include problem could be to add their include subdirectories as -I directives to the CXXFLAGS environment variable, or since that's CMake, via its CMAKE_CXX_FLAGS make options. See 'clara' for an actual example.
Am Sonntag, dem 07.05.2023 um 11:30 -0400 schrieb Maxim Cournoyer: > Hi, > > Liliana Marie Prikler <liliana.prikler@gmail.com> writes: > > > * gnu/packages/cpp.scm (immer): New variable. > > --- > > gnu/packages/cpp.scm | 33 +++++++++++++++++++++++++++++++++ > > 1 file changed, 33 insertions(+) > > > > diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm > > index 023d1c0337..da3567b5ef 100644 > > --- a/gnu/packages/cpp.scm > > +++ b/gnu/packages/cpp.scm > > @@ -67,6 +67,7 @@ (define-module (gnu packages cpp) > > #:use-module (gnu packages) > > #:use-module (gnu packages assembly) > > #:use-module (gnu packages autotools) > > + #:use-module (gnu packages bdw-gc) > > #:use-module (gnu packages boost) > > #:use-module (gnu packages build-tools) > > #:use-module (gnu packages c) > > @@ -1390,6 +1391,38 @@ (define-public libexpected > > (home-page "https://tl.tartanllama.xyz/") > > (license license:cc0))) > > > > +(define-public immer > > + (package > > + (name "immer") > > + (version "0.8.0") > > + (source (origin > > + (method git-fetch) > > + (uri (git-reference > > + (url "https://github.com/arximboldi/immer") > > + (commit (string-append "v" version)))) > > + (file-name (git-file-name name version)) > > + (sha256 > > + (base32 > > "11km3l5h3rgsbj8yfyzk3fnx9na55l6zs2sxpx922yvlvs2blh27")) > > + (modules '((guix build utils))) > > + (snippet #~(begin > > + (delete-file "tools/include/doctest.h") > > + (delete-file "tools/include/catch.hpp") > > + (substitute* (find-files "test" > > "\\.[cih]pp") > > + (("<catch.hpp>") "<catch2/catch.hpp>") > > + (("<doctest.h>") > > "<doctest/doctest.h>")) > > + (substitute* (find-files "test/oss-fuzz" > > "\\.cpp") > > + ;; someone used the wrong header :) > > + (("<fmt/printf.h>") > > "<fmt/ostream.h>")))))) > > Did you report the wrong header usage upstream? I must admit, I did not. > A less intrusive fix for the catch/doctest include problem could be > to add their include subdirectories as -I directives to the CXXFLAGS > environment variable, or since that's CMake, via its CMAKE_CXX_FLAGS > make options. See 'clara' for an actual example. There are other packages that take the approach I used here. I do think this is a CMakeFiles bug, but not one I want to fix. Cheers
Hi, Liliana Marie Prikler <liliana.prikler@gmail.com> writes: > Am Sonntag, dem 07.05.2023 um 11:30 -0400 schrieb Maxim Cournoyer: >> Hi, >> >> Liliana Marie Prikler <liliana.prikler@gmail.com> writes: >> >> > * gnu/packages/cpp.scm (immer): New variable. >> > --- >> > gnu/packages/cpp.scm | 33 +++++++++++++++++++++++++++++++++ >> > 1 file changed, 33 insertions(+) >> > >> > diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm >> > index 023d1c0337..da3567b5ef 100644 >> > --- a/gnu/packages/cpp.scm >> > +++ b/gnu/packages/cpp.scm >> > @@ -67,6 +67,7 @@ (define-module (gnu packages cpp) >> > #:use-module (gnu packages) >> > #:use-module (gnu packages assembly) >> > #:use-module (gnu packages autotools) >> > + #:use-module (gnu packages bdw-gc) >> > #:use-module (gnu packages boost) >> > #:use-module (gnu packages build-tools) >> > #:use-module (gnu packages c) >> > @@ -1390,6 +1391,38 @@ (define-public libexpected >> > (home-page "https://tl.tartanllama.xyz/") >> > (license license:cc0))) >> > >> > +(define-public immer >> > + (package >> > + (name "immer") >> > + (version "0.8.0") >> > + (source (origin >> > + (method git-fetch) >> > + (uri (git-reference >> > + (url "https://github.com/arximboldi/immer") >> > + (commit (string-append "v" version)))) >> > + (file-name (git-file-name name version)) >> > + (sha256 >> > + (base32 >> > "11km3l5h3rgsbj8yfyzk3fnx9na55l6zs2sxpx922yvlvs2blh27")) >> > + (modules '((guix build utils))) >> > + (snippet #~(begin >> > + (delete-file "tools/include/doctest.h") >> > + (delete-file "tools/include/catch.hpp") >> > + (substitute* (find-files "test" >> > "\\.[cih]pp") >> > + (("<catch.hpp>") "<catch2/catch.hpp>") >> > + (("<doctest.h>") >> > "<doctest/doctest.h>")) >> > + (substitute* (find-files "test/oss-fuzz" >> > "\\.cpp") >> > + ;; someone used the wrong header :) >> > + (("<fmt/printf.h>") >> > "<fmt/ostream.h>")))))) >> >> Did you report the wrong header usage upstream? > I must admit, I did not. Could you please do so, if that's not too much to ask? Then include a (see: URL) next to the substitution comment. >> A less intrusive fix for the catch/doctest include problem could be >> to add their include subdirectories as -I directives to the CXXFLAGS >> environment variable, or since that's CMake, via its CMAKE_CXX_FLAGS >> make options. See 'clara' for an actual example. > There are other packages that take the approach I used here. I do > think this is a CMakeFiles bug, but not one I want to fix. I think catch2 is selfom used from the system (typically bundled), must not ship with any pkg-config or proper support to be auto-detected at configure time, which gives us the situation we're in. -- Thanks, Maxim
Hi, Am Sonntag, dem 07.05.2023 um 13:12 -0400 schrieb Maxim Cournoyer: > Liliana Marie Prikler <liliana.prikler@gmail.com> writes: > > > Am Sonntag, dem 07.05.2023 um 11:30 -0400 schrieb Maxim Cournoyer: > > > Did you report the wrong header usage upstream? > > I must admit, I did not. > > Could you please do so, if that's not too much to ask? Then include > a (see: URL) next to the substitution comment. I sent a mail to the address in the README; let's wait for a reply. > > > A less intrusive fix for the catch/doctest include problem could > > > be to add their include subdirectories as -I directives to the > > > CXXFLAGS environment variable, or since that's CMake, via its > > > CMAKE_CXX_FLAGS make options. See 'clara' for an actual example. > > There are other packages that take the approach I used here. I do > > think this is a CMakeFiles bug, but not one I want to fix. Correction to myself: I now see that we only need to edit those source files because we remove the bundled ones, but that's an argument towards keeping that within the snippet imho. > I think catch2 is selfom used from the system (typically bundled), > must not ship with any pkg-config or proper support to be auto- > detected at configure time, which gives us the situation we're in. Joke's on you, catch2 ships with both CMake's config stuff *and* pkg- config. Vendoring it is next to pointless (that is, unless you regard sneaking it onto ancient Debian as the point). Doctest also comes with the usual CMake blurb. Cheers
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index 023d1c0337..da3567b5ef 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -67,6 +67,7 @@ (define-module (gnu packages cpp) #:use-module (gnu packages) #:use-module (gnu packages assembly) #:use-module (gnu packages autotools) + #:use-module (gnu packages bdw-gc) #:use-module (gnu packages boost) #:use-module (gnu packages build-tools) #:use-module (gnu packages c) @@ -1390,6 +1391,38 @@ (define-public libexpected (home-page "https://tl.tartanllama.xyz/") (license license:cc0))) +(define-public immer + (package + (name "immer") + (version "0.8.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/arximboldi/immer") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "11km3l5h3rgsbj8yfyzk3fnx9na55l6zs2sxpx922yvlvs2blh27")) + (modules '((guix build utils))) + (snippet #~(begin + (delete-file "tools/include/doctest.h") + (delete-file "tools/include/catch.hpp") + (substitute* (find-files "test" "\\.[cih]pp") + (("<catch.hpp>") "<catch2/catch.hpp>") + (("<doctest.h>") "<doctest/doctest.h>")) + (substitute* (find-files "test/oss-fuzz" "\\.cpp") + ;; someone used the wrong header :) + (("<fmt/printf.h>") "<fmt/ostream.h>")))))) + (build-system cmake-build-system) + (arguments (list #:test-target "check")) + (inputs (list boost libgc c-rrb)) + (native-inputs (list catch2 doctest fmt pkg-config)) + (home-page "https://sinusoid.es/immer") + (synopsis "Immutable data structures") + (description "Immer is a library of persistent and immutable data structures +written in C++.") + (license license:boost1.0))) + (define-public atomic-queue (package (name "atomic-queue")