gnu: Add emu8051

  • Done
  • quality assurance status badge
Details
4 participants
  • c4droid
  • ???
  • Bruno Victal
  • Simon South
Owner
unassigned
Submitted by
c4droid
Severity
normal
C
C
c4droid wrote on 21 Mar 2023 08:20
(address . guix-patches@gnu.org)
tencent_CB568361E6EB2AA4F49535FA0587ECA20707@qq.com
From 351280951b0ad515dc6b725dca51a986def1f93f Mon Sep 17 00:00:00 2001
From: c4droid <c4droid@foxmail.com>
Date: Tue, 21 Mar 2023 15:16:10 +0800
Subject: [PATCH] gnu: Add emu8051.

* gnu/packages/embedded.scm (emu8051): New variable.
---
gnu/packages/embedded.scm | 41 +++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)

Toggle diff (58 lines)
diff --git a/gnu/packages/embedded.scm b/gnu/packages/embedded.scm
index 8d854c7..50658e4 100644
--- a/gnu/packages/embedded.scm
+++ b/gnu/packages/embedded.scm
@@ -12,6 +12,7 @@
;;; Copyright © 2021 Morgan Smith <Morgan.J.Smith@outlook.com>
;;; Copyright © 2022 Mathieu Othacehe <othacehe@gnu.org>
;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2023 c4droid <c4droid@foxmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1747,3 +1748,43 @@ (define-public ts4900-utils
@item tssilomon
@end itemize")
(license license:bsd-2))))
+
+(define-public emu8051
+ (let ((commit "5dc681275151c4a5d7b85ec9ff4ceb1b25abd5a8")
+ (revision "1"))
+ (package
+ (name "emu8051")
+ (version (git-version "0.1" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/jarikomppa/emu8051")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1xxmkcwvd5fjnhwbricafg4xvxvr8dxhfanyfp4rbksw37dgk2fx"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:tests? #f ;No test suite
+ #:make-flags (list (string-append "CC="
+ ,(cc-for-target)))
+ #:phases (modify-phases %standard-phases
+ (delete 'configure) ;No ./configure script
+ (add-before 'build 'patch-ncurses
+ ;; Replace LDFLAGS -lcurses to -lncurses
+ (lambda* _
+ (substitute* "Makefile"
+ (("-lcurses")
+ "-lncurses"))))
+ (replace 'install
+ ;; No installation procedure
+ (lambda _
+ (install-file "emu"
+ (string-append (assoc-ref %outputs "out")
+ "/bin")))))))
+ (inputs (list ncurses))
+ (home-page "https://github.comjarikomppa/emu8051")
+ (synopsis "8051/8052 emulator with curses-based UI")
+ (description "emu8051 is a simulator of the 8051/8052 microcontrollers.")
+ (license license:expat))))
--
2.39.2
B
B
Bruno Victal wrote on 21 Mar 2023 14:43
(name . c4droid)(address . c4droid@foxmail.com)(address . 62324@debbugs.gnu.org)
6ad8a739-992c-e578-ea8f-76e762f70c42@makinata.eu
Hi,

