From 88f06fd0153ce5fa7bfe23be59eb7dcf20147e6c Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Thu, 28 Nov 2019 21:37:28 +0100 Subject: gnu: Really move lisp libraries to lisp-xyz, uglify-js to javascript and stumpwm to wm. * gnu/local.mk: Include lisp-xyz.scm. * gnu/packages/lisp-xyz.scm: New file. * gnu/packages/lisp.scm: Move all lisp libraries to lisp-xyz.scm, uglify-js to javascript.scm and stumpwm to wm.scm. * gnu/packages/javascript.scm: Add uglify-js. * gnu/packages/wm.scm: Add stumpwm. * gnu/packages/bioinformatics.scm: Find uglify-js in javascript.scm. * gnu/packages/machine-learning.scm: Depend on lisp-xyz.scm instead of lisp.scm. * gnu/packages/web.scm: Find uglify-js in javascript.scm. * gnu/packages/web-browsers.scm: Depend on lisp-xyz.scm instead of lisp.scm. * guix/build-system/minify.scm (default-uglify-js): Find uglify-js in javascript module instead of lisp. --- gnu/packages/javascript.scm | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'gnu/packages/javascript.scm') diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm index 0e33f889b8..6718274da2 100644 --- a/gnu/packages/javascript.scm +++ b/gnu/packages/javascript.scm @@ -26,6 +26,7 @@ (define-module (gnu packages javascript) #:use-module (gnu packages base) #:use-module (gnu packages compression) #:use-module (gnu packages lisp) + #:use-module (gnu packages lisp-xyz) #:use-module (gnu packages readline) #:use-module (guix packages) #:use-module (guix download) @@ -452,3 +453,50 @@ (define-public mujs C++ template mechanisms, or worry about marking and unmarking garbage collection roots, or wrestle with obscure build systems.") (license license:isc))) + +(define-public uglify-js + (package + (inherit sbcl-cl-uglify-js) + (name "uglify-js") + (build-system trivial-build-system) + (arguments + `(#:modules ((guix build utils)) + #:builder + (let* ((bin (string-append (assoc-ref %outputs "out") "/bin/")) + (script (string-append bin "uglify-js"))) + (use-modules (guix build utils)) + (mkdir-p bin) + (with-output-to-file script + (lambda _ + (format #t "#!~a/bin/sbcl --script + (require :asdf) + (push (truename \"~a/lib/sbcl\") asdf:*central-registry*)" + (assoc-ref %build-inputs "sbcl") + (assoc-ref %build-inputs "sbcl-cl-uglify-js")) + ;; FIXME: cannot use progn here because otherwise it fails to + ;; find cl-uglify-js. + (for-each + write + '(;; Quiet, please! + (let ((*standard-output* (make-broadcast-stream)) + (*error-output* (make-broadcast-stream))) + (asdf:load-system :cl-uglify-js)) + (let ((file (cadr *posix-argv*))) + (if file + (format t "~a" + (cl-uglify-js:ast-gen-code + (cl-uglify-js:ast-mangle + (cl-uglify-js:ast-squeeze + (with-open-file (in file) + (parse-js:parse-js in)))) + :beautify nil)) + (progn + (format *error-output* + "Please provide a JavaScript file.~%") + (sb-ext:exit :code 1)))))))) + (chmod script #o755) + #t))) + (inputs + `(("sbcl" ,sbcl) + ("sbcl-cl-uglify-js" ,sbcl-cl-uglify-js))) + (synopsis "JavaScript compressor"))) -- cgit v1.2.3