5.2. File-5.31

The File package contains a utility for determining the type of a given file or files.

5.2.1. Installation of File

One method that file uses for identifying a given file is to run “magic tests”, where it compares the file's contents to data in “magic files”, which contain information about a number of standard file formats. When File is compiled, it will run file -C to combine the information from the magic files in its source tree into a single magic.mgc file, which it will use after it is installed. When we build File in Constructing a Temporary System, it will be cross-compiled, so it will not be able to run the file program that it just built, which means that we need one that will run on the host system.

Prepare File for compilation:

./configure \
    --prefix=/cross-tools

The meaning of the configure options:

--prefix=/cross-tools

This tells the configure script to prepare to install the package in the /cross-tools directory.

Compile the package:

make

Install the package:

make install

Details on this package are located in Section 10.42.2, “Contents of File.”