6.31. File-5.03

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

6.31.1. Environment Settings

This package requires compiler variables to be set for the target in the environment.

export CC="${CLFS_TARGET}-gcc"
export CXX="${CLFS_TARGET}-g++"
export AR="${CLFS_TARGET}-ar"
export AS="${CLFS_TARGET}-as"
export RANLIB="${CLFS_TARGET}-ranlib"
export LD="${CLFS_TARGET}-ld"
export STRIP="${CLFS_TARGET}-strip"

6.31.2. Installation of File

The following patch will fix a compile issue that would prevent a proper creation of the magic.mgc file. This would show up as an error messsage. ERROR: file: File 5.03 supports only 6 version magic files. `/tools/share/file/magic.mgc' is version 2:

patch -Np1 -i ../file-5.03-cross_compile-1.patch

Prepare File for compilation:

./configure --build=${CLFS_HOST} --host=${CLFS_TARGET} \
    --prefix=/usr

Compile the package:

make

Install the package:

make DESTDIR=${CLFS} install

6.31.3. Contents of File

Installed programs: file
Installed library: libmagic.[a,so]

Short Descriptions

file

Tries to classify each given file; it does this by performing several tests—file system tests, magic number tests, and language tests

libmagic

Contains routines for magic number recognition, used by the file program