Installation Instructions
*************************

Requirements
============

  * Rust toolchain: cargo and rustc 1.63 or newer.
  * GNU make (called `gmake' on the BSDs).
  * A C compiler (`cc', or set CC): used to check the system headers when
    generating the installed <inotifytools/inotify.h> and
    <inotifytools/fanotify.h>.
  * For `make check': a C++ compiler (CXX) and bash.  Some fanotify tests
    only run as root.
  * For `make doc': doxygen.
  * On systems other than Linux, the inotify API must be provided by the C
    library (e.g. FreeBSD 15) or by libinotify (libinotify-kqueue).

Basic Installation
==================

    make
    make check
    make install

`make' builds the tools and the library with cargo (release profile), and
generates the headers and man pages.  `make install' installs:

    $(bindir)/inotifywait, inotifywatch
    $(bindir)/fsnotifywait, fsnotifywatch    (symlinks)
    $(libdir)/libinotifytools.so.0.4.1        (SONAME libinotifytools.so.0)
    $(libdir)/libinotifytools.so.0, libinotifytools.so   (symlinks)
    $(libdir)/libinotifytools.a
    $(includedir)/inotifytools/*.h
    $(mandir)/man1/*.1

`make uninstall' removes them again.  `make install-strip' installs stripped
binaries.  `make doc' builds the libinotifytools API documentation with
doxygen and `make install-doc' installs it under $(docdir).

Installation Directories
========================

The usual GNU variables can be set on the make command line:

    prefix       (default /usr/local)
    exec_prefix  (default $(prefix))
    bindir       (default $(exec_prefix)/bin)
    libdir       (default $(exec_prefix)/lib)
    includedir   (default $(prefix)/include)
    datarootdir  (default $(prefix)/share)
    mandir       (default $(datarootdir)/man)
    docdir       (default $(datarootdir)/doc/inotify-tools)
    DESTDIR      staging directory

For example, for a distribution package:

    make prefix=/usr
    make install prefix=/usr libdir=/usr/lib64 DESTDIR="$pkgdir"

Build Options
=============

    CARGO=...          cargo executable
    CARGOFLAGS=...     extra cargo build flags, e.g. --locked --offline
    PROFILE=dev        debug build (default: release)
    TARGET=<triple>    cross compile for a Rust target triple
    CARGO_TARGET_DIR   cargo output directory (default: target)
    ENABLE_SHARED=0    do not install the shared library
    ENABLE_STATIC=0    do not install the static library
    ALL_STATIC=1       link the tools fully statically (needs a static C
                       library, e.g. glibc-static)

The tools are always linked statically against libinotifytools itself, so
they do not need libinotifytools.so at run time.

Linking against the static library from C requires the system libraries
used by the Rust standard library, e.g. on Linux:

    cc prog.c /usr/lib/libinotifytools.a -lgcc_s -lutil -lrt -lpthread -lm -ldl
