unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Christopher Baines <mail@cbaines.net>
To: Martin Becze <mjbecze@riseup.net>
Cc: 44433@debbugs.gnu.org
Subject: [bug#44433] [PATCH 3/3] gnu: Add solidity.
Date: Wed, 18 Nov 2020 08:22:28 +0000	[thread overview]
Message-ID: <87lfezkraz.fsf@cbaines.net> (raw)
In-Reply-To: <20201105135945.26384-3-mjbecze@riseup.net>

[-- Attachment #1: Type: text/plain, Size: 5962 bytes --]


I made a few tweaks to this patch before merging.

Martin Becze <mjbecze@riseup.net> writes:

> * gnu/packages/solidity.scm: (solidity) New variable.

It is a new variable, but I believe the convention for new files is just
to say that, so I changed this to:

* gnu/packages/solidity.scm: New file.

> * gnu/local.mk (GNU_SYSTEM_MODULES): Add solidity.scm.
> ---
>  gnu/local.mk              |  1 +
>  gnu/packages/solidity.scm | 88 +++++++++++++++++++++++++++++++++++++++
>  2 files changed, 89 insertions(+)
>  create mode 100644 gnu/packages/solidity.scm
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index 08a82c45f1..92be573355 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -508,6 +508,7 @@ GNU_SYSTEM_MODULES =				\
>    %D%/packages/slang.scm			\
>    %D%/packages/smalltalk.scm			\
>    %D%/packages/sml.scm				\
> +  %D%/packages/solidity.scm			\
>    %D%/packages/speech.scm			\
>    %D%/packages/sphinx.scm			\
>    %D%/packages/spice.scm			\
> diff --git a/gnu/packages/solidity.scm b/gnu/packages/solidity.scm
> new file mode 100644
> index 0000000000..f67bae8146
> --- /dev/null
> +++ b/gnu/packages/solidity.scm
> @@ -0,0 +1,88 @@
> +;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify it
> +;;; under the terms of the GNU General Public License as published by
> +;;; the Free Software Foundation; either version 3 of the License, or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public License
> +;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
> +
> +(define-module (gnu packages solidity)
> +  #:use-module (gnu packages base)
> +  #:use-module (gnu packages boost)
> +  #:use-module (gnu packages maths)
> +  #:use-module (gnu packages serialization)
> +  #:use-module (gnu packages python)
> +  #:use-module (gnu packages ncurses)
> +  #:use-module (guix packages)
> +  #:use-module (guix git-download)
> +  #:use-module (guix build-system cmake)
> +  #:use-module ((guix licenses) #:prefix license:))
> +
> +(define-public solidity
> +  (let ((commit "3f05b770bdbf60eca866382049ea191dd701409a"))
> +    (package
> +      (name "solidity")
> +      (version "0.7.4")
> +      (source
> +       (origin
> +         (method git-fetch)
> +         (uri
> +          (git-reference
> +           (url "https://github.com/ethereum/solidity")
> +           (commit commit)))
> +         (file-name (git-file-name name version))
> +         (sha256
> +          (base32 "1mswhjymiwnd3n7h3sjvjx5x8223yih0yvfcr0zpqr4aizpfx5z8"))))
> +      (build-system cmake-build-system)
> +      (arguments
> +       `(#:phases
> +         (modify-phases %standard-phases
> +           (delete 'configure)
> +           (delete 'install)
> +           (replace 'build
> +             (lambda* (#:key outputs #:allow-other-keys)
> +               (with-output-to-file "commit_hash.txt"
> +                 (lambda _
> +                   (display
> +                    (substring ,commit 0 8))))

I moved this to a different phase, just because it makes it clearer
what's going on.

> +               ;; Unbundle jsoncpp
> +               (delete-file "./cmake/jsoncpp.cmake")
> +               (substitute* "CMakeLists.txt"
> +                 (("include\\(jsoncpp\\)") ""))
> +               ;; Bug list is always sorted since we only build releases
> +               (substitute* "./test/cmdlineTests.sh"
> +                 (("\"\\$REPO_ROOT\"/scripts/update_bugs_by_version\\.py") ""))
> +               (substitute* "./scripts/build.sh"
> +                 (("sudo\\ make\\ install") "make install")
> +                 (("cmake\\ ..")
> +                  (string-append "cmake .. -DCMAKE_INSTALL_PREFIX="
> +                                 (assoc-ref outputs "out"))))
> +               (setenv "CIRCLECI" "1")
> +               (invoke "./scripts/build.sh")

I'd perhaps be tempted to just use/adjust the cmake-build-system to
handle the actual building. Just using cmake/make directly seems to be
documented [1].

1: https://docs.soliditylang.org/en/v0.7.4/installing-solidity.html#command-line-build

I noticed the build.sh script hardcodes the concurrency [2], which got
me thinking this.

2: https://github.com/ethereum/solidity/blob/develop/scripts/build.sh#L21

Anyway, calling build.sh is also OK.

> +               #t))
> +           (replace 'check
> +             (lambda _
> +               (invoke "./scripts/tests.sh")
> +               #t)))))
> +      (native-inputs
> +       `(("boost-static" ,boost-static)
> +         ("jsoncpp" ,jsoncpp)
> +         ("python" ,python)
> +         ("tput" ,ncurses)
> +         ("xargs" ,findutils)
> +         ("z3" ,z3)))

So, some of these inputs are still referenced by the package at runtime,
which is a strong signal that they should be inputs, rather than native
inputs. I split it like this:

      (inputs
       `(("boost-static" ,boost-static)
         ("jsoncpp" ,jsoncpp)
         ("z3" ,z3)))
      (native-inputs
       `(("python" ,python)
         ("tput" ,ncurses)
         ("xargs" ,findutils)))

> +      (home-page "https://solidity.readthedocs.io")
> +      (synopsis "Contract-Oriented Programming Language")
> +      (description
> +       "Solidity is a statically-typed curly-braces programming language
> +designed for developing smart contracts that run on the Ethereum Virtual Machine.")
> +      (license license:gpl3+))))


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]

  reply	other threads:[~2020-11-18  8:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-04 12:29 [bug#44433] [PATCH 0/3] gnu: Add solidity Martin Becze
2020-11-04 12:29 ` [bug#44432] [PATCH 1/3] gnu: jsoncpp: Update to 1.9.4 Martin Becze
2020-11-05 14:04   ` bug#44432: close Martin Becze
2020-11-04 12:29 ` [bug#44431] [PATCH 2/3] gnu: z3: Update to 4.8.9 Martin Becze
2020-11-05 14:05   ` bug#44431: close Martin Becze
2020-11-04 12:29 ` [bug#44434] [PATCH 3/3] gnu: Add solidity Martin Becze
2020-11-05 14:03   ` bug#44434: closing Martin Becze
2020-11-05 13:59 ` [bug#44433] [PATCH 1/3] gnu: jsoncpp: Update to 1.9.4 Martin Becze
2020-11-05 13:59   ` [bug#44433] [PATCH 2/3] gnu: z3: Update to 4.8.9 Martin Becze
2020-11-05 13:59   ` [bug#44433] [PATCH 3/3] gnu: Add solidity Martin Becze
2020-11-18  8:22     ` Christopher Baines [this message]
2020-11-16 22:56 ` [bug#44433] [PATCH 0/3] " Christopher Baines
2020-11-18  8:17   ` bug#44433: " Christopher Baines

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lfezkraz.fsf@cbaines.net \
    --to=mail@cbaines.net \
    --cc=44433@debbugs.gnu.org \
    --cc=mjbecze@riseup.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).