[PATCH] gnu: Add inferno

  • Open
  • quality assurance status badge
Details
One participant
  • Homo
Owner
unassigned
Submitted by
Homo
Severity
normal
H
(address . guix-patches@gnu.org)(name . Homo)(address . gay@disroot.org)
20241208002411.20796-1-gay@disroot.org
Based on earlier work rejected for licensing reasons, code has been relicensed from LPL to MIT and all fonts are removed from distribution, instead fonts from plan9port are used.
---
gnu/local.mk | 1 +
gnu/packages/inferno.scm | 336 +++++++++++++++++++
gnu/packages/patches/inferno-fix-crash.patch | 14 +
3 files changed, 351 insertions(+)
create mode 100644 gnu/packages/inferno.scm
create mode 100644 gnu/packages/patches/inferno-fix-crash.patch

Toggle diff (298 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index a7bd32453b..42dcf82ea3 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -375,6 +375,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/image-processing.scm \
%D%/packages/image-viewers.scm \
%D%/packages/imagemagick.scm \
+ %D%/packages/inferno.scm \
%D%/packages/inklingreader.scm \
%D%/packages/inkscape.scm \
%D%/packages/installers.scm \
diff --git a/gnu/packages/inferno.scm b/gnu/packages/inferno.scm
new file mode 100644
index 0000000000..b4a60ad34c
--- /dev/null
+++ b/gnu/packages/inferno.scm
@@ -0,0 +1,336 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2018 Diego Nicola Barbato <dnbarbato@posteo.de>
+;;; Copyright © 2024 Homo <gay@disroot.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages inferno)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix git-download)
+ #:use-module (guix packages)
+ #:use-module ((guix licenses)
+ #:prefix license:)
+ #:use-module (gnu packages plan9)
+ #:use-module (gnu packages xorg)
+ #:use-module (ice-9 match))
+
+(define-public inferno
+ (let ((commit "67e70befb2ad0058fd7894be34c492ddb6d09988")
+ (revision "0"))
+ (package
+ (name "inferno")
+ (version (git-version "4" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/inferno-os/inferno-os")
+ (commit commit)
+ ;; Inferno uses customized Freetype library with #include "lib9.h"
+ ;; TODO: use packaged Freetype library.
+ (recursive? #t)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0g3fzb991hbwa7r3vsnybw7m1v13nins5ajmygnvz4vmx5rzl405"))
+ (patches (search-patches "inferno-fix-crash.patch"))
+ ;; Remove bundled non-free and potentially non-free fonts.
+ (modules '((guix build utils)))
+ (snippet '(begin
+ (delete-file-recursively "fonts") #t))))
+ (build-system gnu-build-system)
+ (inputs `(("libx11" ,libx11)
+ ("libxext" ,libxext)
+ ("plan9port" ,plan9port)
+ ("xorgproto" ,xorgproto)))
+ (arguments
+ `( ;Force a 32-bit build targeting a similar architecture, i.e.:
+ ;; armhf for armhf/aarch64, i686 for i686/x86_64.
+ #:system ,@(match (%current-system)
+ ((or "armhf-linux" "aarch64-linux")
+ `("armhf-linux"))
+ (_ `("i686-linux")))
+ #:phases (let* ((bash (assoc-ref %build-inputs "bash"))
+ (objtype ,@(match (%current-system)
+ ((or "armhf-linux" "aarch64-linux")
+ `("arm"))
+ (_ `("386"))))
+ (out (assoc-ref %outputs "out"))
+ (root (string-append out "/share/inferno"))
+ (root/bindir (string-append root "/Linux/" objtype
+ "/bin"))
+ (root/fontdir (string-append root "/fonts"))
+ (simulate-fonts (lambda (size targets)
+ (string-concatenate (map (lambda (file)
+ (string-append
+ "ramfile /fonts/"
+ file
+ ".font; "
+ "bind /fonts/fixed/unicode."
+ size
+ ".font /fonts/"
+ file
+ ".font; "))
+ targets))))
+ (bindir (string-append out "/bin"))
+ (emu-script (string-append bindir "/emu"))
+ (infwm-script (string-append bindir "/infwm")))
+ `(,(assoc 'set-paths %standard-phases) (unpack unquote
+ (lambda* (#:key
+ source
+ #:allow-other-keys)
+ ;; Extract directly to 'root' since the source
+ ;; tree doubles as Inferno's root directory
+ ;; and its path is baked into the emu binary.
+ (mkdir-p
+ root)
+ (copy-recursively
+ source
+ root)
+ (chdir
+ root)
+ #t))
+ (patch-src-files unquote
+ (lambda _
+ ;; Substitute ocurrences of /bin/sh.
+ (for-each (lambda (file)
+ (substitute* file
+ (("/bin/sh")
+ (string-append bash
+ "/bin/sh"))))
+ '("makemk.sh"
+ "mkfiles/mkhost-Linux"
+ "emu/Linux/mk-wrt"
+ "utils/mk/Posix.c"))
+ ;; Do not pass '-m32' unconditionally
+ ;; when building mk.
+ (substitute* "makemk.sh"
+ (("-m32")
+ ""))
+ ;; Use the correct name for gcc.
+ (substitute* "mkfiles/mkfile-Linux-386"
+ (("cc -")
+ ;; Don't match yacc.
+ "gcc -"))
+ (substitute* "mkfiles/mkfile-Linux-arm"
+ (("arm-gcc")
+ "gcc"))
+ ;; Conflicting occurence of fsub.
+ (for-each (lambda (file)
+ (substitute* file
+ (("fsub")
+ "_fsub")))
+ '("utils/libmach/vcodas.c"
+ "utils/libmach/vdb.c"))
+ ;; Fix build.
+ (for-each (lambda (file)
+ (substitute* file
+ (("^CFLAGS=")
+ "CFLAGS=-D_GNU_SOURCE -fcommon")))
+ '("mkfiles/mkfile-Linux-386"
+ "mkfiles/mkfile-Linux-arm"
+ "mkfiles/mkfile-Linux-power"
+ "mkfiles/mkfile-Linux-spim"))
+ ;; Make build reproducible by
+ ;; ensuring timestamps embedded into
+ ;; binaries are set to 0.
+ (substitute* "emu/Linux/mkfile"
+ (("^KERNDATE=.*$")
+ "KERNDATE=0\n"))
+ #t))
+ (configure unquote
+ (lambda _
+ (substitute* "mkconfig"
+ (("ROOT=/usr/inferno")
+ (string-append "ROOT=" root))
+ (("SYSHOST=Plan9")
+ "SYSHOST=Linux")
+ (("OBJTYPE=\\$objtype")
+ (string-append "OBJTYPE=" objtype))) #t))
+ ;; Build mk.
+ ;; TODO: Use mk from plan9port or 9base instead.
+ (makemk unquote
+ (lambda _
+ (invoke "./makemk.sh")))
+ (build unquote
+ (lambda _
+ ;; Add mk's location to PATH.
+ (setenv "PATH"
+ (string-append root/bindir ":"
+ (getenv "PATH")))
+ ;; Build emu and .dis files using mk.
+ (invoke "mk" "-s" "nuke" "mkdirs" "install")))
+ (install unquote
+ (lambda* (#:key inputs #:allow-other-keys)
+ (mkdir-p bindir)
+ (mkdir-p root/fontdir)
+ ;; Install emu script.
+ (with-output-to-file emu-script
+ (lambda ()
+ (display (string-append "#!"
+ bash
+ "/bin/sh\n"
+ "exec "
+ root/bindir
+ "/emu "
+ "/dis/sh.dis -c \""
+ ;; Use plan9port's fonts.
+ "bind '#U*"
+ (search-input-directory inputs
+ "/plan9/font")
+ "' /fonts; "
+ ;; Pretend fonts were not removed.
+ ;; TODO: de-hardcode.
+ ;; TODO: use fonts available in the host system.
+ ;; TODO: minitel fonts.
+ "memfs -b /fonts; "
+ (string-concatenate (map (lambda
+ (dir)
+ (string-append
+ "mkdir /fonts/"
+ dir
+ "; "
+ "bind /fonts/fixed /fonts/"
+ dir
+ "; "))
+ '("charon"
+ "lucida"
+ "lucidasans"
+ "lucm"
+ "pelm")))
+ (simulate-fonts "6x9"
+ '("charon/cw.tiny"
+ "charon/plain.tiny"
+ "lucida/unicode.6"
+ "lucidasans/latin1.6"
+ "lucidasans/typelatin1.6"
+ "lucidasans/unicode.6"))
+ (simulate-fonts "7x13"
+ '("charon/cw.small"
+ "charon/plain.small"
+ "lucida/unicode.7"
+ "lucidasans/latin1.7"
+ "lucidasans/typelatin1.7"
+ "lucidasans/unicode.7"))
+ (simulate-fonts "8x13"
+ '("charon/cw.normal"
+ "charon/plain.normal"
+ "lucida/unicode.8"
+ "lucidasans/euro.8"
+ "lucidasans/latin1.8"
+ "lucidasans/typelatin1.8"
+ "lucidasans/unicode.8"
+ "pelm/unicode.8"))
+ (simulate-fonts "9x15"
+ '("charon/cw.large"
+ "charon/plain.large"
+ "lucida/unicode.10"
+ "lucidasans/latin1.10"
+ "lucidasans/typelatin1.10"
+ "lucidasans/unicode.10"
+ "lucm/unicode.9"
+ "pelm/ascii.12"
+ "pelm/latin1.9"
+ "pelm/unicode.9"))
+ (simulate-fonts "10x20"
+ '("charon/cw.vlarge"
+ "charon/plain.vlarge"
+ "lucida/moo.16"
+ "lucida/unicode.13"
+ "lucidasans/latin1.13"
+ "lucidasans/typelatin1.13"
+ "lucidasans/unicode.13"
+ "pelm/ascii.16"))
+ (simulate-fonts "6x13O"
+ '("charon/italic.tiny"
+ "charon/italic.small"
+ "lucidasans/italiclatin1.6"
+ "lucidasans/italiclatin1.7"))
+ (simulate-fonts "7x13O"
+ '("charon/italic.normal"
+ "lucidasans/italiclatin1.8"))
+ (simulate-fonts "8x13O"
+ '("charon/italic.large"
+ "charon/italic.vlarge"
+ "lucidasans/italiclatin1.10"
+ "lucidasans/italiclatin1.13"))
+ (simulate-fonts "6x13B"
+ '("charon/bold.tiny"
+ "lucidasans/boldlatin1.6"))
+ (simulate-fonts "7x13B"
+ '("charon/bold.small"
+ "lucidasans/boldlatin1.7"))
+ (simulate-fonts "8x13B"
+ '("charon/bold.normal"
+ "lucidasans/boldlatin1.8"))
+ (simulate-fonts "9x15B"
+ '("charon/bold.large"
+
This message was truncated. Download the full message here.
H
[PATCH v2] gnu: Add inferno
(address . 74734@debbugs.gnu.org)(name . Homo)(address . gay@disroot.org)
20241208235833.13520-1-gay@disroot.org
Based on earlier work rejected for licensing reasons, code has been relicensed from LPL to MIT and all fonts are removed from distribution, instead fonts from plan9port are used.

Change-Id: I38e188b26f23db584518f168b2ff63abc8f6d46d
---
This fixes build error caused by (search-patches), also I didn't know immediately I had to run "guix style -S inputs" and "guix style -S arguments", as they are not mentioned directly in https://guix.gnu.org/manual/devel/en/html_node/Formatting-Code.html

gnu/local.mk | 1 +
gnu/packages/inferno.scm | 336 +++++++++++++++++++
gnu/packages/patches/inferno-fix-crash.patch | 14 +
3 files changed, 351 insertions(+)
create mode 100644 gnu/packages/inferno.scm
create mode 100644 gnu/packages/patches/inferno-fix-crash.patch

Toggle diff (291 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index a7bd32453b..42dcf82ea3 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -375,6 +375,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/image-processing.scm \
%D%/packages/image-viewers.scm \
%D%/packages/imagemagick.scm \
+ %D%/packages/inferno.scm \
%D%/packages/inklingreader.scm \
%D%/packages/inkscape.scm \
%D%/packages/installers.scm \
diff --git a/gnu/packages/inferno.scm b/gnu/packages/inferno.scm
new file mode 100644
index 0000000000..016a3400eb
--- /dev/null
+++ b/gnu/packages/inferno.scm
@@ -0,0 +1,336 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2018 Diego Nicola Barbato <dnbarbato@posteo.de>
+;;; Copyright © 2024 Homo <gay@disroot.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages inferno)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix gexp)
+ #:use-module (guix git-download)
+ #:use-module (guix packages)
+ #:use-module ((guix licenses)
+ #:prefix license:)
+ #:use-module (gnu packages)
+ #:use-module (gnu packages plan9)
+ #:use-module (gnu packages xorg)
+ #:use-module (ice-9 match))
+
+(define-public inferno
+ (let ((commit "67e70befb2ad0058fd7894be34c492ddb6d09988")
+ (revision "0"))
+ (package
+ (name "inferno")
+ (version (git-version "4" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/inferno-os/inferno-os")
+ (commit commit)
+ ;; Inferno uses customized Freetype library with #include "lib9.h"
+ ;; TODO: use packaged Freetype library.
+ (recursive? #t)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0g3fzb991hbwa7r3vsnybw7m1v13nins5ajmygnvz4vmx5rzl405"))
+ (patches (search-patches "inferno-fix-crash.patch"))
+ ;; Remove bundled non-free and potentially non-free fonts.
+ (modules '((guix build utils)))
+ (snippet '(begin
+ (delete-file-recursively "fonts") #t))))
+ (build-system gnu-build-system)
+ (inputs (list libx11 libxext plan9port xorgproto))
+ (arguments
+ (list
+ ;;Force a 32-bit build targeting a similar architecture, i.e.:
+ ;; armhf for armhf/aarch64, i686 for i686/x86_64.
+ #:system (match (%current-system)
+ ((or "armhf-linux" "aarch64-linux") "armhf-linux")
+ (_ "i686-linux"))
+ #:phases #~(let* ((bash (assoc-ref %build-inputs "bash"))
+ (objtype #$@(match (%current-system)
+ ((or "armhf-linux" "aarch64-linux")
+ `("arm"))
+ (_ `("386"))))
+ (out (assoc-ref %outputs "out"))
+ (root (string-append out "/share/inferno"))
+ (root/bindir (string-append root "/Linux/" objtype
+ "/bin"))
+ (root/fontdir (string-append root "/fonts"))
+ (simulate-fonts (lambda (size targets)
+ (string-concatenate (map (lambda (file)
+ (string-append
+ "ramfile /fonts/"
+ file
+ ".font; "
+ "bind /fonts/fixed/unicode."
+ size
+ ".font /fonts/"
+ file
+ ".font; "))
+ targets))))
+ (bindir (string-append out "/bin"))
+ (emu-script (string-append bindir "/emu"))
+ (infwm-script (string-append bindir "/infwm")))
+ `(,(assoc 'set-paths %standard-phases) (unpack unquote
+ (lambda* (#:key
+ source
+ #:allow-other-keys)
+ ;; Extract directly to 'root' since the source
+ ;; tree doubles as Inferno's root directory
+ ;; and its path is baked into the emu binary.
+ (mkdir-p
+ root)
+ (copy-recursively
+ source
+ root)
+ (chdir
+ root)
+ #t))
+ (patch-src-files unquote
+ (lambda _
+ ;; Substitute ocurrences of /bin/sh.
+ (for-each (lambda (file)
+ (substitute* file
+ (("/bin/sh")
+ (string-append bash
+ "/bin/sh"))))
+ '("makemk.sh"
+ "mkfiles/mkhost-Linux"
+ "emu/Linux/mk-wrt"
+ "utils/mk/Posix.c"))
+ ;; Do not pass '-m32' unconditionally
+ ;; when building mk.
+ (substitute* "makemk.sh"
+ (("-m32")
+ ""))
+ ;; Use the correct name for gcc.
+ (substitute* "mkfiles/mkfile-Linux-386"
+ (("cc -")
+ ;; Don't match yacc.
+ "gcc -"))
+ (substitute* "mkfiles/mkfile-Linux-arm"
+ (("arm-gcc")
+ "gcc"))
+ ;; Conflicting occurence of fsub.
+ (for-each (lambda (file)
+ (substitute* file
+ (("fsub")
+ "_fsub")))
+ '("utils/libmach/vcodas.c"
+ "utils/libmach/vdb.c"))
+ ;; Fix build.
+ (for-each (lambda (file)
+ (substitute* file
+ (("^CFLAGS=")
+ "CFLAGS=-D_GNU_SOURCE -fcommon")))
+ '("mkfiles/mkfile-Linux-386"
+ "mkfiles/mkfile-Linux-arm"
+ "mkfiles/mkfile-Linux-power"
+ "mkfiles/mkfile-Linux-spim"))
+ ;; Make build reproducible by
+ ;; ensuring timestamps embedded into
+ ;; binaries are set to 0.
+ (substitute* "emu/Linux/mkfile"
+ (("^KERNDATE=.*$")
+ "KERNDATE=0\n"))
+ #t))
+ (configure unquote
+ (lambda _
+ (substitute* "mkconfig"
+ (("ROOT=/usr/inferno")
+ (string-append "ROOT=" root))
+ (("SYSHOST=Plan9")
+ "SYSHOST=Linux")
+ (("OBJTYPE=\\$objtype")
+ (string-append "OBJTYPE=" objtype))) #t))
+ ;; Build mk.
+ ;; TODO: Use mk from plan9port or 9base instead.
+ (makemk unquote
+ (lambda _
+ (invoke "./makemk.sh")))
+ (build unquote
+ (lambda _
+ ;; Add mk's location to PATH.
+ (setenv "PATH"
+ (string-append root/bindir ":"
+ (getenv "PATH")))
+ ;; Build emu and .dis files using mk.
+ (invoke "mk" "-s" "nuke" "mkdirs" "install")))
+ (install unquote
+ (lambda* (#:key inputs #:allow-other-keys)
+ (mkdir-p bindir)
+ (mkdir-p root/fontdir)
+ ;; Install emu script.
+ (with-output-to-file emu-script
+ (lambda ()
+ (display (string-append "#!"
+ bash
+ "/bin/sh\n"
+ "exec "
+ root/bindir
+ "/emu "
+ "/dis/sh.dis -c \""
+ ;; Use plan9port's fonts.
+ "bind '#U*"
+ (search-input-directory inputs
+ "/plan9/font")
+ "' /fonts; "
+ ;; Pretend fonts were not removed.
+ ;; TODO: de-hardcode.
+ ;; TODO: use fonts available in the host system.
+ ;; TODO: minitel fonts.
+ "memfs -b /fonts; "
+ (string-concatenate (map (lambda
+ (dir)
+
+ (string-append
+ "mkdir /fonts/"
+ dir
+ "; "
+ "bind /fonts/fixed /fonts/"
+ dir
+ "; "))
+ '("charon"
+ "lucida"
+ "lucidasans"
+ "lucm"
+ "pelm")))
+ (simulate-fonts "6x9"
+ '("charon/cw.tiny"
+ "charon/plain.tiny"
+ "lucida/unicode.6"
+ "lucidasans/latin1.6"
+ "lucidasans/typelatin1.6"
+ "lucidasans/unicode.6"))
+ (simulate-fonts "7x13"
+ '("charon/cw.small"
+ "charon/plain.small"
+ "lucida/unicode.7"
+ "lucidasans/latin1.7"
+ "lucidasans/typelatin1.7"
+ "lucidasans/unicode.7"))
+ (simulate-fonts "8x13"
+ '("charon/cw.normal"
+ "charon/plain.normal"
+ "lucida/unicode.8"
+ "lucidasans/euro.8"
+ "lucidasans/latin1.8"
+ "lucidasans/typelatin1.8"
+ "lucidasans/unicode.8"
+ "pelm/unicode.8"))
+ (simulate-fonts "9x15"
+ '("charon/cw.large"
+ "charon/plain.large"
+ "lucida/unicode.10"
+ "lucidasans/latin1.10"
+ "lucidasans/typelatin1.10"
+ "lucidasans/unicode.10"
+ "lucm/unicode.9"
+ "pelm/ascii.12"
+ "pelm/latin1.9"
+ "pelm/unicode.9"))
+ (simulate-fonts "10x20"
+ '("charon/cw.vlarge"
+ "charon/plain.vlarge"
+ "lucida/moo.16"
+ "lucida/unicode.13"
+ "lucidasans/latin1.13"
+ "lucidasans/typelatin1.13"
+ "lucidasans/unicode.13"
+ "pelm/ascii.16"))
+ (simulate-fonts "6x13O"
+ '("charon/italic.tiny"
+ "charon/italic.small"
+ "lucidasans/italiclatin1.6"
+ "lucidasans/italiclatin1.7"))
+ (simulate-fonts "7x13O"
+ '("charon/italic.normal"
+ "lucidasans/italiclatin1.8"))
+ (simulate-fonts "8x13O"
+ '("charon/italic.large"
+ "charon/italic.vlarge"
+ "lucidasans/italiclatin1.10"
+ "lucidasans/italiclatin1.13"))
+ (simulate-fonts "6x13B"
+ '("charon/bold.tiny"
+ "lucidasans/boldlatin1.6"))
+ (simulate-fonts "7x13B"
+
This message was truncated. Download the full message here.
?
Your comment

Commenting via the web interface is currently disabled.

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

To respond to this issue using the mumi CLI, first switch to it
mumi current 74734
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