summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/mkjobtexmf/mkjobtexmf.txt
blob: e64edeec071be7aff997f7f78f71cb5ea49d92f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
NAME

    mkjobtexmf -- Generate a texmf tree for a particular job

VERSION

    2011-11-10 v0.8

SYNOPSIS

    The progam mkjobtexmf runs a program and tries to find the used file
    names. Two methods are available, option "-recorder" of TeX (Web2C) or
    the program strace.

    Then it generates a directory with a texmf tree. It checks the found
    files and tries sort them in this texmf tree.

    It can be used for archiving purposes or to speed up following TeX runs.

        mkjobtexmf [options]

    This runs TeX that can be configured by options. Both methods for
    getting the used file names are available.

        mkjobtexmf [options] -- <cmd> [args]

    The latter form runs program *cmd* with arguments *args* instead of TeX.
    As method only program strace is available.

    Options:

        --jobname <name>       Name of the job (mandatory).
                                  Usually this is the TeX file
                                  without extension
        --texname <file>       Input file for TeX. Default is the
                                  job name with extension '.tex'
        --texopt <option>      Option for TeX run
        --destdir <directory>  Destination directory,
                                  default is `<jobname>.mjt'
        --output               Add also output files
        --strace               Use strace instead of TeX's
                                  option -recorder
        --copy                 Copy files instead of creating
                                  symbol links
        --flat                 Junk paths, do not make directories
                                  inside the destination directory
        --(no)texhash          Run texhash, use --notexhash for MiKTeX
        --exclude-ext <ext>    Exclude files with extension <ext>.
        --cmd-tex <cmd>        Command for the TeX compiler
        --cmd-kpsewhich <cmd>  Command for kpsewhich
        --cmd-texhash <cmd>    Command for texhash
        --cmd-strace <cmd>     Command for strace
        --verbose              Verbose output
        --help                 Brief help message
        --man                  Full documentation
        --version              Print version identification

DESCRIPTION

  Running the program

    First mkjobtexmf runs a program, usually TeX. The TeX compiler is
    configured by option "--cmd-tex". Option "--texname" can be used, if the
    file name extension differs from .tex:

        mkjobtexmf --jobname foo --texname foo.ltx

    Even more complicate cases are possible:

        mkjobtexmf --jobname foo --texname '\def\abc{...}\input{foo}'

    If another program than TeX should be used (dvips, ...), then this
    program can be given after "--":

        mkjobtexmf --jobname foo -- dvips foo

  File recording

    Two methods are available to get the used file names:

    Recorder of TeX
        Some TeX distributions (e.g. Web2C) support the option -recorder for
        its TeX compilers. Then the TeX compiler generates a file with
        extension .fls that records the used input and output files.

    Program strace
        This program traces system calls and signals. It is used here to log
        the used files.

  Analyze and link/copy found files

    The result directory *jobname*.mjt is generated. Inside the result TEXMF
    tree is created. Each found file is compared against a list of paths of
    TEXMF trees. If a match is found, the file is linked/copied into the
    TEXMF tree. The list of paths is generated by program kpsewhich.

    If the file cannot be mapped to a TEXMF tree and the file is a relative
    file name, then it is directly linked/copied into the result directory
    *jobname*.mjt. Absolute file names are not supported and neither paths
    with links to parent directories.

    Symbolic links are created by default. The files are copied if option
    "--copy" is given or symbolic linking is not available.

OPTIONS

    --jobname=<*jobname*>
        It is the name of the job. `<*jobname*>.tex' serves as default for
        the TeX file and <*jobname*> is used for naming various directories
        and files. See section "FILES".

    --texname=<*name*>
        The name of the TeX input file, if it differs from <*jobname*>.tex.

    --texopt=<*opt*>
        Additional option for the TeX compiler, examples are "--ini" or
        "--shell-escape". This option can be given more than once.

    --destdir=<*directory*>
        Specifies the name of the destination directory where the result is
        collected. As default a directory is generated in the current
        directory with the job name and extension `.mjt'.

    --output
        Also add output files.

    --strace
        Use method with program strace, see "DESCRIPTION".

    --copy
        Files are copied instead of creating symbolic links.

    --flat
        Files are linked or copied without path elements. The destination
        directory will contain a flat list of files or links without
        directory.

        The files `ls-R' and `aliases' are ignored.

    --exclude-ext=<*ext*>
        Files with extension <*ext*> are excluded. The option can be given
        several times or a comma separated list of extensions can be used.
        Examples:

            --exclude-ext aux --exclude-ext log --exclude-ext toc

        is the same as

            --exclude-ext aux,log,toc

    --(no)texhash
        As default the file `ls-R' is generated in the `texmf' tree, because
        this is the file name database that might be used in TeX Live.
        Because MiKTeX uses a different mechanism, its `texhash' does not
        generate the `ls-R' files and "--notexhash" suppresses the call of
        `texhash'.

    --cmd-tex=<*cmd*>
        Command for the TeX compiler. Default is pdflatex.

    --cmd-kpsewhich=<*cmd*>
        Command for kpsewhich.

    --cmd-texhash=<*cmd*>
        Command for updating the file name database of the generated texmf
        tree. Default is texmf.

    --cmd-strace=<*cmd*>
        Command for strace.

    --verbose
        Verbose messages.

    --help
        Display help screen.

    -B(-man>
        Print manual page.

    --version
        Print version identification and exit.

EXAMPLES

    TeX file test.tex using TeX's recorder method:

        mkjobtexmf --jobname test

    TeX file test.tex using LaTeX:

        mkjobtexmf --jobname test --cmd-tex latex

    Format generation:

        mkjobtexmf --jobname test --texopt -ini --texname pdflatex.ini

    Example, how the new texmf tree (Linux/bash) can be used:

        TEXMF=!!test.mjt/texmf pdflatex test

    Example for generating a zip archive (Linux/bash):

        (cd test.mjt && zip -9r ../test .)

    Example for generating a tar archive:

        tar cjhvf test.tar.bz2 -C test.mjt .

UNSOLVED ISSUES, CAVEATS, TODOS

    Experimental software
        Options, defaults, how the program works might change in future
        versions.

    texmf.cnf
        Currently the method with strace records this files. TeX's recorder
        does not. Useful are texmf.cnf files for variable settings. Because
        we have just one TEXMF tree, the path sections should probably
        rewritten.

    Settings in environment variables
        They are not stored at all.

    Collisions
        The program uses one destination directory and at most one TEXMF
        tree for the result. However, the source files can come from
        different directories and TEXMF trees. Therefore name collisions are
        possible.

        The program follows the strategy not to delete files in the
        destination directory. That allows to collect files from differnt
        runs. Thus collisions are resolved in the manner that the first
        entry that is made in the destination directory wins.

    Configuration file
        It would save the user from retyping the same options again and
        again.

    Uncomplete recording
        Bugs in TeX's file recording might result in incomplete file
        recording (e.g. pdfTeX 1.40.3 does not record .pfb and .pk files).

    ...

FILES

    <jobname>.mjt/
        Directory where the resulting texmf tree and symbol links are
        stored. It can be changed by option "--destdir".

    <jobname>.fls
        Name of TeX's recorder file.

    <jobname>.strace
        Log file where the result of strace is stored.

AUTHOR

    Heiko Oberdiek, email: heiko.oberdiek at googlemail.com

COPYRIGHT AND LICENSE

    Copyright 2007, 2008, 2011 by Heiko Oberdiek.

    This library is free software; you may redistribute it and/or modify it
    under the same terms as Perl itself (Perl Artistic License/GNU General
    Public License, version 2).

HISTORY

    2007/04/16 v0.1

      * First experimental version.

    2007/05/09 v0.2

      * Typo in option name fixed.

    2007/09/03 v0.3

      * New options: "--copy", "--flat", "--destdir"

    2007/09/04 v0.4

      * Bug fix in map_files_texmf.

    2007/09/06 v0.5

      * Support for `configure' added. (Thanks to Norbert Preining for
      writing a first version of the configure stuff.)

    2008/04/05 v0.6

      * Tiny fix in target `uninstall' in file `Makefile.in'. (Thanks to
      Karl Berry)

    2008/06/28 v0.7

      * Fix for unknown option `"--cmd-strace"'. (Thanks to Juho Niemelä)

    2011/11/10 v0.8

      * Remove colon from drive specification when making directories.
      * Option "--(no)texhash" added.
      * Some support for MiKTeX (thanks Ulrike Fischer).
      * Various fixes in the generation of the documentation.
      * Options "--exclude-ext" and "--version" added.