Message ID | 20200601004015.21684-1-kuba@kadziolka.net |
---|---|
State | Accepted |
Headers | show |
Series | [bug#41637] gnu: Add hashcash. | expand |
Context | Check | Description |
---|---|---|
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | success | View Laminar job |
Hello Jakub,
> + `(#:make-flags '("CC=gcc")
It would be better to use "cc-for-target" here. You can check if
cross-compilation works by running something like:
--8<---------------cut here---------------start------------->8---
guix build --target=aarch64-linux-gnu hashcash
--8<---------------cut here---------------end--------------->8---
Thanks,
Mathieu
On Tue, Jun 02, 2020 at 02:12:05PM +0200, Mathieu Othacehe wrote: > > Hello Jakub, > > > + `(#:make-flags '("CC=gcc") > > It would be better to use "cc-for-target" here. You can check if > cross-compilation works by running something like: > > --8<---------------cut here---------------start------------->8--- > guix build --target=aarch64-linux-gnu hashcash > --8<---------------cut here---------------end--------------->8--- Thanks! I had no idea this affects cross-compilation... I have changed that line to be `(#:make-flags (list (string-append "CC=" ,(cc-for-target))) instead. Does the rest of the patch look alright? Regards, Jakub Kądziołka
Hey Jakub, Thanks for fixing the cross-compilation, a full review this time :) > + (let* ((outdir (assoc-ref outputs "out")) > + (bindir (string-append outdir "/bin")) > + (mandir (string-append outdir "/share/man/man1")) > + (docdir (string-append outdir "/share/doc/hashcash-" ,version))) > + ;; make install assumes /usr and doesn't provide a way to override it > + (install-file "hashcash" bindir) > + (install-file "hashcash.1" mandir) > + (install-file "README" docdir) > + (install-file "LICENSE" docdir) > + (install-file "CHANGELOG" docdir) I think you can set the variables INSTALL_PATH, MAN_INSTALL_PATH and DOC_INSTALL_PATH instead. > + #t)))))) > + (home-page "https://www.hashcash.org/") > + (synopsis "Denial-of-service countermeasure") > + (description "Hashcash is a proof-of-work algorithm, which has been used > +as a denial-of-service countermeasure technique in a number of systems. You can remove "in a number of systems". > +A hashcash stamp constitutes a proof-of-work which takes a parametrizable > +amount of work to compute for the sender. The recipient can verify received > +hashcash stamps efficiently. > + > +This package contains a command-line tool for computing and verifying hashcash > +stamps.") > + (license license:public-domain))) I'm also concerned by this line in the Makefile: --8<---------------cut here---------------start------------->8--- # request static link of -lcrypto only LIBCRYPTO=/usr/lib/libcrypto.a --8<---------------cut here---------------end--------------->8--- We should maybe add "openssl" to the inputs and fix this variable (that's what Nix does). Thanks, Mathieu
On Wed, Jun 03, 2020 at 08:55:39AM +0200, Mathieu Othacehe wrote: > > Hey Jakub, > > Thanks for fixing the cross-compilation, a full review this time :) > > > + (let* ((outdir (assoc-ref outputs "out")) > > + (bindir (string-append outdir "/bin")) > > + (mandir (string-append outdir "/share/man/man1")) > > + (docdir (string-append outdir "/share/doc/hashcash-" ,version))) > > + ;; make install assumes /usr and doesn't provide a way to override it > > + (install-file "hashcash" bindir) > > + (install-file "hashcash.1" mandir) > > + (install-file "README" docdir) > > + (install-file "LICENSE" docdir) > > + (install-file "CHANGELOG" docdir) > > I think you can set the variables INSTALL_PATH, MAN_INSTALL_PATH and > DOC_INSTALL_PATH instead. Unfortunately, the variables are defined with `=` instead of `?=`, so the Makefile always overwrites them. We would also want to skip installing the `sha1' tool like Debian does, since `sha1sum' is already a thing. > > + #t)))))) > > + (home-page "https://www.hashcash.org/") > > + (synopsis "Denial-of-service countermeasure") > > + (description "Hashcash is a proof-of-work algorithm, which has been used > > +as a denial-of-service countermeasure technique in a number of systems. > > You can remove "in a number of systems". > > > +A hashcash stamp constitutes a proof-of-work which takes a parametrizable > > +amount of work to compute for the sender. The recipient can verify received > > +hashcash stamps efficiently. > > + > > +This package contains a command-line tool for computing and verifying hashcash > > +stamps.") > > + (license license:public-domain))) > > I'm also concerned by this line in the Makefile: > > --8<---------------cut here---------------start------------->8--- > # request static link of -lcrypto only > LIBCRYPTO=/usr/lib/libcrypto.a > --8<---------------cut here---------------end--------------->8--- > > We should maybe add "openssl" to the inputs and fix this variable > (that's what Nix does). From what I've read, openssl is not used by default, but only when a target like `gnu-openssl' is used. I'll make a build with openssl and benchmark which is faster... Regards, Jakub Kądziołka
>> I think you can set the variables INSTALL_PATH, MAN_INSTALL_PATH and >> DOC_INSTALL_PATH instead. > > Unfortunately, the variables are defined with `=` instead of `?=`, so > the Makefile always overwrites them. We would also want to skip > installing the `sha1' tool like Debian does, since `sha1sum' is already > a thing. Not if they are passed on the command line, see: https://www.gnu.org/software/make/manual/html_node/Overriding.html Mathieu
Pushed to master as commit ef6d3b643689953b71fe103e8c6f520b54996f11, closing.
diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm index fd29370841..169aa4ed8e 100644 --- a/gnu/packages/networking.scm +++ b/gnu/packages/networking.scm @@ -38,6 +38,7 @@ ;;; Copyright © 2019 Diego N. Barbato <dnbarbato@posteo.de> ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com> ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re> +;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net> ;;; ;;; This file is part of GNU Guix. ;;; @@ -3189,3 +3190,48 @@ CDP. The goal of LLDP is to provide an inter-vendor compatible mechanism to deliver Link-Layer notifications to adjacent network devices. @code{lldpd} is an implementation of LLDP. It also supports some proprietary protocols.") (license license:isc))) + +(define-public hashcash + (package + (name "hashcash") + (version "1.22") + (source + (origin + (method url-fetch) + (uri (string-append "http://www.hashcash.org/source/hashcash-" + version ".tgz")) + (sha256 + (base32 + "15kqaimwb2y8wvzpn73021bvay9mz1gqqfc40gk4hj6f84nz34h1")))) + (build-system gnu-build-system) + (arguments + `(#:make-flags '("CC=gcc") + #:phases + (modify-phases %standard-phases + (delete 'configure) + ;; No tests available. + (delete 'check) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((outdir (assoc-ref outputs "out")) + (bindir (string-append outdir "/bin")) + (mandir (string-append outdir "/share/man/man1")) + (docdir (string-append outdir "/share/doc/hashcash-" ,version))) + ;; make install assumes /usr and doesn't provide a way to override it + (install-file "hashcash" bindir) + (install-file "hashcash.1" mandir) + (install-file "README" docdir) + (install-file "LICENSE" docdir) + (install-file "CHANGELOG" docdir) + #t)))))) + (home-page "https://www.hashcash.org/") + (synopsis "Denial-of-service countermeasure") + (description "Hashcash is a proof-of-work algorithm, which has been used +as a denial-of-service countermeasure technique in a number of systems. + +A hashcash stamp constitutes a proof-of-work which takes a parametrizable +amount of work to compute for the sender. The recipient can verify received +hashcash stamps efficiently. + +This package contains a command-line tool for computing and verifying hashcash +stamps.")