[PATCH] gnu: Add v86d.

  • Done
  • quality assurance status badge
Details
3 participants
  • Jakub Kądziołka
  • Mathieu Othacehe
  • Florian Pelz
Owner
unassigned
Submitted by
Florian Pelz
Severity
normal

Debbugs page

Florian Pelz wrote 5 years ago
(address . guix-patches@gnu.org)(name . Florian Pelz)(address . pelzflorian@pelzflorian.de)
20200315214851.30981-1-pelzflorian@pelzflorian.de
* gnu/packages/xorg.scm (v86d): New variable.
---
gnu/packages/xorg.scm | 109 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 109 insertions(+)

Toggle diff (129 lines)
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
Jakub Kądziołka wrote 5 years ago
(name . Florian Pelz)(address . pelzflorian@pelzflorian.de)(address . guix-patches@gnu.org)
20200319144908.vfhtepo33lpmunhu@gravity
On Sun, Mar 15, 2020 at 10:48:51PM +0100, Florian Pelz wrote:
Toggle quote (27 lines)
> + ;; 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.

Toggle quote (17 lines)
> + (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
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE5Xa/ss9usT31cTO54xWnWEYTFWQFAl5zhl8ACgkQ4xWnWEYT
FWQ4RA/+K3dShJX3iHKBOpCMW4ubvBW8gijHPuLiccTRju0wOTEVf837iN8Ofrim
JZOXm0U+qNshlUSc1kD8iM0XAKuf5iEp8xPlBVQlloV/aRFgllII3pcWvserxsD1
OaQa2Tc+5MZ0IoeFVhexc00DgLA4Fl8XyTHqI/wrqUItwqzplUPVRxN2sBtpNSZO
uN73Tm9VIUAGs9WlTZr4kQVlg8GgAsJ9UpyUPLHM/A8QwjEad/nr/OBM31RLx24+
OQB8iJpfCVRE60J9UoswUj1XfTVz/WFMHAeGhJm9hvPBi8/PnVZlmrbkGVPvRf27
wLkm3pFZ8ugVnBz04knllPERuVZrKyjl/XDPlg4/Vys0MUCXXQdtKaycekaW/nDA
6cAjk4dTkos6KeoJKi78VJLic2WyyvbpA8hVmtaq2a2Hr62IIfYqY0B1wRUBh/3y
Hw3fW97yLVicJG9LOuu+YfXwS6Td/49JxxfKOj3LzkCSErPPiRZ7YqKniZgIp3W3
JcLtWn3kERxIA5car/er1gJpPNZS4GmSUK9LSorszmk15iW2VyiCtNRfMsp1pCJF
6ss0Pe21lh/0sCd6IZ0FKAzA291zjSkcO4X1XnDomSoeZahEJ4o9rtN7bxKlXSEt
iI3HZD592oXXc/L4WoB1AdCME2C8liLVgQXsGSal+cp7TdrFfVs=
=J7+3
-----END PGP SIGNATURE-----


pelzflorian (Florian Pelz) wrote 5 years ago
(name . Jakub Kądziołka)(address . kuba@kadziolka.net)(address . guix-patches@gnu.org)
20200320084000.h56hditmdkqcxekj@pelzflorian.localdomain
On Thu, Mar 19, 2020 at 03:49:08PM +0100, Jakub Kądziołka wrote:
Toggle quote (9 lines)
> 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.


Toggle quote (20 lines)
> > + (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.


Toggle quote (6 lines)
> 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
Mathieu Othacehe wrote 5 years ago
control message for bug #40084
(address . control@debbugs.gnu.org)
875zexkcbi.fsf@gmail.com
close 40084
quit
?
Your comment

This issue is archived.

To comment on this conversation send an email to 40084@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 40084
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help