[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#27049: [PATCH 2/2] gnu: Add js-mathjax.
From: |
Ludovic Courtès |
Subject: |
bug#27049: [PATCH 2/2] gnu: Add js-mathjax. |
Date: |
Sat, 03 Jun 2017 15:30:22 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
Hi,
Arun Isaac <address@hidden> skribis:
> These are WIP patches. Please provide feedback.
>
>> + (setenv "PATH" (string-join (map (match-lambda
>> + ((_ . input-path)
>> + (string-append input-path
>> "/bin")))
>> + %build-inputs)
>> + ":"))
>
> It would be nice if this was handled by the trivial-build-system
> itself. Almost all trivial-build-system packages I can think of need
> some variant of this.
You could use ‘set-path-environment-variable’ from (guix build utils) to
slightly simplify this.
>> + (cond
>> + ((string-match "\\.js$" file)
>> + (mkdir-p (dirname install-path))
>> + (system (format #f "uglify-js ~a > ~a" file
>> install-path)))
>
> I have to use `system' instead of `system*' here, because I need to make
> use of ">" to redirect output to a file.
That’s OK, though you could also use ‘open-input-pipe’ from (ice-9
popen):
(let ((minified (open-pipe* OPEN_READ "uglify-js" file)))
(call-with-output-file installed
(lambda (port)
(dump-port minified port))))
> While minifying some files, an ascii decoding error is reported. I'm yet
> to sort that out.
You might need to run that in a UTF-8 locale, which requires adding
glibc-utf8-locales as an input etc.
HTH!
Ludo’.