unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Tobias Geerinckx-Rice via Guix-patches via <guix-patches@gnu.org>
To: Vincent Legoll <vincent.legoll@gmail.com>
Cc: 45742@debbugs.gnu.org
Subject: [bug#45742] [PATCH] gnu: Add x86emu.
Date: Sat, 09 Jan 2021 16:51:21 +0100	[thread overview]
Message-ID: <871reu6rd2.fsf@nckx> (raw)
In-Reply-To: <874kjq6rgb.fsf@nckx>


[-- Attachment #1.1: Type: text/plain, Size: 57 bytes --]

Tobias Geerinckx-Rice 写道:
> the attached patch


[-- Attachment #1.2: 0001-gnu-Add-x86emu.patch --]
[-- Type: text/x-patch, Size: 4631 bytes --]

From 6a74a2447e0e1f624903d468376542d785558986 Mon Sep 17 00:00:00 2001
From: Vincent Legoll <vincent.legoll@gmail.com>
Date: Sat, 9 Jan 2021 15:30:38 +0100
Subject: [PATCH] gnu: Add x86emu.

* gnu/packages/emulators.scm (x86emu): New variable.

Signed-off-by: Tobias Geerinckx-Rice <me@tobias.gr>
---
 gnu/packages/emulators.scm | 62 ++++++++++++++++++++++++++++++++++++++
 gnu/packages/linux.scm     |  2 ++
 2 files changed, 64 insertions(+)

diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index 1d94090f48..785d464273 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2019 David Wilson <david@daviwil.com>
 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
 ;;; Copyright © 2020 Christopher Howard <christopher@librehacker.com>
+;;; Copyright © 2021 Vincent Legoll <vincent.legoll@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2236,3 +2237,64 @@ framework based on QEMU.")
      "PPSSPP is a ``high-level'' emulator simulating the PSP operating
 system.")
     (license license:gpl2+)))
+
+(define-public x86emu
+  (let ((revision "0")
+        (commit "cbc65a99d0f7d291b7c72444b8afa71649d214c4"))
+    (package
+      (name "x86emu")
+      (version (git-version "0.0.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/shift-crops/x86emu")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "16q69m5zb71pgwsw5w0ilkd0vqh0hrmgq10fqba3x604chb90a87"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f                      ; no tests
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'set-image-file-names
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (os  (string-append out "/share/x86emu")))
+               (substitute* "main.cpp"
+                 (("sample/kernel\\.img|bios/(bios|crt0)\\.bin" file)
+                  (string-append os "/" file)))
+               #t)))
+         (delete 'configure)            ; no configure script
+         (replace 'build
+           ;; Also build the ‘os’ target with kernel & BIOS images.
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (invoke "make" "all")))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin"))
+                    (os  (string-append out "/share/x86emu")))
+               (invoke "find")
+               (install-file "x86emu" bin)
+               (copy-recursively "include" (string-append out "/include"))
+               (for-each (lambda (file)
+                           (install-file file (string-append os "/bios")))
+                         (find-files "bios" "\\.bin$"))
+               (for-each (lambda (file)
+                           (install-file file (string-append os "/sample")))
+                         (find-files "sample" "\\.img$"))
+               #t))))))
+    (native-inputs
+     `(("nasm" ,nasm)))
+    (inputs
+     `(("glfw" ,glfw)))
+    (home-page "https://github.com/shift-crops/x86emu")
+    (synopsis "Simple x86 emulator")
+    (description
+     "x86emu is an emulator of the x86 architecture.  It supports multiple CPU
+modes (16- and 32-bit, real/protected) and some devices.  You can boot from a
+simulated floppy disk drive without DMA support and operate it with the mouse
+and keyboard.  The package includes a light-weight BIOS and kernel image.")
+    (license license:expat))))
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 6c2556e91a..449258ad50 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -74,6 +74,7 @@
   #:use-module (gnu packages acl)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages algebra)
+  #:use-module (gnu packages assembly)
   #:use-module (gnu packages audio)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages backup)
@@ -98,6 +99,7 @@
   #:use-module (gnu packages gawk)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages gettext)
+  #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages golang)
   #:use-module (gnu packages gperf)
-- 
2.30.0


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

  reply	other threads:[~2021-01-09 15:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-09 14:30 [bug#45742] [PATCH] gnu: Add x86emu Vincent Legoll
2021-01-09 14:40 ` Vincent Legoll
2021-01-09 15:49 ` Tobias Geerinckx-Rice via Guix-patches via
2021-01-09 15:51   ` Tobias Geerinckx-Rice via Guix-patches via [this message]
2021-01-09 16:15   ` pelzflorian (Florian Pelz)
2021-01-09 20:30     ` Tobias Geerinckx-Rice via Guix-patches via
2021-01-10 10:31       ` Vincent Legoll

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=871reu6rd2.fsf@nckx \
    --to=guix-patches@gnu.org \
    --cc=45742@debbugs.gnu.org \
    --cc=me@tobias.gr \
    --cc=vincent.legoll@gmail.com \
    /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).