From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48555) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGWvS-0003Ar-Jz for guix-patches@gnu.org; Wed, 09 May 2018 17:47:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGWvO-00043U-HB for guix-patches@gnu.org; Wed, 09 May 2018 17:47:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:47769) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGWvO-00043O-E5 for guix-patches@gnu.org; Wed, 09 May 2018 17:47:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fGWvO-0000T9-80 for guix-patches@gnu.org; Wed, 09 May 2018 17:47:02 -0400 Subject: [bug#31395] [PATCH 2/2] gnu: Add snap. Resent-Message-ID: From: Nicolas Goaziou Date: Wed, 9 May 2018 23:46:22 +0200 Message-Id: <20180509214622.28928-2-mail@nicolasgoaziou.fr> In-Reply-To: <20180509214622.28928-1-mail@nicolasgoaziou.fr> References: <20180509214622.28928-1-mail@nicolasgoaziou.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 31395@debbugs.gnu.org * gnu/packages/education.scm (snap): New variable. --- gnu/packages/education.scm | 82 +++++++++++++++++++++++++++++++++++++- 1 file changed, 80 insertions(+), 2 deletions(-) diff --git a/gnu/packages/education.scm b/gnu/packages/education.scm index 58f06c310..679c69d79 100644 --- a/gnu/packages/education.scm +++ b/gnu/packages/education.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2016, 2017 Ricardo Wurmus ;;; Copyright © 2016 Hartmut Goebel ;;; Copyright © 2017, 2018 Efraim Flashner +;;; Copyright © 2018 Nicolas Goaziou ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,17 +23,21 @@ (define-module (gnu packages education) #:use-module (ice-9 regex) #:use-module (gnu packages) - #:use-module (gnu packages qt) + #:use-module (gnu packages base) + #:use-module (gnu packages bash) #:use-module (gnu packages compression) #:use-module (gnu packages databases) + #:use-module (gnu packages freedesktop) #:use-module (gnu packages gettext) #:use-module (gnu packages glib) #:use-module (gnu packages gnome) #:use-module (gnu packages gtk) + #:use-module (gnu packages javascript) #:use-module (gnu packages kde-frameworks) ; extra-cmake-modules #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) + #:use-module (gnu packages qt) #:use-module (gnu packages sdl) #:use-module (gnu packages texinfo) #:use-module (gnu packages xml) @@ -41,8 +46,9 @@ #:use-module (guix download) #:use-module (guix svn-download) #:use-module (guix utils) - #:use-module (guix build-system gnu) #:use-module (guix build-system cmake) + #:use-module (guix build-system gnu) + #:use-module (guix build-system trivial) #:use-module (srfi srfi-1)) (define-public gcompris @@ -224,3 +230,75 @@ Useful support functions and an extensive progress tracker, topical lessons and the ability to create your own practice lessons make learning to type easy.") (license license:gpl2))) + +(define-public snap + (package + (name "snap") + (version "4.1.2.7") + (source + (origin + (method url-fetch) + (uri (string-append + "https://github.com/jmoenig/Snap--Build-Your-Own-Blocks/archive/" + version ".tar.gz")) + (file-name (string-append name "-" version)) + (sha256 + (base32 + "0yf3x133n9ady4zr9z8cab98qfp9v69x9qjfl8ia05zxzy7d3y5z")))) + (build-system trivial-build-system) + (arguments + `(#:modules ((guix build utils)) + #:builder + (begin + (use-modules (guix build utils)) + (let* ((out (assoc-ref %outputs "out")) + (share (string-append out "/share/snap")) + (root (string-append "Snap--Build-Your-Own-Blocks-" + ,version))) + (setenv "PATH" (string-append + (assoc-ref %build-inputs "gzip") "/bin:" + (assoc-ref %build-inputs "tar") "/bin")) + (invoke "tar" "xvzf" (assoc-ref %build-inputs "source")) + (mkdir-p share) + (with-directory-excursion root + (copy-recursively "." share)) + ;; Replace the sole minified file in the package. + (with-directory-excursion share + (delete-file "FileSaver.min.js") + (symlink (string-append (assoc-ref %build-inputs "js-filesaver") + "/share/javascript/FileSaver.min.js") + "FileSaver.min.js")) + ;; Create a "snap" executable. + (let* ((bin (string-append out "/bin")) + (script (string-append bin "/snap")) + (bash (string-append (assoc-ref %build-inputs "bash") + "/bin/bash")) + (xdg-open (string-append (assoc-ref %build-inputs "xdg-utils") + "/bin/xdg-open")) + (snap (string-append share "/snap.html"))) + (mkdir-p bin) + (call-with-output-file script + (lambda (port) + (format port "#!~a\n~a '~a'" bash xdg-open snap))) + (chmod script #o555))) + #t))) + (native-inputs + `(("gzip" ,gzip) + ("tar" ,tar) + ("js-filesaver" ,js-filesaver))) + (inputs + `(("bash" ,bash-minimal) + ("xdg-utils" ,xdg-utils))) + (home-page "https://snap.berkeley.edu") + (synopsis "Visual, blocks based programming language inspired by Scratch") + (description "Snap! (formerly BYOB) is a visual, drag-and-drop +programming language. It is an extended reimplementation of Scratch (a +project of the Lifelong Kindergarten Group at the MIT Media Lab) that +allows you to Build Your Own Blocks. It also features first class +lists, first class procedures, and continuations. These added +capabilities make it suitable for a serious introduction to computer +science for high school or college students. + +This package provides a @command{snap} executable calling @command{xdg-open} +to open a the application in a web browser.") + (license license:agpl3+))) -- 2.17.0