diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2013-03-09 13:58:48 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2013-03-09 13:58:48 +0000 |
commit | 509c439302e0bd1a27492a0dc7a6c8b980991811 (patch) | |
tree | ee08e3cc634eeae450dd5ebd5f8c34b089c014e1 | |
parent | 8f97943e2aa1c294278b1ed6308f4e587d1ad2fa (diff) |
fc-cache] Add '-c' option fc-cache to chroot on startup
before (re)building the font cache. Useful for builds with
$DESTDIR set, to prepare a binary distribution.
-rw-r--r-- | dist/fontconfig/fc-cache/fc-cache.1 | 36 | ||||
-rw-r--r-- | dist/fontconfig/fc-cache/fc-cache.c | 18 | ||||
-rw-r--r-- | dist/fontconfig/fc-cache/fc-cache.sgml | 12 |
3 files changed, 48 insertions, 18 deletions
diff --git a/dist/fontconfig/fc-cache/fc-cache.1 b/dist/fontconfig/fc-cache/fc-cache.1 index f111f8681..1c6ef7adf 100644 --- a/dist/fontconfig/fc-cache/fc-cache.1 +++ b/dist/fontconfig/fc-cache/fc-cache.1 @@ -1,10 +1,16 @@ -.\" auto-generated by docbook2man-spec from docbook-utils package -.TH "FC-CACHE" "1" "Aug 13, 2008" "" "" +.\" This manpage has been automatically generated by docbook2man +.\" from a DocBook document. This tool can be found at: +.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> +.\" Please send any bug reports, improvements, comments, patches, +.\" etc. to Steve Cheng <steve@ggi-project.org>. +.TH "FC-CACHE" "1" "20 January 2013" "" "" + .SH NAME fc-cache \- build font information cache files .SH SYNOPSIS -.sp -\fBfc-cache\fR [ \fB-frsvVh\fR ] [ \fB--force\fR ] [ \fB--really-force\fR ] [ \fB--system-only\fR ] [ \fB--verbose\fR ] [ \fB--version\fR ] [ \fB--help\fR ] [ \fB\fIdir\fB\fR\fI...\fR ] + +\fBfc-cache\fR [ \fB-cfrsvVh\fR ] [ \fB--chroot root\fR ] [ \fB--force\fR ] [ \fB--really-force\fR ] [ \fB--system-only\fR ] [ \fB--verbose\fR ] [ \fB--version\fR ] [ \fB--help\fR ] [ \fB\fIdirs\fB\fR\fI ...\fR ] + .SH "DESCRIPTION" .PP \fBfc-cache\fR scans the font directories on @@ -14,7 +20,7 @@ applications using fontconfig for their font handling. If directory arguments are not given, \fBfc-cache\fR uses each directory in the current font configuration. Each directory is scanned for -font files readable by FreeType. A cache is created which +font files readable by FreeType. A cache is created which contains properties of each font and the associated filename. This cache is used to speed up application startup when using the fontconfig library. @@ -25,30 +31,34 @@ for that architecture. .SH "OPTIONS" .PP This program follows the usual GNU command line syntax, -with long options starting with two dashes (`-'). A summary of +with long options starting with two dashes (`-'). A summary of options is included below. .TP -\fB-f\fR +\fB-c root --chroot root \fR +Change root directory into root +before starting. +.TP +\fB-f --force \fR Force re-generation of apparently up-to-date cache files, overriding the timestamp checking. .TP -\fB-r\fR +\fB-r --really-force \fR Erase all existing cache files and rescan. .TP -\fB-s\fR +\fB-s --system-only \fR Only scan system-wide directories, omitting the places located in the user's home directory. .TP -\fB-v\fR +\fB-v --verbose \fR Display status information while busy. .TP -\fB-h\fR +\fB-h --help \fR Show summary of options. .TP -\fB-V\fR +\fB-V --version \fR Show version of the program and exit. .TP -\fB\fIdir\fB\fR +\fB\fIdir\fB \fR Directory to scan for fonts. .SH "FILES" .TP diff --git a/dist/fontconfig/fc-cache/fc-cache.c b/dist/fontconfig/fc-cache/fc-cache.c index 220609604..91b4fea55 100644 --- a/dist/fontconfig/fc-cache/fc-cache.c +++ b/dist/fontconfig/fc-cache/fc-cache.c @@ -65,6 +65,7 @@ #define _GNU_SOURCE #include <getopt.h> const struct option longopts[] = { + {"chroot", 0, 0, 'c'}, {"force", 0, 0, 'f'}, {"really-force", 0, 0, 'r'}, {"system-only", 0, 0, 's'}, @@ -273,16 +274,20 @@ main (int argc, char **argv) int i; int changed; int ret; + char *destdir = NULL; #if HAVE_GETOPT_LONG || HAVE_GETOPT int c; #if HAVE_GETOPT_LONG - while ((c = getopt_long (argc, argv, "frsVvh", longopts, NULL)) != -1) + while ((c = getopt_long (argc, argv, "c:frsVvh", longopts, NULL)) != -1) #else - while ((c = getopt (argc, argv, "frsVvh")) != -1) + while ((c = getopt (argc, argv, "c:frsVvh")) != -1) #endif { switch (c) { + case 'c': + destdir = optarg; + break; case 'r': really_force = FcTrue; /* fall through */ @@ -309,7 +314,14 @@ main (int argc, char **argv) #else i = 1; #endif - + if (destdir) { + if (chroot(destdir) == -1) { + fprintf(stderr, "%s: Can't chroot to %s: %s\n", argv[0], destdir, + strerror(errno)); + return 1; + } + systemOnly = FcTrue; + } if (systemOnly) FcConfigEnableHome (FcFalse); config = FcInitLoadConfig (); diff --git a/dist/fontconfig/fc-cache/fc-cache.sgml b/dist/fontconfig/fc-cache/fc-cache.sgml index 3740be77f..1a0c6b95a 100644 --- a/dist/fontconfig/fc-cache/fc-cache.sgml +++ b/dist/fontconfig/fc-cache/fc-cache.sgml @@ -63,14 +63,15 @@ manpage.1: manpage.sgml <cmdsynopsis> <command>&dhpackage;</command> - <arg><option>-frsvVh</option></arg> + <arg><option>-cfrsvVh</option></arg> + <arg><option>--chroot <replacable>root</replacable></option></arg> <arg><option>--force</option></arg> <arg><option>--really-force</option></arg> <arg><option>--system-only</option></arg> <arg><option>--verbose</option></arg> <arg><option>--version</option></arg> <arg><option>--help</option></arg> - <arg rep="repeat"><option><replaceable>dir</replaceable></option></arg> + <arg rep="repeat"><option><replaceable>dirs</replaceable></option></arg> </cmdsynopsis> </refsynopsisdiv> @@ -103,6 +104,13 @@ manpage.1: manpage.sgml <variablelist> <varlistentry> + <term><option>-c <replacable>root</replacable></option> + <option>--chroot <replacable>root</replacable></option> + </term> + <listitem> + <para>Change root directory into <replacable>root</replacable> + before starting.</para> + </listitem> <term><option>-f</option> <option>--force</option> </term> |