unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Diego Nicola Barbato <dnbarbato@posteo.de>
To: guix-devel@gnu.org
Subject: Packaging Inferno
Date: Fri, 05 Oct 2018 10:11:54 +0200	[thread overview]
Message-ID: <87a7nssth1.fsf@GlaDOS.home> (raw)

[-- Attachment #1: Type: text/plain, Size: 687 bytes --]

Hello Guix,

I have written a package definition for Inferno and I would like to know
if it would make sense to add it to Guix.  I am asking because I am not
sure if it is compatible with the FSDG (bundled fonts, trademarks, ...)
and if it would be of any use to anyone.

It builds reproducibly on my Laptop (x86_64-linux).  I have not tried to
build it on any of the other (supposedly) supported architectures.

For now the recipe has to be passed to `guix build' or `guix package'
using the `-f' option but I would be glad to add it to a module
(e.g. (gnu packages virtualization), or a module of its own) and send a
patch if it is decided that it belongs in Guix.

Greetings,

Diego


[-- Attachment #2: inferno-trivial.scm --]
[-- Type: application/octet-stream, Size: 8075 bytes --]

(use-modules (ice-9 match)
             (guix packages)
             (guix git-download)
             (guix hg-download)
             (guix build-system trivial)
             ((guix licenses) #:prefix license:)
             (gnu packages base)
             (gnu packages bash)
             (gnu packages commencement)
             (gnu packages compression)
             (gnu packages gawk)
             (gnu packages xorg))

(let ((commit "62ae0f7")
      (revision "0"))
  (package
    (name "inferno")
    (version (git-version "4" revision commit))
    (source
     (origin
       (method hg-fetch)
       (uri (hg-reference
             (url "https://bitbucket.org/inferno-os/inferno-os")
             (changeset commit)))
       (file-name (string-append name "-" version "-checkout"))
       (sha256
        (base32 "18irka9qad8m1r2m9f56glv9d0gwk4ai7n7i0mzbi47vcmm60hdd"))
       ;; Remove bundled proprietary fonts.
       (modules '((guix build utils)))
       (snippet
        '(begin
           (for-each delete-file-recursively
                     '("fonts/lucidasans"
                       "fonts/pelm"
                       "fonts/lucida"
                       "fonts/lucm"))
           #t))))
    (build-system trivial-build-system)
    (native-inputs `(("bash" ,bash)
                     ("coreutils" ,coreutils)
                     ("grep" ,grep)
                     ("sed" ,sed)
                     ("awk" ,gawk)
                     ("xz" ,xz)
                     ("tar" ,tar)
                     ("gcc-toolchain" ,gcc-toolchain)                     ))
    (inputs `(("libx11" ,libx11)
              ("xorgproto" ,xorgproto)
              ("libxext" ,libxext)))
    (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")))
       #:modules ((guix build utils))
       #:builder
       (begin
         (use-modules (guix build utils))
         (let* ((out (assoc-ref %outputs "out"))
                (root (string-append out "/usr/inferno"))
                (bindir (string-append out "/bin"))
                (infwm-script (string-append bindir "/infwm"))
                (source (assoc-ref %build-inputs "source"))
                (bash (assoc-ref %build-inputs "bash"))
                (xz (assoc-ref %build-inputs "xz"))
                (tar (assoc-ref %build-inputs "tar"))
                (gcc-tc (assoc-ref %build-inputs "gcc-toolchain"))
                (cutils (assoc-ref %build-inputs "coreutils"))
                (grep (assoc-ref %build-inputs "grep"))
                (sed (assoc-ref %build-inputs "sed"))
                (awk (assoc-ref %build-inputs "awk"))
                (libx11 (assoc-ref %build-inputs "libx11"))
                (xorgproto (assoc-ref %build-inputs "xorgproto"))
                (libxext (assoc-ref %build-inputs "libxext"))
                (objtype ,@(match (%current-system)
                             ((or "armhf-linux" "aarch64-linux")
                              `("arm"))
                             (_
                              `("386")))))
           ;; set paths
           (set-path-environment-variable "PATH" '("bin")
                                          (list gcc-tc
                                                cutils
                                                grep
                                                sed
                                                awk
                                                xz
                                                tar))
           (set-path-environment-variable "CPATH" '("include")
                                          (list gcc-tc
                                                libx11
                                                xorgproto
                                                libxext))
           (set-path-environment-variable "LIBRARY_PATH" '("lib")
                                          (list gcc-tc
                                                libx11
                                                libxext))
           ;; extract source
           (mkdir-p root)
           (invoke "tar" "xvf" source "-C" root "--strip=1" "-m")
           ;; build inside of root as the source tree doubles as
           ;; inferno's root file system and its path is baked into
           ;; the emu binary
           (with-directory-excursion root
             ;; 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"))
             ;; configure
             (substitute* "mkconfig"
               (("ROOT=/usr/inferno")
                (string-append "ROOT=" root))
               (("SYSHOST=Plan9")
                "SYSHOST=Linux")
               (("OBJTYPE=\\$objtype")
                (string-append "OBJTYPE=" objtype)))
             ;; substitute occurences of cc
             ;; TODO: verify this is not a problem on arm
             (substitute* "mkfiles/mkfile-Linux-386"
               (("cc -") ; don't match yacc
                "gcc -"))
             ;; Make build reproducible by ensuring timestamps
             ;; embedded into binaries are set to 0
             (substitute* "emu/Linux/mkfile"
               (("^KERNDATE=.*$")
                "KERNDATE=0\n"))
             ;; build mk
             (invoke "./makemk.sh")
             ;; add mk's location to PATH
             (setenv "PATH"
                     (string-append
                      root
                      "/Linux/" objtype "/bin:"
                      (getenv "PATH")))
             ;; build emu and .dis files using mk
             (invoke "mk" "-s" "nuke" "mkdirs" "install")
             ;; install infwm script
             (mkdir-p bindir)
             (with-output-to-file infwm-script
               (lambda ()
                 (display
                  (string-append
                   "#!" bash "/bin/sh\n"
                   "exec " root "/Linux/" objtype "/bin/emu $* "
                   "/dis/sh.dis -c \""
                   "bind -bc '#U*/tmp' /tmp; " ; bind the host's /tmp to inferno's /tmp
                   "bind '#U*/home' /usr; " ; bind the host's /home to inferno's /usr
                   "wm/wm wm/logon -u $USER" ; launch the window manager and login as $USER
                   "\"\n"))))
             (chmod infwm-script #o755)
             ;; install a symlink to emu
             (symlink (string-append root "/Linux/" objtype "/bin/emu")
                      (string-append bindir "/emu")))))))
    (home-page "http://www.inferno-os.org")
    (synopsis "Compact operating system for building cross-platform distributed systems")
    (description
     "Inferno is a virtualised operating system that can run natively across
a wide range of processor architectures or hosted on a wide range of
operating systems.  The principal components of the system are:
@itemize
@item The Inferno kernel which can run both native and hosted on a
range of platforms and which presents the same interface to programs
in both cases.
@item The Dis virtual machine.
@item Styx - the tiny broad-spectrum file service protocol.
@item Limbo - a new simple, modular, concurrent programming language.
@item Tk and Prefab - graphical user interface (GUI) primitives
without a lot of goo.
@item The portable cross-development suites that allow any native
Inferno platform to be cross-compiled on any hosted system.
@end itemize
This package provides hosted Inferno.\n")
    (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux" "aarch64-linux"))
    (license license:gpl2+)))

             reply	other threads:[~2018-10-05  8:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-05  8:11 Diego Nicola Barbato [this message]
2018-10-07  9:49 ` Packaging Inferno Efraim Flashner
2018-10-11 13:30   ` Diego Nicola Barbato
2018-10-11 13:44     ` Efraim Flashner
2018-10-08 13:00 ` Ludovic Courtès
2018-10-08 13:47   ` Nils Gillmann
2018-10-09 17:09     ` Diego Nicola Barbato
2018-10-09 17:55       ` Nils Gillmann
2018-10-17 17:35         ` Diego Nicola Barbato
2018-10-16 12:03       ` Ludovic Courtès
2018-10-21 13:59         ` Diego Nicola Barbato
2018-10-24 12:58           ` Ludovic Courtès

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=87a7nssth1.fsf@GlaDOS.home \
    --to=dnbarbato@posteo.de \
    --cc=guix-devel@gnu.org \
    /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).