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(+)
@@ -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))))
@@ -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
Tobias Geerinckx-Rice 写道: > the attached patch