* [bug#40084] [PATCH] gnu: Add v86d.
@ 2020-03-15 21:48 Florian Pelz
2020-03-19 14:49 ` Jakub Kądziołka
0 siblings, 1 reply; 3+ messages in thread
From: Florian Pelz @ 2020-03-15 21:48 UTC (permalink / raw)
To: 40084; +Cc: Florian Pelz
* gnu/packages/xorg.scm (v86d): New variable.
---
gnu/packages/xorg.scm | 109 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 109 insertions(+)
diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm
index f951e565ff..be381adc43 100644
--- a/gnu/packages/xorg.scm
+++ b/gnu/packages/xorg.scm
@@ -21,6 +21,7 @@
;;; Copyright © 2019 nee <nee@cock.li>
;;; Copyright © 2019 Yoshinori Arai <kumagusu08@gmail.com>
;;; Copyright © 2020 Leo Prikler <leo.prikler@student.tugraz.at>
+;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -3446,6 +3447,114 @@ X server.")
X server.")
(license license:x11)))
+(define-public v86d
+ (package
+ (name "v86d")
+ (version "0.1.10")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/mjanusz/v86d.git")
+ (commit (string-append name "-" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1c4iiggb5r9i2hxhk8c6q1m2vpfva39l1w33fsfkrz6fav6x34pp"))
+ (modules '((guix build utils)))
+ (snippet
+ '(begin
+ ;; remove bundled x86emu
+ (for-each delete-file
+ (filter (lambda (name) ;keep customized Makefile
+ (not (string-suffix? "Makefile" name)))
+ (find-files "libs/x86emu")))
+ ;; remove non-working vbetest utility program (it is unnecessary)
+ (delete-file "libs/lrmi-0.10/vbe.h")
+ (delete-file "libs/lrmi-0.10/vbetest.c")
+ #t))))
+
+ ;; We keep the bundled copy of the Linux Real Mode Interface lrmi-0.10,
+ ;; because it includes fixes missing from upstream lrmi. We do not use
+ ;; libx86, because we already use x86emu with the more current lrmi.
+
+ (inputs `(("xorg-server-sources" ,(package-source xorg-server)) ;for x86emu
+ ("xorgproto" ,xorgproto))) ;upstream x86emu uses X11/Xfuncproto.h
+ (outputs '("out" ;main v86d helper
+ "testvbe")) ;test program for listing video modes
+ (supported-systems '("i686-linux" "x86_64-linux"))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:tests? #f ;there are no tests
+ #:modules ((guix build utils)
+ (guix build gnu-build-system)
+ (ice-9 popen))
+ #:phases
+ (modify-phases %standard-phases
+ ;; Replace the bundled x86emu with its upstream copy from Xorg-server:
+ (add-after 'unpack 'unpack-x86emu-sources
+ (lambda* (#:key inputs #:allow-other-keys)
+ (begin
+ (format #t "decompressing x86emu source code~%")
+ (with-directory-excursion "libs"
+ (call-with-output-file "xorg-server.tar"
+ (lambda (out)
+ (let* ((xz (assoc-ref inputs "xz"))
+ (srcs (assoc-ref inputs "xorg-server-sources"))
+ (pipe (open-pipe* OPEN_READ
+ (string-append xz "/bin/xz")
+ "-cd" srcs)))
+ (dump-port pipe out)
+ (unless (= (status:exit-val (close-pipe pipe)) 0)
+ (error "xz decompress failed")))))
+ (invoke (string-append (assoc-ref inputs "tar") "/bin/tar")
+ "xvf" "xorg-server.tar" "--strip-components=3"
+ "--wildcards" "*/hw/xfree86/x86emu/")
+ ;; extract license:
+ (with-directory-excursion "x86emu"
+ (invoke (string-append (assoc-ref inputs "tar") "/bin/tar")
+ "xvf" "../xorg-server.tar" "--strip-components=1"
+ "--wildcards" "*/COPYING"))
+ (delete-file "xorg-server.tar")
+ #t))))
+ (replace 'configure
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (setenv "CC" (which "gcc"))
+ (setenv "DESTDIR" out)
+ (invoke "./configure" "--with-x86emu"))))
+ (add-after 'build 'build-testvbe
+ (lambda _
+ (invoke "make" "testvbe")))
+ (add-after 'install 'install-testvbe
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((testvbe (assoc-ref outputs "testvbe"))
+ (olddest (getenv "DESTDIR")))
+ (setenv "DESTDIR" testvbe)
+ (invoke "make" "install_testvbe")
+ (setenv "DESTDIR" olddest))))
+ (add-after 'install 'install-docs
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (doc-dir (string-append out "/share/doc/v86d")))
+ (mkdir-p doc-dir)
+ (copy-file "README"
+ (string-append doc-dir "/README"))
+ (copy-file "libs/lrmi-0.10/README"
+ (string-append doc-dir "/README.lrmi"))
+ (copy-file "libs/x86emu/COPYING"
+ (string-append doc-dir "/COPYING.xorg-server.x86emu"))
+ #t))))))
+ (home-page "https://github.com/mjanusz/v86d")
+ (synopsis "Userspace helper for uvesafb")
+ (description
+ "v86d provides a backend for kernel drivers that need to execute x86 BIOS
+code. The code is executed in a controlled environment and the results are
+passed back to the kernel via the netlink interface. v86d is required by the
+uvesafb Linux kernel module that provides an fbdev framebuffer when Kernel
+Mode Setting is unavailable. It can be a last resort when no other Xorg X
+server driver works.")
+ (license (list license:gpl2
+ license:x11)))) ;for bundled lrmi and x86emu
(define-public xf86-video-vmware
(package
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [bug#40084] [PATCH] gnu: Add v86d.
2020-03-15 21:48 [bug#40084] [PATCH] gnu: Add v86d Florian Pelz
@ 2020-03-19 14:49 ` Jakub Kądziołka
2020-03-20 8:40 ` pelzflorian (Florian Pelz)
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kądziołka @ 2020-03-19 14:49 UTC (permalink / raw)
To: Florian Pelz; +Cc: 40084
[-- Attachment #1: Type: text/plain, Size: 3748 bytes --]
On Sun, Mar 15, 2020 at 10:48:51PM +0100, Florian Pelz wrote:
> + ;; Replace the bundled x86emu with its upstream copy from Xorg-server:
> + (add-after 'unpack 'unpack-x86emu-sources
> + (lambda* (#:key inputs #:allow-other-keys)
> + (begin
> + (format #t "decompressing x86emu source code~%")
> + (with-directory-excursion "libs"
> + (call-with-output-file "xorg-server.tar"
> + (lambda (out)
> + (let* ((xz (assoc-ref inputs "xz"))
> + (srcs (assoc-ref inputs "xorg-server-sources"))
> + (pipe (open-pipe* OPEN_READ
> + (string-append xz "/bin/xz")
> + "-cd" srcs)))
> + (dump-port pipe out)
> + (unless (= (status:exit-val (close-pipe pipe)) 0)
> + (error "xz decompress failed")))))
> + (invoke (string-append (assoc-ref inputs "tar") "/bin/tar")
> + "xvf" "xorg-server.tar" "--strip-components=3"
> + "--wildcards" "*/hw/xfree86/x86emu/")
> + ;; extract license:
> + (with-directory-excursion "x86emu"
> + (invoke (string-append (assoc-ref inputs "tar") "/bin/tar")
> + "xvf" "../xorg-server.tar" "--strip-components=1"
> + "--wildcards" "*/COPYING"))
> + (delete-file "xorg-server.tar")
> + #t))))
I don't see why you're decompressing the tarball manually, this seems to
work just as well:
(add-after 'unpack 'unpack-x86emu-sources
(lambda* (#:key inputs #:allow-other-keys)
(begin
(format #t "decompressing x86emu source code~%")
(with-directory-excursion "libs"
(invoke (string-append (assoc-ref inputs "tar") "/bin/tar")
"xvf" (assoc-ref inputs "xorg-server-sources")
"--strip-components=3"
"--wildcards" "*/hw/xfree86/x86emu/")
;; extract license:
(with-directory-excursion "x86emu"
(invoke (string-append (assoc-ref inputs "tar") "/bin/tar")
"xvf" (assoc-ref inputs "xorg-server-sources")
"--strip-components=1"
"--wildcards" "*/COPYING"))
#t))))
If it's about efficiency or robustness in some way, I'd suggest leaving
a comment detailing the reason. Either way, I'd bind the path to tar in
a `let', as well as the path to "xorg-server-sources" if we decide to
not decompress separately.
> + (replace 'configure
> + (lambda* (#:key outputs #:allow-other-keys)
> + (let ((out (assoc-ref outputs "out")))
> + (setenv "CC" (which "gcc"))
> + (setenv "DESTDIR" out)
> + (invoke "./configure" "--with-x86emu"))))
> + (add-after 'build 'build-testvbe
> + (lambda _
> + (invoke "make" "testvbe")))
> + (add-after 'install 'install-testvbe
> + (lambda* (#:key outputs #:allow-other-keys)
> + (let ((testvbe (assoc-ref outputs "testvbe"))
> + (olddest (getenv "DESTDIR")))
> + (setenv "DESTDIR" testvbe)
> + (invoke "make" "install_testvbe")
> + (setenv "DESTDIR" olddest))))
These phases are missing the trailing #t.
I don't know how to test the package, but it passes lint & build,
including --rounds=2 to check for reproducibility.
Regards,
Jakub Kądziołka
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [bug#40084] [PATCH] gnu: Add v86d.
2020-03-19 14:49 ` Jakub Kądziołka
@ 2020-03-20 8:40 ` pelzflorian (Florian Pelz)
0 siblings, 0 replies; 3+ messages in thread
From: pelzflorian (Florian Pelz) @ 2020-03-20 8:40 UTC (permalink / raw)
To: Jakub Kądziołka; +Cc: 40084
On Thu, Mar 19, 2020 at 03:49:08PM +0100, Jakub Kądziołka wrote:
> I don't see why you're decompressing the tarball manually, this seems to
> work just as well:
> […]
> If it's about efficiency or robustness in some way, I'd suggest leaving
> a comment detailing the reason. Either way, I'd bind the path to tar in
> a `let', as well as the path to "xorg-server-sources" if we decide to
> not decompress separately.
>
Your review is much appreciated. Having tar do the decompression is
much better. Before I had copied the decompression without checking
from my earlier patch for nginx-accept-language-module. I think at
the time tar for some reason did not do auto-decompression when
building. Or maybe manual decompression already was unnecessary back
then.
I have tested on multiple computers, sufficiently I believe, so I
pushed with your changes as e2303e8e375ed2e07c1fd760c86a204eb51fbc6e.
I also pushed similar changes to the decompression in
nginx-accept-language-module as e84490346d8dac3720a57a331f533ce67ff0da1c.
> > + (replace 'configure
> > + (lambda* (#:key outputs #:allow-other-keys)
> > + (let ((out (assoc-ref outputs "out")))
> > + (setenv "CC" (which "gcc"))
> > + (setenv "DESTDIR" out)
> > + (invoke "./configure" "--with-x86emu"))))
> > + (add-after 'build 'build-testvbe
> > + (lambda _
> > + (invoke "make" "testvbe")))
> > + (add-after 'install 'install-testvbe
> > + (lambda* (#:key outputs #:allow-other-keys)
> > + (let ((testvbe (assoc-ref outputs "testvbe"))
> > + (olddest (getenv "DESTDIR")))
> > + (setenv "DESTDIR" testvbe)
> > + (invoke "make" "install_testvbe")
> > + (setenv "DESTDIR" olddest))))
>
> These phases are missing the trailing #t.
>
I missed the #t for the install-testvbe phase. Thank you! According
to the docstring of
(define (invoke program . args)
"Invoke PROGRAM with the given ARGS. Raise an exception
if the exit code is non-zero; otherwise return #t."
in guix/build/utils.scm, invoke always returns #t, so I did not change
the phases ending in invoke.
> I don't know how to test the package, but it passes lint & build,
> including --rounds=2 to check for reproducibility.
>
> Regards,
> Jakub Kądziołka
The important user of v86d is uvesafb. uvesafb allows me to make Xorg
work on multiple computers of mine with
#!/bin/sh
modprobe uvesafb mode_option=1280x800-32 \
v86d=/run/current-system/profile/sbin/v86d
chmod o+rw /dev/fb0
sleep 1
herd restart xorg-server
On many computers, the behavior can be tested when having a service
(set-xorg-configuration
(xorg-configuration
(modules
(list xf86-video-fbdev
xf86-input-libinput))))
and passing the kernel parameter 'nomodeset' e.g. in GRUB, because
then the framebuffer /dev/fb0 is only present when using uvesafb.
But I believe I have tested sufficiently.
Thank you!
Florian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-20 8:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-15 21:48 [bug#40084] [PATCH] gnu: Add v86d Florian Pelz
2020-03-19 14:49 ` Jakub Kądziołka
2020-03-20 8:40 ` pelzflorian (Florian Pelz)
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.