Commit 2072ebcd authored by ROUBY Pierre-Antoine's avatar ROUBY Pierre-Antoine
Browse files

guix-kernel: Add autotools build system.

* guix-jupyter-kernel.scm: Move from 'src/'.
* guix-jupyter-subkernel.scm: Move from 'src/'.
* guix-kernel/environ.scm: Move from 'src/'.
* guix-kernel/hmac.scm: Move from 'src/'.
* guix-kernel/magic.scm: Move from 'src/'.
* guix-kernel/tools.scm: Move from 'src/'.
* kernel.json.in: Move from 'src/kernel.json'.
  (argv): Add '@guilemoduledir@'.
* env.in: New file.
* bootstrap: New file.
* configure.ac: New file.
* guile.am: New file.
* Makefile.am: New file.
* environment.scm: New file.
* VERSION: New file.
parent 72d35305
include guile.am
moddir=@guilemoduledir@
godir=@guileobjectdir@
SOURCES = \
guix-kernel/environ.scm \
guix-kernel/hmac.scm \
guix-kernel/tools.scm \
guix-kernel/magic.scm \
guix-jupyter-kernel.scm \
guix-jupyter-subkernel.scm
EXTRA_DIST += kernel.json.in
assetsdir = $(datadir)/jupyter/kernels/guix/
nobase_dist_assets_DATA = kernel.json
# Flags for 'guild compile'.
GUILD_COMPILE_FLAGS = -Wformat -Wunbound-variable -Warity-mismatch
kernel.json: kernel.json.in
$(SED) -e 's,@''guilemoduledir''@,$(moddir),g' \
< $< > $@.tmp
mv $@.tmp $@
#!/bin/sh
# Create the build system.
set -e -x
exec autoreconf -vfi
AC_INIT([guix-kernel], [m4_translit(m4_esyscmd([cat VERSION]),m4_newline)])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([color-tests -Wall -Wno-portability foreign])
AM_SILENT_RULES([yes])
AC_PROG_SED
GUILE_PKG([2.2])
GUILE_PROGS
if test "x$GUILD" = "x"; then
AC_MSG_ERROR(['guild' binary not found; please check your guile-2.2 installation.])
fi
guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION"
guileobjectdir="${libdir}/guile/$GUILE_EFFECTIVE_VERSION/site-ccache"
AC_SUBST([guilemoduledir])
AC_SUBST([guileobjectdir])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([env], [chmod +x env])
AC_OUTPUT
#!/bin/sh
GUILE_LOAD_PATH=@abs_top_srcdir@:$GUILE_LOAD_PATH
if test "@abs_top_srcdir@" != "@abs_top_builddir@"; then
GUILE_LOAD_PATH=@abs_top_builddir@:$GUILE_LOAD_PATH
fi
GUILE_LOAD_COMPILED_PATH=@abs_top_builddir@:$GUILE_LOAD_PATH
PATH=@abs_top_builddir@/bin:$PATH
GUILE_WARN_DEPRECATED="no"
export GUILE_WARN_DEPRECATED
export GUILE_LOAD_PATH
export GUILE_LOAD_COMPILED_PATH
export PATH
exec "$@"
;;; Run the following command to enter a development environment for
;;; guix-kernel:
;;;
;;; $ guix environment -l environment.scm
(use-modules ((guix licenses) #:prefix license:)
(guix packages)
(guix download)
(guix utils)
(guix build-system gnu)
(gnu packages)
(gnu packages autotools)
(gnu packages guile)
(gnu packages lisp)
(gnu packages tls)
(gnu packages package-management)
(gnu packages pkg-config))
(package
(name "guix-kernel")
(version "0.0.1")
(source (string-append (getcwd) "/guix-kernel-" version ".tar.gz"))
(build-system gnu-build-system)
(arguments
`(#:phases
(modify-phases %standard-phases
(add-before 'configure 'env
(lambda _
(setenv "GUILE_AUTO_COMPILE" "0"))))))
(native-inputs
`(("autoconf" ,autoconf)
("automake" ,automake)
("pkg-config" ,pkg-config)))
(inputs
`(("guix" ,guix)
("guile" ,guile-2.2)
("openssl" ,openssl)))
(propagated-inputs
`(("guile-json" ,guile-json)
("guile-simple-zmq" ,guile-simple-zmq)))
(home-page "https://gitlab.inria.fr/guix-hpc/guix-kernel")
(synopsis "Guix kernel for Jupyter")
(description "This package provide guix kernel for Jupyter.")
(license license:gpl3+))
GOBJECTS = $(SOURCES:%.scm=%.go)
nobase_mod_DATA = $(SOURCES) $(NOCOMP_SOURCES)
nobase_go_DATA = $(GOBJECTS)
# Make sure source files are installed first, so that the mtime of
# installed compiled files is greater than that of installed source
# files. See
# <http://lists.gnu.org/archive/html/guile-devel/2010-07/msg00125.html>
# for details.
guile_install_go_files = install-nobase_goDATA
$(guile_install_go_files): install-nobase_modDATA
CLEANFILES = $(GOBJECTS)
EXTRA_DIST = $(SOURCES) $(NOCOMP_SOURCES)
GUILE_WARNINGS = -Wunbound-variable -Warity-mismatch -Wformat
SUFFIXES = .scm .go
.scm.go:
$(AM_V_GEN)$(top_builddir)/env $(GUILE_TOOLS) compile $(GUILE_WARNINGS) -o "$@" "$<"
......@@ -3,12 +3,12 @@
(srfi srfi-1)
(srfi srfi-11)
(srfi srfi-13)
(ice-9 vlist))
(include "guix-kernel/tools.scm")
(include "guix-kernel/hmac.scm")
(include "guix-kernel/magic.scm")
(include "guix-kernel/environ.scm")
(ice-9 vlist)
(guix build utils)
(guix-kernel tools)
(guix-kernel hmac)
(guix-kernel magic)
(guix-kernel environ))
;;
;; Kernel information.
......@@ -318,8 +318,8 @@
(pid (assoc-ref subkernel "pid")))
(kill pid SIGTERM)
(waitpid pid)
(zmq-close-socket (assoc-ref (assoc-ref "sockets") "shell"))
(zmq-close-socket (assoc-ref (assoc-ref "sockets") "shell"))
(zmq-close-socket (assoc-ref (assoc-ref subkernel "sockets") "shell"))
(zmq-close-socket (assoc-ref (assoc-ref subkernel "sockets") "shell"))
(loop (cdr sub))))))
(loop list)))
......
......@@ -2,11 +2,10 @@
(simple-zmq)
(srfi srfi-1)
(srfi srfi-11)
(srfi srfi-13))
(include "guix-kernel/tools.scm")
(include "guix-kernel/hmac.scm")
(include "guix-kernel/magic.scm")
(srfi srfi-13)
(guix-kernel tools)
(guix-kernel hmac)
(guix-kernel magic))
;;
;; Kernel information.
......@@ -99,12 +98,6 @@
;; Handler.
;;
(define (heartbeat-handler)
(zmq-message-send socket-heartbeat
(zmq-message-receive socket-heartbeat
(zmq-msg-init)))
(heartbeat-handler))
(define (general-handler socket count)
(let* ((parts (zmq-get-msg-parts socket))
(my-uuid (car parts))
......
(use-modules (gnu packages)
(guix licenses)
(guix packages)
(guix records)
(guix store)
(guix utils)
(guix monads)
(guix derivations)
(guix build utils)
(srfi srfi-11))
(define-module (guix-kernel environ)
#:use-module (gnu packages)
#:use-module (guix licenses)
#:use-module (guix packages)
#:use-module (guix records)
#:use-module (guix store)
#:use-module (guix utils)
#:use-module (guix monads)
#:use-module (guix derivations)
#:use-module (guix build utils)
#:use-module (srfi srfi-11)
#:export (guile->path
guile-current-version->path
(define store (open-connection))
package-name->path))
(define (store) (open-connection))
(define (m-package-by-name->package-path name)
(mlet %store-monad ((drv (package->derivation
......@@ -21,7 +26,7 @@
(define (guile->path guile)
"Return path to guile executable file. GUILE is package specification."
(string-append
(run-with-store store (m-package-by-name->package-path guile))
(run-with-store (store) (m-package-by-name->package-path guile))
"/bin/guile"))
(define (guile-current-version->path)
......@@ -30,4 +35,4 @@
(define (package-name->path name)
"Return store path for package coresponding to NAME."
(run-with-store store (m-package-by-name->package-path name)))
(run-with-store (store) (m-package-by-name->package-path name)))
(use-modules (ice-9 rdelim)
(ice-9 popen))
(define-module (guix-kernel hmac)
#:use-module (ice-9 rdelim)
#:use-module (ice-9 popen)
#:export (get-signature))
(define (get-signature key str)
(let* ((p2c (pipe))
......
(define-module (guix-kernel magic)
#:export (magic?
get-magic-line
delete-magic
magic-attr?
magic-env?
magic-run?
magic-exec?))
(define (magic? code)
"Return true if code begin by magic command like '%%guix ...', else
return false"
......
(define-module (guix-kernel tools)
#:use-module (json)
#:export (make-id
make-header
colorize))
(define (make-id)
(number->string (random (expt 2 128)) 16))
......
{
"argv": ["guile", "-s",
"%guix-kernel-path%",
"@guilemoduledir@/guix-jupyter-kernel.scm",
"--", "{connection_file}"],
"display_name": "Guix",
"language": "scheme"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment