Subject: Re: [bug#27449] [PATCH] gnu: Add js-respond.

From: [email-masked] (Ludovic Courtès)
Date: Thu, 22 Jun 2017 18:13:16 +0200

Ricardo Wurmus <[email-masked]> skribis:

> * gnu/packages/javascript.scm (js-respond): New variable.

LGTM.

> +    (build-system trivial-build-system)
> +    (arguments
> +     `(#:modules ((guix build utils))
> +       #:builder
> +       (begin
> +         (use-modules (guix build utils)
> +                      (ice-9 match)
> +                      (ice-9 popen)
> +                      (srfi srfi-26))
> +         (set-path-environment-variable
> +          "PATH" '("bin") (map (match-lambda
> +                                 ((_ . input)
> +                                  input))
> +                               %build-inputs))
> +         (let ((install-directory (string-append %output
> +                                                 "/share/javascript/respond/")))
> +           (system* "tar" "xvf"
> +                    (assoc-ref %build-inputs "source")
> +                    "--strip" "1")
> +           (mkdir-p install-directory)
> +           (let* ((file "src/respond.js")
> +                  (installed (string-append install-directory "respond.min.js")))
> +             (let ((minified (open-pipe* OPEN_READ "uglify-js" file)))
> +               (call-with-output-file installed
> +                 (cut dump-port minified <>)))))
> +         #t)))

Should we turn this into a ‘javascript-build-system’?

Thanks,
Ludo’.