[bug#78059,electronics-team] gnu: Add abc-yosyshq.

Message ID 1f03c394302b446798f46d1e1495ca1367a7cdb4.1745585324.git.csantosb@inventati.org
State New
Headers
Series [bug#78059,electronics-team] gnu: Add abc-yosyshq. |

Commit Message

Cayetano Santos April 25, 2025, 12:48 p.m. UTC
* gnu/packages/fpga.scm (abc-yosyshq): New variable.

https://github.com/YosysHQ/abc is a fork of berkeley abc, used by all
yosyshq projects (yosys, etc.).

Change-Id: I46649e3722ded3faf8c0993d7bebaf649e6297c6
---

There are (at least) two versions of abc:

- https://github.com/berkeley-abc/abc, from berkely, that we currently package
- https://github.com/YosysHQ/abc, a fork by yosyshq

Yosys and remaining yosyshq software we package uses the later, while we are using the former. This produces errors in tests. We need then to package yosyshq version so that we may use it with all of their packages.

 gnu/packages/fpga.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)


base-commit: 501a9603f5e3cda07f3be8e7fecac31f7af5ce52
--
2.49.0
  

Comments

Maxim Cournoyer May 2, 2025, 7:03 a.m. UTC | #1
Hi Cayetano,,

Cayetano Santos <csantosb@inventati.org> writes:

> * gnu/packages/fpga.scm (abc-yosyshq): New variable.
>
> https://github.com/YosysHQ/abc is a fork of berkeley abc, used by all
> yosyshq projects (yosys, etc.).

[...]

> +(define-public abc-yosyshq
> +  (package
> +    (name "abc-yosyshq")
> +    (version "0.52")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url "https://github.com/YosysHQ/abc/")
> +                    (commit (string-append "v" version))))
> +              (file-name (git-file-name name version))
> +              (sha256
> +               (base32
> +                "15a7nyk8iqpadp326icnr7rn5pwq44b9lvajqc35hcsvixz4gxsa"))))
> +    (build-system gnu-build-system)
> +    (inputs
> +     (list readline))
> +    (arguments
> +     (list
> +      #:license-file-regexp "copyright.txt"
> +      #:tests? #f ; no tests
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (delete 'configure)
> +          (replace 'install
> +            (lambda _
> +              (install-file "abc" (string-append #$output "/bin")))))))
> +    (home-page "https://github.com/YosysHQ/abc/")
> +    (synopsis "Sequential logic synthesis and formal verification")
> +    (description "ABC is a program for sequential logic synthesis and
> +formal verification.")
> +    (license
> +     (license:non-copyleft
> +      "https://people.eecs.berkeley.edu/~alanmi/abc/copyright.htm"))))

Since that's almost a 1:1 copy of the original definition, inheritance
is most appropriate:

--8<---------------cut here---------------start------------->8---
modified   gnu/packages/fpga.scm
@@ -118,6 +118,24 @@ (define-public abc
        (license:non-copyleft
         "https://people.eecs.berkeley.edu/~alanmi/abc/copyright.htm")))))
 
+(define-public abc-yosyshq
+  (package
+    (inherit abc)
+    (name "abc-yosyshq")
+    (version "0.52")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/YosysHQ/abc/")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "15a7nyk8iqpadp326icnr7rn5pwq44b9lvajqc35hcsvixz4gxsa"))))
+    (home-page "https://github.com/YosysHQ/abc/")
+    (description "ABC is a program for sequential logic synthesis and
+formal verification.  This is the Yosyshq fork of ABC.")))
+
 (define-public iverilog
   (package
     (name "iverilog")
@@ -158,40 +176,6 @@ (define-public iverilog
     ;; You have to accept both GPL2 and LGPL2.1+.
     (license (list license:gpl2 license:lgpl2.1+))))
 
-(define-public abc-yosyshq
-  (package
-    (name "abc-yosyshq")
-    (version "0.52")
-    (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url "https://github.com/YosysHQ/abc/")
-                    (commit (string-append "v" version))))
-              (file-name (git-file-name name version))
-              (sha256
-               (base32
-                "15a7nyk8iqpadp326icnr7rn5pwq44b9lvajqc35hcsvixz4gxsa"))))
-    (build-system gnu-build-system)
-    (inputs
-     (list readline))
-    (arguments
-     (list
-      #:license-file-regexp "copyright.txt"
-      #:tests? #f ; no tests
-      #:phases
-      #~(modify-phases %standard-phases
-          (delete 'configure)
-          (replace 'install
-            (lambda _
-              (install-file "abc" (string-append #$output "/bin")))))))
-    (home-page "https://github.com/YosysHQ/abc/")
-    (synopsis "Sequential logic synthesis and formal verification")
-    (description "ABC is a program for sequential logic synthesis and
-formal verification.")
-    (license
-     (license:non-copyleft
-      "https://people.eecs.berkeley.edu/~alanmi/abc/copyright.htm"))))
-
 (define-public yosys
   (package
     (name "yosys")
--8<---------------cut here---------------end--------------->8---

Unfortunately, reading the README to see if I could expound the
description a bit with the fork's extra features, I read:

--8<---------------cut here---------------start------------->8--- The
source code is provided for research and evaluation only. For commercial
usage, please contact Prof. Chang Wu at wuchang@fudan.edu.cn.
--8<---------------cut here---------------end--------------->8---

So, sadly, it seems this fork is derived from another fork which
contains non-free additions... and that's a valid thing to do because of
the permissive license of the original work.

It sucks, but it looks like we won't be able to carry this in our
repository.  It should probably be reported to the yosys project, but it
seems the bug tracker is disabled on their github repo.  I'll let you do
it if you don't mind.
  
Cayetano Santos May 2, 2025, 8:40 a.m. UTC | #2
>ven. 02 mai 2025 at 16:03, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:

> So, sadly, it seems this fork is derived from another fork which
> contains non-free additions... and that's a valid thing to do because of
> the permissive license of the original work.
>
> It sucks, but it looks like we won't be able to carry this in our
> repository.

Notice that we already package in Guix the original abc code from
Berkeley, also for research and evaluation only, see "gnu packages fpga"
module. And this is the abc used by yosys and yosys-clang, both in the
same module.

C.
  
Cayetano Santos May 2, 2025, 10:13 a.m. UTC | #3
Ok, so after asking people on YosysHq, we have this situation:

- berkeley-abc/abc :: original project; the one currently packaged in
  guix, licensed under:

    https://people.eecs.berkeley.edu/~alanmi/abc/copyright.htm

- YosysHQ/abc :: fork of the original; licensed under

    https://github.com/YosysHQ/abc/blob/yosys-experimental/copyright.txt

- yongshiwo/abc :: fork of the original, including new Agdmap; only in
  this case the "for research and evaluation only" applies

Current patch concerns YosysHQ/abc version above.

C.
  
Maxim Cournoyer May 2, 2025, 12:48 p.m. UTC | #4
Hi Cayetano,

Cayetano Santos <csantosb@inventati.org> writes:

>>ven. 02 mai 2025 at 16:03, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:
>
>> So, sadly, it seems this fork is derived from another fork which
>> contains non-free additions... and that's a valid thing to do because of
>> the permissive license of the original work.
>>
>> It sucks, but it looks like we won't be able to carry this in our
>> repository.
>
> Notice that we already package in Guix the original abc code from
> Berkeley, also for research and evaluation only, see "gnu packages fpga"
> module. And this is the abc used by yosys and yosys-clang, both in the
> same module.

Thanks for pointing this; I thought that wording was something new
introduced in a fork, but you are correct, it's been there all along.
I've done due diligence, and found that Debian carries the same
source/package as part of their 'yosys' source package [0], and it had
been added in 2015 in the Free Software Directory [1]

I've now pushed a reworked version in 64ab31870c6.  Curiously, the test
suite of symbiyosys still fails if I comment out the phase disabling the
problematic tests.  Could you take a look?

[0]  https://metadata.ftp-master.debian.org/changelogs//main/y/yosys/yosys_0.52-1_copyright
[1]  https://directory.fsf.org/wiki/ABC#tab=Details
  
Cayetano Santos May 2, 2025, 2:31 p.m. UTC | #5
>ven. 02 mai 2025 at 21:48, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:

> I've now pushed a reworked version in 64ab31870c6.  Curiously, the test
> suite of symbiyosys still fails if I comment out the phase disabling the
> problematic tests.  Could you take a look?

Sure. We first need to fix Yosys itself, see #78214; then, we’ll proceed
similarly with Symbiyosys.

C.
  

Patch

diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index e1043efc48..a98bca8578 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -156,6 +156,40 @@  (define-public iverilog
     ;; You have to accept both GPL2 and LGPL2.1+.
     (license (list license:gpl2 license:lgpl2.1+))))
 
+(define-public abc-yosyshq
+  (package
+    (name "abc-yosyshq")
+    (version "0.52")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/YosysHQ/abc/")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "15a7nyk8iqpadp326icnr7rn5pwq44b9lvajqc35hcsvixz4gxsa"))))
+    (build-system gnu-build-system)
+    (inputs
+     (list readline))
+    (arguments
+     (list
+      #:license-file-regexp "copyright.txt"
+      #:tests? #f ; no tests
+      #:phases
+      #~(modify-phases %standard-phases
+          (delete 'configure)
+          (replace 'install
+            (lambda _
+              (install-file "abc" (string-append #$output "/bin")))))))
+    (home-page "https://github.com/YosysHQ/abc/")
+    (synopsis "Sequential logic synthesis and formal verification")
+    (description "ABC is a program for sequential logic synthesis and
+formal verification.")
+    (license
+     (license:non-copyleft
+      "https://people.eecs.berkeley.edu/~alanmi/abc/copyright.htm"))))
+
 (define-public yosys
   (package
     (name "yosys")