all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Packaging Inferno
@ 2018-10-05  8:11 Diego Nicola Barbato
  2018-10-07  9:49 ` Efraim Flashner
  2018-10-08 13:00 ` Ludovic Courtès
  0 siblings, 2 replies; 12+ messages in thread
From: Diego Nicola Barbato @ 2018-10-05  8:11 UTC (permalink / raw)
  To: guix-devel

[-- 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+)))

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-10-24 12:59 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-05  8:11 Packaging Inferno Diego Nicola Barbato
2018-10-07  9:49 ` 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

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.