Copyright © 2001–2007 Christian Schenk
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Free Software Foundation.
Table of Contents
This article is about MiKTeX packaging: You will learn how to maintain a custom package repository.
A few utilities are required:
cabextract is used intnernally (by MPC) to extract files from cabinet files. It is a part of the Cygwin distribution for Windows.
lzma is used intnernally (by MPC) to
extract files from .tar.lzma files. It is a part of the
Cygwin distribution for Windows.
MD5Walk is used to calculate the fingerprint of a package. The source code of MD5Walk can be obtained from the MiKTeX project page.
The MiKTeX Package Creator (MPC) is used to maintain the contents of a custom package repository. The source code of MPC can be obtained from the MiKTeX project page.
rsync is used to initialize the custom package repository. It is a part of the Cygwin distribution for Windows.
tar is used internally (by MPC) to create package archive files. It is a part of the Cygwin distribution for Windows.
All but MPC and MD5Walk are standard utilities which are available on all platforms (Windows, GNU/Linux, …). The portable source code of mpc and md5walk can be obtained from the MiKTeX project page.
A custom package repository can be initialized with the help of rsync as follows:
>mkdir C:\package-repository>cd C:\package-repository>rsync -av rsync://www.ctan.org/SYSTEMS/win32/miktex/tm/packages/ .
This will download a snapshot of the remote package repository to
C:\package-repository.
The package staging directory contains all the bits and pieces you will need in order to add a package to the custom package repository.
Basically, the staging directory contains the following:
Description (optional)The Description file contains
a mult-line description of the package.
Files (optional)The Files sub-directory contains
the actual files of the package.
package.ini (required)The package.ini file contains
basic information about the package.
The Description file and the
Files sub-directory are optional. The
package.ini file is required.
The Files directory contains just
the sub-directory texmf, which is the
root of a TDS tree populated with the actual files of the package.
For example, Files could contain
two files: mystuff.sty and
mystuff.pdf:
Files\texmf\tex\latex\mystuff\mystuff.sty Files\texmf\doc\latex\mystuff\mystuff.pdf
The file package.ini contains basic
information about the package:
stringThe deployment name of the package. This is the base name of the package archive file.
hexstringThe fingerprint of the package.
stringThe user friendly name of the package.
stringThe title of the package.
The fingerprint must be calculated with the help of the md5walk utility (see below).
Here is a sample package.ini:
externalname=mystuff md5=f3fa2edf7bfd8ae692880b59fa246650 name=My stuff title=Provides my style files.
The fingerprint has been calculated as follows:
>cd C:\staging\mystuff>md5walk --exclude=.tpm Filesf3fa2edf7bfd8ae692880b59fa246650>
You use the MPC utility to add a package to your custom package package repository.
Here is a sample invocation:
>cd C:\staging\mystuff>mpc --create-package --repository=C:\package-repository --verboseLoading database from C:\package-repository... Reading staging directory C:\staging\mystuff... Checking C:\package-repository\mystuff.tar.lzma... Creating mystuff.tar.lzma... Writing database to C:\package-repository...>
MPC is run from the staging directory C:\packages\mystuff.