On 2023-03-21 07:20, c4droid wrote:
Toggle quote (14 lines)
>
> + (arguments
> + `(#:tests? #f ;No test suite
> + #:make-flags (list (string-append "CC="
> + ,(cc-for-target)))
> + #:phases (modify-phases %standard-phases
> + (delete 'configure) ;No ./configure script
> + (add-before 'build 'patch-ncurses
> + ;; Replace LDFLAGS -lcurses to -lncurses
> + (lambda* _
> + (substitute* "Makefile"
> + (("-lcurses")
> + "-lncurses"))))

How about turning this 'patch-ncurses phase into a patch snippet instead? i.e.

(source
(origin
(method ...)
...
(modules '((guix build utils)))
(snippet
#~(begin
;; Replace LDFLAGS -lcurses to -lncurses
(substitute* "Makefile"
(("-lcurses") "-lncurses"))))))

[...]

Toggle quote (7 lines)
> + (replace 'install
> + ;; No installation procedure
> + (lambda _
> + (install-file "emu"
> + (string-append (assoc-ref %outputs "out")
> + "/bin")))))))

Use G-Expressions here, i.e.

(arguments
(list
#:tests? #f ;No test suite
#:make-flags #~(list ...)
#:phases
#~(modify-phases ...
...
(replace 'install
(lambda _
(install-file "emu" (string-append #$output "/bin")))))))


Cheers,
Bruno
S
S
Simon South wrote on 21 Mar 2023 15:47
(name . c4droid)(address . c4droid@foxmail.com)(address . 62324@debbugs.gnu.org)
87h6uejh44.fsf@simonsouth.net
c4droid <c4droid@foxmail.com> writes:
Toggle quote (2 lines)
This URL appears to be missing a forward slash.

--
Simon South
simon@simonsouth.net
C
C
c4droid wrote on 22 Mar 2023 01:53
(name . Bruno Victal)(address . mirai@makinata.eu)(address . 62324@debbugs.gnu.org)
tencent_88A81461B1E20F335E3B2061AF50D0CB380A@qq.com
Hi, Bruno

Bruno Victal <mirai@makinata.eu> writes:

Toggle quote (20 lines)
> Hi,
>
> On 2023-03-21 07:20, c4droid wrote:
>>
>> + (arguments
>> + `(#:tests? #f ;No test suite
>> + #:make-flags (list (string-append "CC="
>> + ,(cc-for-target)))
>> + #:phases (modify-phases %standard-phases
>> + (delete 'configure) ;No ./configure script
>> + (add-before 'build 'patch-ncurses
>> + ;; Replace LDFLAGS -lcurses to -lncurses
>> + (lambda* _
>> + (substitute* "Makefile"
>> + (("-lcurses")
>> + "-lncurses"))))
>
> How about turning this 'patch-ncurses phase into a patch snippet instead? i.e.
>

I'll change it later, thanks for the hints.

Toggle quote (36 lines)
> (source
> (origin
> (method ...)
> ...
> (modules '((guix build utils)))
> (snippet
> #~(begin
> ;; Replace LDFLAGS -lcurses to -lncurses
> (substitute* "Makefile"
> (("-lcurses") "-lncurses"))))))
>
> [...]
>
>> + (replace 'install
>> + ;; No installation procedure
>> + (lambda _
>> + (install-file "emu"
>> + (string-append (assoc-ref %outputs "out")
>> + "/bin")))))))
>
> Use G-Expressions here, i.e.
>
> (arguments
> (list
> #:tests? #f ;No test suite
> #:make-flags #~(list ...)
> #:phases
> #~(modify-phases ...
> ...
> (replace 'install
> (lambda _
> (install-file "emu" (string-append #$output "/bin")))))))
>
>
> Cheers,
> Bruno
C
C
c4droid wrote on 22 Mar 2023 01:56
(name . Simon South)(address . simon@simonsouth.net)(address . 62324@debbugs.gnu.org)
tencent_70C04A353DA94340D11DEBFE70D5F5091206@qq.com
I'll fix it in new patch, my typo fault.

Simon South <simon@simonsouth.net> writes:

Toggle quote (4 lines)
> c4droid <c4droid@foxmail.com> writes:
>> (home-page "https://github.comjarikomppa/emu8051")
>
> This URL appears to be missing a forward slash.
C
C
c4droid wrote on 22 Mar 2023 02:48
(name . Bruno Victal)(address . mirai@makinata.eu)(address . 62324@debbugs.gnu.org)
tencent_9EBA176964C58B7EDD21BDE88D356F78E905@qq.com
Hi, Bruno

Bruno Victal <mirai@makinata.eu> writes:

Toggle quote (18 lines)
> Hi,
>
> On 2023-03-21 07:20, c4droid wrote:
>>
>> + (arguments
>> + `(#:tests? #f ;No test suite
>> + #:make-flags (list (string-append "CC="
>> + ,(cc-for-target)))
>> + #:phases (modify-phases %standard-phases
>> + (delete 'configure) ;No ./configure script
>> + (add-before 'build 'patch-ncurses
>> + ;; Replace LDFLAGS -lcurses to -lncurses
>> + (lambda* _
>> + (substitute* "Makefile"
>> + (("-lcurses")
>> + "-lncurses"))))
>

The modules and snippet field can be apply to build derivation

Toggle quote (23 lines)
> How about turning this 'patch-ncurses phase into a patch snippet instead? i.e.
>
> (source
> (origin
> (method ...)
> ...
> (modules '((guix build utils)))
> (snippet
> #~(begin
> ;; Replace LDFLAGS -lcurses to -lncurses
> (substitute* "Makefile"
> (("-lcurses") "-lncurses"))))))
>
> [...]
>
>> + (replace 'install
>> + ;; No installation procedure
>> + (lambda _
>> + (install-file "emu"
>> + (string-append (assoc-ref %outputs "out")
>> + "/bin")))))))
>

But here, I used G-Expressions here, report gexp is unbound variable.

Toggle quote (16 lines)
> Use G-Expressions here, i.e.
>
> (arguments
> (list
> #:tests? #f ;No test suite
> #:make-flags #~(list ...)
> #:phases
> #~(modify-phases ...
> ...
> (replace 'install
> (lambda _
> (install-file "emu" (string-append #$output "/bin")))))))
>
>
> Cheers,
> Bruno
C
C
c4droid wrote on 22 Mar 2023 02:58
[PATCH 0/1] gnu: emu8051: Using snippet to replace patch-ncurses phases
(address . 62324@debbugs.gnu.org)
tencent_2DC375D7AA482B2B12F4540ED0454BAC6D08@qq.com
Replace patch-ncurses phases with snippet field.
From 8f4aeb1d2f99b87ced20242cff6ed282649243d4 Mon Sep 17 00:00:00 2001
From: c4droid <c4droid@foxmail.com>
Date: Wed, 22 Mar 2023 09:57:13 +0800
Subject: [PATCH] gnu: emu8051: Using snippet to replace patch-ncurses phases

---
gnu/packages/embedded.scm | 35 +++++++++++++++++------------------
1 file changed, 17 insertions(+), 18 deletions(-)

Toggle diff (52 lines)
diff --git a/gnu/packages/embedded.scm b/gnu/packages/embedded.scm
index 50658e4..fdf950f 100644
--- a/gnu/packages/embedded.scm
+++ b/gnu/packages/embedded.scm
@@ -1763,28 +1763,27 @@ (define-public emu8051
(file-name (git-file-name name version))
(sha256
(base32
- "1xxmkcwvd5fjnhwbricafg4xvxvr8dxhfanyfp4rbksw37dgk2fx"))))
+ "1xxmkcwvd5fjnhwbricafg4xvxvr8dxhfanyfp4rbksw37dgk2fx"))
+ (modules '((guix build utils)))
+ (snippet
+ #~(begin
+ ;; Replace LDFLAGS -lcurses to -lncurses
+ (substitute* "Makefile"
+ (("-lcurses") "-lncurses"))))))
(build-system gnu-build-system)
(arguments
`(#:tests? #f ;No test suite
- #:make-flags (list (string-append "CC="
- ,(cc-for-target)))
- #:phases (modify-phases %standard-phases
- (delete 'configure) ;No ./configure script
- (add-before 'build 'patch-ncurses
- ;; Replace LDFLAGS -lcurses to -lncurses
- (lambda* _
- (substitute* "Makefile"
- (("-lcurses")
- "-lncurses"))))
- (replace 'install
- ;; No installation procedure
- (lambda _
- (install-file "emu"
- (string-append (assoc-ref %outputs "out")
- "/bin")))))))
+ #:make-flags #~(list (string-append "CC="
+ ,(cc-for-target)))
+ #:phases #~(modify-phases %standard-phases
+ (delete 'configure) ;No ./configure script
+ (replace 'install
+ ;; No installation procedure
+ (lambda _
+ (install-file "emu"
+ (string-append #$output "/bin")))))))
(inputs (list ncurses))
- (home-page "https://github.comjarikomppa/emu8051")
+ (home-page "https://github.com/jarikomppa/emu8051")
(synopsis "8051/8052 emulator with curses-based UI")
(description "emu8051 is a simulator of the 8051/8052 microcontrollers.")
(license license:expat))))
--
2.39.2
When changing install phases with gexp, report: Unbound variables: gexp
B
B
Bruno Victal wrote on 22 Mar 2023 03:13
(name . c4droid)(address . c4droid@foxmail.com)(address . 62324@debbugs.gnu.org)
a1e8423b-68f3-4bb2-1a7e-fae6aa2e582b@makinata.eu
On 2023-03-22 01:58, c4droid wrote:
Toggle quote (9 lines)
> (build-system gnu-build-system)
> (arguments
> `(#:tests? #f ;No test suite
> - #:make-flags (list (string-append "CC="
> - ,(cc-for-target)))
> - #:phases (modify-phases %standard-phases
> - (delete 'configure) ;No ./configure script
> - (add-before 'build 'patch-ncurs

(arguments
(list
#:tests? #f ;No test suite
#:make-flags #~(list (string-append "CC=" (cc-for-target)))
.....


Note that I'm not using quasiquote here.


Cheers,
Bruno
C
C
c4droid wrote on 22 Mar 2023 08:43
[PATCH 1/1] gnu: emu8051: Fix build error for quasiquote
(address . 62324@debbugs.gnu.org)
tencent_AD0F275F53211DAC34D30F3B681719B16A0A@qq.com
Here is final patch for emu8051 packages, it fix previous patches error.
From 83dfc323e2439e6a89079054eb47d439b81d01ce Mon Sep 17 00:00:00 2001
From: c4droid <c4droid@foxmail.com>
Date: Wed, 22 Mar 2023 15:42:09 +0800
Subject: [PATCH] gnu: emu8051: Fix build error for quasiquote

---
gnu/packages/embedded.scm | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)

Toggle diff (47 lines)
diff --git a/gnu/packages/embedded.scm b/gnu/packages/embedded.scm
index fdf950f..514c20f 100644
--- a/gnu/packages/embedded.scm
+++ b/gnu/packages/embedded.scm
@@ -1764,24 +1764,24 @@ (define-public emu8051
(sha256
(base32
"1xxmkcwvd5fjnhwbricafg4xvxvr8dxhfanyfp4rbksw37dgk2fx"))
- (modules '((guix build utils)))
- (snippet
- #~(begin
- ;; Replace LDFLAGS -lcurses to -lncurses
- (substitute* "Makefile"
- (("-lcurses") "-lncurses"))))))
+ (modules '((guix build utils)))
+ (snippet #~(begin
+ ;; Replace LDFLAGS -lcurses to -lncurses
+ (substitute* "Makefile"
+ (("-lcurses")
+ "-lncurses"))))))
(build-system gnu-build-system)
(arguments
- `(#:tests? #f ;No test suite
- #:make-flags #~(list (string-append "CC="
- ,(cc-for-target)))
- #:phases #~(modify-phases %standard-phases
- (delete 'configure) ;No ./configure script
- (replace 'install
- ;; No installation procedure
- (lambda _
- (install-file "emu"
- (string-append #$output "/bin")))))))
+ (list #:tests? #f ;No test suite
+ #:make-flags #~(list (string-append "CC="
+ #$(cc-for-target)))
+ #:phases #~(modify-phases %standard-phases
+ (delete 'configure) ;No ./configure script
+ (replace 'install
+ ;; No installation procedure
+ (lambda _
+ (install-file "emu"
+ (string-append #$output "/bin")))))))
(inputs (list ncurses))
(home-page "https://github.com/jarikomppa/emu8051")
(synopsis "8051/8052 emulator with curses-based UI")
--
2.39.2
?
Re: bug#62324: gnu: Add emu8051
(name . c4droid)(address . c4droid@foxmail.com)(address . 62324@debbugs.gnu.org)
87jzyyh0cd.fsf_-_@envs.net
c4droid <c4droid@foxmail.com> writes:

Toggle quote (2 lines)
> Here is final patch for emu8051 packages, it fix previous patches error.

Hello, this patch is based upon your previous emu8051 patch, could you merge
them into one patch? Which should be a '[PATCH] gnu: Add emu8051.'.

Thank you!
C
C
c4droid wrote on 31 Mar 2023 08:48
[PATCH] gnu: Add emu8051.
(address . 62324@debbugs.gnu.org)
tencent_DC0C1B5DF72049AE04D2D339F0178DB1C60A@qq.com
From a9f8f4e71dc5270ab7cbfd6da74a3fc7b304e5b6 Mon Sep 17 00:00:00 2001
From: c4droid <c4droid@foxmail.com>
Date: Fri, 31 Mar 2023 14:46:50 +0800
Subject: [PATCH] [PATCH] gnu: Add emu8051.

---
gnu/packages/embedded.scm | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)

Toggle diff (56 lines)
diff --git a/gnu/packages/embedded.scm b/gnu/packages/embedded.scm
index 8d854c7..653e02a 100644
--- a/gnu/packages/embedded.scm
+++ b/gnu/packages/embedded.scm
@@ -12,6 +12,7 @@
;;; Copyright © 2021 Morgan Smith <Morgan.J.Smith@outlook.com>
;;; Copyright © 2022 Mathieu Othacehe <othacehe@gnu.org>
;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2023 c4droid <c4droid@foxmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1747,3 +1748,41 @@ (define-public ts4900-utils
@item tssilomon
@end itemize")
(license license:bsd-2))))
+
+(define-public emu8051
+ (let ((commit "5dc681275151c4a5d7b85ec9ff4ceb1b25abd5a8")
+ (revision "1"))
+ (package
+ (name "emu8051")
+ (version (git-version "0.1" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/jarikomppa/emu8051")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1xxmkcwvd5fjnhwbricafg4xvxvr8dxhfanyfp4rbksw37dgk2fx"))
+ (modules '((guix build utils)))
+ (snippet #~(begin
+ ;; Replace LDFLAGS -lcurses to -lncurses
+ (substitute* "Makefile"
+ (("-lcurses") "-lncurses"))))))
+ (build-system gnu-build-system)
+ (arguments
+ (list #:tests? #f ;No test suite
+ #:make-flags #~(list (string-append "CC="
+ #$(cc-for-target)))
+ #:phases #~(modify-phases %standard-phases
+ (delete 'configure) ;No ./configure script
+ (replace 'install
+ ;; No installation procedure
+ (lambda _
+ (install-file "emu"
+ (string-append #$output "/bin")))))))
+ (inputs (list ncurses))
+ (home-page "https://github.comjarikomppa/emu8051")
+ (synopsis "8051/8052 emulator with curses-based UI")
+ (description "emu8051 is a simulator of the 8051/8052 microcontrollers.")
+ (license license:expat))))
--
2.39.2
I
I
iyzsong wrote on 31 Mar 2023 13:22
[PATCH v2] gnu: Add emu8051.
(address . 62324@debbugs.gnu.org)
20230331112204.2427-1-iyzsong@envs.net
From: c4droid <c4droid@foxmail.com>

* gnu/packages/emulator.scm (emu8051): New variable.

Reviewed-by: ??? <iyzsong@member.fsf.org>
---
gnu/packages/emulators.scm | 40 ++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)

Toggle diff (57 lines)
diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index 166c3b4ec6..7e73b217ea 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -17,6 +17,7 @@
;;; Copyright © 2021 Felix Gruber <felgru@posteo.net>
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
+;;; Copyright © 2023 c4droid <c4droid@foxmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -2580,3 +2581,42 @@ (define-public uxn
"This package provides an assembler and emulator for the Uxn
stack-machine, written in ANSI C. Graphical output is implemented using SDL2.")
(license license:expat))))
+
+(define-public emu8051
+ (let ((commit "5dc681275151c4a5d7b85ec9ff4ceb1b25abd5a8")
+ (revision "1"))
+ (package
+ (name "emu8051")
+ (version (git-version "0.1" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/jarikomppa/emu8051")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1xxmkcwvd5fjnhwbricafg4xvxvr8dxhfanyfp4rbksw37dgk2fx"))
+ (modules '((guix build utils)))
+ (snippet #~(begin
+ ;; Replace LDFLAGS -lcurses to -lncurses
+ (substitute* "Makefile"
+ (("-lcurses") "-lncurses"))))))
+ (build-system gnu-build-system)
+ (arguments
+ (list #:tests? #f ;No test suite
+ #:make-flags #~(list (string-append "CC="
+ #$(cc-for-target)))
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'configure) ;No ./configure script
+ (replace 'install
+ ;; No installation procedure
+ (lambda _
+ (install-file "emu"
+ (string-append #$output "/bin")))))))
+ (inputs (list ncurses))
+ (home-page "https://github.com/jarikomppa/emu8051")
+ (synopsis "8051/8052 emulator with curses-based UI")
+ (description "emu8051 is a simulator of the 8051/8052 microcontrollers.")
+ (license license:expat))))
--
2.39.2
?
Re: bug#62324: gnu: Add emu8051
(name . c4droid)(address . c4droid@foxmail.com)(address . 62324-done@debbugs.gnu.org)
874jq1xihu.fsf_-_@envs.net
c4droid <c4droid@foxmail.com> writes:

Toggle quote (9 lines)
>>From a9f8f4e71dc5270ab7cbfd6da74a3fc7b304e5b6 Mon Sep 17 00:00:00 2001
> From: c4droid <c4droid@foxmail.com>
> Date: Fri, 31 Mar 2023 14:46:50 +0800
> Subject: [PATCH] [PATCH] gnu: Add emu8051.
>
> ---
> gnu/packages/embedded.scm | 39 +++++++++++++++++++++++++++++++++++++++
> 1 file changed, 39 insertions(+)

Hello, I think emu8051 should go to emulators.scm, it seems embedded.scm
are for tools working with real hardwares, while emulators.scm has
similiar packages like qtmips.

I have send an updated patch to move it into emulators.scm, also fixed
home-page, and add commit message for file changes:

* gnu/packages/emulator.scm (emu8051): New variable.

Though I just nocited it should be emulators.scm (emu8051)..

Well, I decide to push now, thank you for the patch and reviewers for
the feedbacks!
Closed
B
B
Bruno Victal wrote on 4 Apr 2023 15:31
control-msg
(name . control)(address . control@debbugs.gnu.org)
b1c28681-d877-2cdd-db09-0895fa9a8a72@makinata.eu
tags 62324 patch
tags 61462 patch
tags 60788 - pending
tags 59971 wishlist
tags 51737 patch

tags 62624 + security
tags 49817 + security

# resend control-msg
close 37740


quit
?