INSTALL_OVERRIDE_DIRS
Some packages are either older than automake or are too complicated for automake to meet their needs. Of those that use autoconf, typically their Makefiles do not honor DESTDIR as they should. For these, we have INSTALL_OVERRIDE_DIRS available.
To use INSTALL_OVERRIDE_DIRS, simply set it to a space-separated list of the path variables (with their names taken from the variable names in gar.conf.mk) that you wish to override. For example, the binutils package's Makefile ultimately says:
prefix = / exec_prefix = / bindir = //bin sbindir = //sbin libexecdir = //libexec datadir = //share sysconfdir = //etc sharedstatedir = //share localstatedir = //var libdir = //lib includedir = /../../home/nick/zootbuild/include oldincludedir = /usr/include infodir = /../../home/nick/zootbuild/info mandir = /../../home/nick/zootbuild/man
- So to override this, we put the following in our package Makefile
INSTALL_OVERRIDE_DIRS = prefix exec_prefix bindir sbindir libexecdir INSTALL_OVERRIDE_DIRS += datadir sysconfdir sharedstatedir INSTALL_OVERRIDE_DIRS += localstatedir libdir includedir infodir INSTALL_OVERRIDE_DIRS += mandir
This allows the Makefile to build software believing that it can find binaries in /bin, but tells the "make install" rule to put them in $(DESTDIR)$(bindir). (/tmp/gar/bin on a standard GAR tree).
- Note that if a Makefile specifies a dir as a relative path, such as
bindir = $(prefix)/bin
Then it shouldn't be necessary to override bindir, provided that prefix has been overridden.
How does this work? Simple, it uses make's overriding of variables on the command line. If we set the following:
INSTALL_OVERRIDE_DIRS = bindir
Then that will run make bindir=$(DESTDIR)$(bindir) install