diff mbox series

[bug#58261,04/11] gnu: Add tinydir.

Message ID d76975a16723885db419b70eb8f11708d6b48834.1664725832.git.david.elsing@posteo.net
State Accepted
Headers show
Series Add rdkit. | expand

Checks

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

Commit Message

David Elsing Oct. 3, 2022, 12:19 a.m. UTC
* gnu/packages/cpp.scm (tinydir): New variable.
---
 gnu/packages/cpp.scm | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

Comments

Liliana Marie Prikler Oct. 4, 2022, 7:27 a.m. UTC | #1
Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
> * gnu/packages/cpp.scm (tinydir): New variable.
> ---
>  gnu/packages/cpp.scm | 38 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)
> 
> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> index 7bfa3d6cdf..4819f36052 100644
> --- a/gnu/packages/cpp.scm
> +++ b/gnu/packages/cpp.scm
> @@ -2020,3 +2020,41 @@ (define-public sajson
>        (description "sajson is a high-performance, in-place JSON
> parser
>  header-only library.")
>        (license license:expat))))
> +
> +(define-public tinydir
> +  (package
> +    (name "tinydir")
> +    (version "1.2.5")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url "https://github.com/cxong/tinydir")
> +                    (commit version)))
> +              (file-name (git-file-name name version))
> +              (sha256
> +               (base32
> +               
> "1nprgdfx4i8wzc1idw6chan4fjfa75b5ll8kghdc0q2278pny259"))
> +              (modules '((guix build utils)))
> +              (snippet '(delete-file-recursively "tests/cbehave"))))
> +    (build-system cmake-build-system)
> +    (arguments
> +     (list
> +      ;; Tests require cbehave and rlutil
> +      #:tests? #f
Then those should be packaged.
> +      #:phases
> +      ;; Build samples instead of tests
> +      #~(modify-phases %standard-phases
> +          (add-after 'unpack 'chdir
> +            (lambda _ (chdir "samples") #t))
> +          (add-after 'build 'chdir-back
> +            (lambda _ (chdir "..") #t))
We don't typically build samples.
> +          (replace 'install
> +            (lambda _
> +              (install-file "tinydir.h" (string-append #$output
> "/include"))
> +              #t)))))
> +    (home-page "https://github.com/cxong/tinydir")
> +    (synopsis "Lightweight, portable and easy to integrate C
> directory and
> +file reader")
> +    (description "tinydir is a header-only C library to portably
> read files
> +and directories.")
Cut down on the ads.
> +    (license license:bsd-2)))

Cheers
David Elsing Oct. 7, 2022, 3:11 p.m. UTC | #2
Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes:

> Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
>> * gnu/packages/cpp.scm (tinydir): New variable.
>> ---
>>  gnu/packages/cpp.scm | 38 ++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 38 insertions(+)
>> 
>> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
>> index 7bfa3d6cdf..4819f36052 100644
>> --- a/gnu/packages/cpp.scm
>> +++ b/gnu/packages/cpp.scm
>> @@ -2020,3 +2020,41 @@ (define-public sajson
>>        (description "sajson is a high-performance, in-place JSON
>> parser
>>  header-only library.")
>>        (license license:expat))))
>> +
>> +(define-public tinydir
>> +  (package
>> +    (name "tinydir")
>> +    (version "1.2.5")
>> +    (source (origin
>> +              (method git-fetch)
>> +              (uri (git-reference
>> +                    (url "https://github.com/cxong/tinydir")
>> +                    (commit version)))
>> +              (file-name (git-file-name name version))
>> +              (sha256
>> +               (base32
>> +               
>> "1nprgdfx4i8wzc1idw6chan4fjfa75b5ll8kghdc0q2278pny259"))
>> +              (modules '((guix build utils)))
>> +              (snippet '(delete-file-recursively "tests/cbehave"))))
>> +    (build-system cmake-build-system)
>> +    (arguments
>> +     (list
>> +      ;; Tests require cbehave and rlutil
>> +      #:tests? #f
> Then those should be packaged.
The problem is that the tests include a non-trivially modified
fork of cbehave, which uses an older (bundled) copy of rlutil for color
output. How should I deal with that?
>> +      #:phases
>> +      ;; Build samples instead of tests
>> +      #~(modify-phases %standard-phases
>> +          (add-after 'unpack 'chdir
>> +            (lambda _ (chdir "samples") #t))
>> +          (add-after 'build 'chdir-back
>> +            (lambda _ (chdir "..") #t))
> We don't typically build samples.
Ah ok :)
>> +          (replace 'install
>> +            (lambda _
>> +              (install-file "tinydir.h" (string-append #$output
>> "/include"))
>> +              #t)))))
>> +    (home-page "https://github.com/cxong/tinydir")
>> +    (synopsis "Lightweight, portable and easy to integrate C
>> directory and
>> +file reader")
>> +    (description "tinydir is a header-only C library to portably
>> read files
>> +and directories.")
> Cut down on the ads.
>> +    (license license:bsd-2)))
>
> Cheers
Liliana Marie Prikler Oct. 7, 2022, 3:13 p.m. UTC | #3
Am Freitag, dem 07.10.2022 um 15:11 +0000 schrieb David Elsing:
> Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes:
> 
> > Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
> > > * gnu/packages/cpp.scm (tinydir): New variable.
> > > ---
> > >  gnu/packages/cpp.scm | 38 ++++++++++++++++++++++++++++++++++++++
> > >  1 file changed, 38 insertions(+)
> > > 
> > > diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> > > index 7bfa3d6cdf..4819f36052 100644
> > > --- a/gnu/packages/cpp.scm
> > > +++ b/gnu/packages/cpp.scm
> > > @@ -2020,3 +2020,41 @@ (define-public sajson
> > >        (description "sajson is a high-performance, in-place JSON
> > > parser
> > >  header-only library.")
> > >        (license license:expat))))
> > > +
> > > +(define-public tinydir
> > > +  (package
> > > +    (name "tinydir")
> > > +    (version "1.2.5")
> > > +    (source (origin
> > > +              (method git-fetch)
> > > +              (uri (git-reference
> > > +                    (url "https://github.com/cxong/tinydir")
> > > +                    (commit version)))
> > > +              (file-name (git-file-name name version))
> > > +              (sha256
> > > +               (base32
> > > +               
> > > "1nprgdfx4i8wzc1idw6chan4fjfa75b5ll8kghdc0q2278pny259"))
> > > +              (modules '((guix build utils)))
> > > +              (snippet '(delete-file-recursively
> > > "tests/cbehave"))))
> > > +    (build-system cmake-build-system)
> > > +    (arguments
> > > +     (list
> > > +      ;; Tests require cbehave and rlutil
> > > +      #:tests? #f
> > Then those should be packaged.
> The problem is that the tests include a non-trivially modified
> fork of cbehave, which uses an older (bundled) copy of rlutil for
> color output. How should I deal with that?
> > 
You could try to make the tests run with the upstream version and
disable those that don't.  Alternatively, you could package "for-
tinydir" variants of those packages, which inherit as much from
upstream as possible.

Cheers
diff mbox series

Patch

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 7bfa3d6cdf..4819f36052 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -2020,3 +2020,41 @@  (define-public sajson
       (description "sajson is a high-performance, in-place JSON parser
 header-only library.")
       (license license:expat))))
+
+(define-public tinydir
+  (package
+    (name "tinydir")
+    (version "1.2.5")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/cxong/tinydir")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1nprgdfx4i8wzc1idw6chan4fjfa75b5ll8kghdc0q2278pny259"))
+              (modules '((guix build utils)))
+              (snippet '(delete-file-recursively "tests/cbehave"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      ;; Tests require cbehave and rlutil
+      #:tests? #f
+      #:phases
+      ;; Build samples instead of tests
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'chdir
+            (lambda _ (chdir "samples") #t))
+          (add-after 'build 'chdir-back
+            (lambda _ (chdir "..") #t))
+          (replace 'install
+            (lambda _
+              (install-file "tinydir.h" (string-append #$output "/include"))
+              #t)))))
+    (home-page "https://github.com/cxong/tinydir")
+    (synopsis "Lightweight, portable and easy to integrate C directory and
+file reader")
+    (description "tinydir is a header-only C library to portably read files
+and directories.")
+    (license license:bsd-2)))