>From ea6cc12bffe9e7c566f0d98681446df2676d2eb2 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sun, 29 May 2016 19:28:53 +0200 Subject: [PATCH] gnu: Add geogebra. * gnu/packages/maths.scm (geogebra): New variable. --- gnu/packages/maths.scm | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm index e11208c..135794f 100644 --- a/gnu/packages/maths.scm +++ b/gnu/packages/maths.scm @@ -41,7 +41,10 @@ #:use-module (guix build-system cmake) #:use-module (guix build-system gnu) #:use-module (guix build-system r) + #:use-module (guix build-system trivial) #:use-module (gnu packages algebra) + #:use-module (gnu packages base) + #:use-module (gnu packages bash) #:use-module (gnu packages bison) #:use-module (gnu packages boost) #:use-module (gnu packages check) @@ -61,6 +64,7 @@ #:use-module (gnu packages graphviz) #:use-module (gnu packages gtk) #:use-module (gnu packages image) + #:use-module (gnu packages java) #:use-module (gnu packages less) #:use-module (gnu packages lisp) #:use-module (gnu packages gnome) @@ -2442,3 +2446,85 @@ structured and unstructured grid problems."))) (description "Matio is a library for reading and writing MAT files. It supports compressed MAT files, as well as newer (version 7.3) MAT files.") (license license:bsd-2))) + +(define-public geogebra + (package + (name "geogebra") + (version "5.0.240.0") + (synopsis "Dynamic mathematics software for education") + (source + (origin + (method url-fetch) + (uri (string-append "http://download.geogebra.org/installers/" + (version-major+minor version) + "/GeoGebra-Linux-Portable-" + version ".tar.bz2")) + (sha256 + (base32 + "1ngh0bah3krdc30ah3g73zbvh3gypvrvyfddlgcg7n5dmfad7a71")))) + (build-system trivial-build-system) + (arguments + `(#:modules ((guix build utils) + (srfi srfi-26)) + #:builder + (begin + (use-modules (guix build utils) + (srfi srfi-26)) + (let ((bash (string-append (assoc-ref %build-inputs "bash") "/bin")) + (bzip2 (string-append (assoc-ref %build-inputs "bzip2") "/bin")) + (java (string-append (assoc-ref %build-inputs "icedtea") + "/bin/java"))) + ;; Set paths. + (setenv "PATH" (string-append bzip2 ":" bash)) + ;; Unpack file any move into source directory. + (let ((source (assoc-ref %build-inputs "source")) + (tar (assoc-ref %build-inputs "tar"))) + (system* (string-append tar "/bin/tar") "xjf" source)) + (chdir (string-append "GeoGebra-Linux-Portable-" ,version)) + ;; Move ".jar" files and license into "share/geogebra/". + (let* ((out (assoc-ref %outputs "out")) + (bin (string-append out "/bin")) + (share (string-append out "/share")) + (applications (string-append share "/applications")) + (jar-dir (string-append share "/geogebra"))) + (for-each (cut install-file <> jar-dir) + (find-files "." "\\.jar$")) + (install-file "LICENSE.txt" jar-dir) + ;; Create a launcher into "bin/". + (install-file "geogebra/geogebra" bin) + (with-directory-excursion bin + (patch-shebang "geogebra" (list bash)) + (wrap-program "geogebra" + `("GG_PATH" = (,jar-dir)) + `("GG_SCRIPTNAME" = ("geogebra")) + `("JAVACMD" = (,java)))) + ;; Install .desktop file in "share/applications/" + (mkdir-p applications) + (call-with-output-file + (string-append applications "/geogebra.desktop") + (lambda (port) + (format port "~ +\[Desktop Entry]~@ +Name=GeoGebra~@ +Comment=~a~@ +Exec=~a/geogebra~@ +Terminal=false~@ +Type=Application~@ +MimeType=application/vnd.geogebra.file;application/vnd.geogebra.tool~@ +Categories=Education;Science;Math;" + ,synopsis bin)))) + #t)))) + (native-inputs `(("bzip2" ,bzip2) + ("tar" ,tar))) + (inputs `(("bash" ,bash-minimal) + ("icedtea" ,icedtea))) + (description "GeoGebra is dynamic mathematics software for all +levels of education that brings together geometry, algebra, +spreadsheets, graphing, statistics and calculus in one package.") + (home-page "https://www.geogebra.org") + ;; Source code uses GPLv3+. Other parts (e.g., translations) use + ;; a Non-Commercial clause. + (license + (list license:gpl3+ + (license:non-copyleft "file:///LICENSE.txt" + "See LICENSE.txt in the distribution."))))) -- 2.8.3