From: ludo@gnu.org (Ludovic Courtès)
To: Arun Isaac <arunisaac@systemreboot.net>
Cc: 26941@debbugs.gnu.org
Subject: bug#26941: New font-build-system
Date: Tue, 23 May 2017 13:33:18 +0200 [thread overview]
Message-ID: <87r2zfx0xt.fsf@gnu.org> (raw)
In-Reply-To: <fcac084e.AEEAKxWCyNIAAAAAAAAAAAOzWv8AAAACwQwAAAAAAAW9WABZH1iD@mailjet.com> (Arun Isaac's message of "Sat, 20 May 2017 02:11:05 +0530")
Arun Isaac <arunisaac@systemreboot.net> skribis:
>> It would be nice to install README, COPYING, and LICENSE if they exist.
>> It’s okay to not do that as a first step though.
>
> I don't see the utility in installing these files. But, if we're not
> doing them in this initial font-build-system, I suppose we can debate
> later.
Yeah no big deal, let’s leave it for later.
>> Also, (standard-packages) is way more than needed (it includes the whole
>> toolchain, etc.; see build-system/gnu.scm). Here all we need is tar,
>> gzip, bzip2, and xz.
>
> I have attempted something for this. I'm not sure I did it the correct
> way. Do let me know.
>
> I actually have very little understanding of what's going on in
> guix/build-system/font.scm. I just copied guix/build-system/emacs.scm
> and modified it a little. Can I find documentation of `bag' fields
> somewhere in the manual?
The only “documentation” of bags is in (guix build-systems) I’m afraid.
In a nutshell, bags are an intermediate representation between packages,
which are abstract and have implicit build inputs for instance, and
derivations, which are very low-level and far away from the concept of a
package.
>> Could you updated it accordingly?
>>
>>> +(define* (install #:key outputs #:allow-other-keys)
>>> + "Install the package contents."
>>> + (let* ((out (assoc-ref outputs "out"))
>>> + (src-dir (getcwd))
>>> + (fonts-dir (string-append out "/share/fonts")))
>>
>> I’d avoid abbreviations in identifiers. So “source” or
>> “source-directory”, etc.
>
> Done!
>
> A side issue: I feel that the `install-file' procedure should print out
> what it's doing to stdout (or some log port). Something like:
>
> (format #t "~a -> ~a~%" source destination)
>
> This would save us the trouble of implementing this log printing
> everywhere `install-file' is called. For example, this could be very
> useful in the 'install' phase of the font-build-sytem. WDYT?
Do we really need to print something in the first place? :-) Some
procedures in (guix build utils) do that, indeed, but I’m not sure it’s
useful for something as simple as ‘install-file’. Thoughts?
> The patches migrating the font packages to the font-build-system are not
> properly complete. I'll send them in after more work. For now, please
> find attached the patch for the font-build-system alone.
OK!
> From 11cd5cf6188316bafd246e64d875e22423227e5e Mon Sep 17 00:00:00 2001
> From: Arun Isaac <arunisaac@systemreboot.net>
> Date: Mon, 15 May 2017 20:08:57 +0530
> Subject: [PATCH 1/5] build-system: Add 'font-build-system'.
>
> * Makefile.am (MODULES): Add 'guix/build-system/font.scm' and
> 'guix/build/font-build-system.scm'.
> * guix/build-system/font.scm: New file.
> * guix/build/font-build-system.scm: New file.
Please mention guix.texi as well.
> +@defvr {Scheme Variable} font-build-system
> +This variable is exported by @code{(guix build-system font)}. It
> +implements an installation procedure for font packages. It copies font
^
I’d write:
… for font packages where upstream provides pre-compiled TrueType,
OpenType, etc. font files that merely need to be copied into place
This is to distinguish from fonts that we build from a FontForge
(whatever it’s called today) source.
> + ,@(let ((compression (resolve-module '(gnu packages compression))))
> + (map (match-lambda
> + ((name package)
> + (list name (module-ref compression package))))
> + `(("tar" tar)
> + ("gzip" gzip)
> + ("bzip2" bzip2)
> + ("xz" xz))))))
This works, but since ‘tar’ is defined in (gnu packages base), it’s
better to take it from there.
Also, prefer ‘resolve-interface’ over ‘resolve-module’: the former
provides access to public/exported bindings only, whereas the latter
provides access to both public and private bindings.
OK with these changes!
> +(define* (unpack #:key source #:allow-other-keys)
> + "Unpack SOURCE into the build directory. SOURCE may be a compressed
> +archive, or a font file."
> + (if (any (cut string-suffix? <> source)
> + (list ".ttf" ".otf"))
> + (begin
> + (mkdir "source")
> + (chdir "source")
> + (copy-file source (strip-store-file-name source))
> + #t)
> + (gnu:unpack #:source source)))
> +
> +(define* (install #:key outputs #:allow-other-keys)
> + "Install the package contents."
> + (let* ((out (assoc-ref outputs "out"))
> + (source (getcwd))
> + (fonts (string-append out "/share/fonts")))
> + (for-each (cut install-file <> (string-append fonts "/truetype/"))
> + (find-files source "\\.ttf$"))
> + (for-each (cut install-file <> (string-append fonts "/opentype"))
> + (find-files source "\\.otf$"))
> + #t))
Do some of the candidate packages provide Type1 fonts? If not, this is
perfect; if we do, then in a future patch we can extend it to support
Type1 as well.
Thank you!
Ludo’.
next prev parent reply other threads:[~2017-05-23 11:34 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-15 15:06 bug#26941: New font-build-system Arun Isaac
2017-05-16 20:17 ` Ludovic Courtès
2017-05-19 20:41 ` Arun Isaac
[not found] ` <fcac084e.AEEAKxWCyNIAAAAAAAAAAAOzWv8AAAACwQwAAAAAAAW9WABZH1iD@mailjet.com>
2017-05-23 11:33 ` Ludovic Courtès [this message]
2017-05-27 18:37 ` Arun Isaac
2017-05-28 18:44 ` User-Friendlyness of Guix and non-scaryness, printing messages Danny Milosavljevic
2017-05-28 19:01 ` Danny Milosavljevic
2017-05-28 20:35 ` Danny Milosavljevic
2017-05-28 20:58 ` Danny Milosavljevic
2017-05-30 15:11 ` Ludovic Courtès
2017-05-28 19:20 ` Leo Famulari
2017-05-28 19:40 ` Danny Milosavljevic
2017-05-28 19:47 ` Leo Famulari
2017-05-28 21:12 ` Ludovic Courtès
2017-05-31 22:26 ` Danny Milosavljevic
2017-06-01 21:41 ` Ludovic Courtès
2017-05-30 8:24 ` Ricardo Wurmus
2017-06-16 11:42 ` Danny Milosavljevic
2017-06-17 20:16 ` Ludovic Courtès
2017-05-30 1:47 ` "guix system" summary output? Danny Milosavljevic
2017-05-30 11:05 ` Danny Milosavljevic
2017-05-30 15:47 ` Ludovic Courtès
2017-05-30 8:17 ` User-Friendlyness of Guix and non-scaryness, printing messages Roel Janssen
2017-05-30 13:56 ` Arun Isaac
2017-05-30 14:32 ` Christopher Allan Webber
2017-05-30 15:58 ` Arun Isaac
2017-05-30 15:13 ` Ludovic Courtès
2017-05-28 19:30 ` ng0
[not found] ` <9591bf82.AEUAKjfDcSkAAAAAAAAAAAOzWv8AAAACwQwAAAAAAAW9WABZKceD@mailjet.com>
2017-05-28 12:38 ` bug#26941: New font-build-system Ludovic Courtès
2017-05-28 13:15 ` Arun Isaac
2017-05-30 21:19 ` Ricardo Wurmus
[not found] ` <37b2bd65.AEMAKxmsz0MAAAAAAAAAAAOzWv8AAAACwQwAAAAAAAW9WABZKs1c@mailjet.com>
2017-05-29 8:51 ` Ludovic Courtès
2017-06-01 13:17 ` Brendan Tildesley
2017-06-01 15:15 ` Arun Isaac
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r2zfx0xt.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=26941@debbugs.gnu.org \
--cc=arunisaac@systemreboot.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.