Source Mage GNU/Linux

Programs Speedtouch Project Snoopy Project eciadsl Project The bread recipe Source Mage BeOS My resume My blog Notes Donation
Programs
Speedtouch Project
Snoopy Project
eciadsl Project
The bread recipe
Source Mage
BeOS
My resume
My blog
Notes
Donation
en fr

Sorcery's INSTALL_ROOT feature revisited

Benoīt PAPILLAULT, 2004-11-23

Goals

We have:
  • existing documentation is not clear (how those variables are defined? how they must be used by spell writer? why install_root is used in the documentation and INSTALL_ROOT in the sorcery source code?)
  • existing implementation is not working (chroot case with glibc spell, or x86_64 cross compilation)
We want:
  • clear documentation that will be a starting point for a clear implementation
  • handle several configuration :
    • normal system
    • chroot system
    • cross compilation system
    • install conflicting spell under different location

Definitions

Since what we are going to define will be used mainly with the autoconf system, it's best to mimic the variable name. We choose name different from those already defined to avoid confusion and to easily check if a code is implementing it properly.

With the autoconf system, BUILD is used to describe the build system, ie the machine where the software is compiled. HOST is used to describe the host system, ie the machine where the software will be run.

  • BUILD_ROOT is the root directory of the system where binaries is installed. It is a directory under the build system. Its default value is /
  • HOST_ROOT is the root directory of the system where binaries are run. It is a directory under the host system. Its default value is /
Both variables are defined by sorcery and must be properly used by spell scripts.

Using BUILD_ROOT and HOST_ROOT in spell

BUILD_API=1 spell

BUILD_API=1 spell are old spells and should be converted to BUILD_API=2 spell.
  • if no BUILD file exist, default_build() function is used instead. So authors of BUILD file should use it as a template. Here is its source code:
    ./configure --prefix="${HOST_ROOT}/usr" \
            --sysconfdir="${HOST_ROOT}/etc" \
         --localstatedir="${HOST_ROOT}/var" \
                --mandir="${HOST_ROOT}/usr/share/man" \
               --infodir="${HOST_ROOT}/usr/share/info" \
      $OPTS &&
    make &&
    prepare_install &&
    make install prefix="${BUILD_ROOT}/usr"
    

BUILD_API=2 spell

  • if no BUILD file exists, default_build() function is used instead. So authors of BUILD file should use it as a template. Here is its source code:
    ./configure --prefix="${HOST_ROOT}/usr" \
            --sysconfdir="${HOST_ROOT}/etc" \
         --localstatedir="${HOST_ROOT}/var" \
                --mandir="${HOST_ROOT}/usr/share/man" \
               --infodir="${HOST_ROOT}/usr/share/info" \
      $OPTS &&
    make
    
  • if no INSTALL file exists, default_install() function is used instead. So authors of INSTALL file should use it as a template. Here is its source code:
    make install prefix="${BUILD_ROOT}/usr"
    

Various way to use BUILD_ROOT feature

Normal system

BUILD_ROOT=/
HOST_ROOT=/

Chroot system or cross-compiled system

In this case, the system must work by doing chroot /mychroot (in the chroot system case) or by copying the /mychroot directory to another machine and running it as the root filesystem.
BUILD_ROOT=/mychroot
HOST_ROOT=/

Normal system but installation under /opt/mozilla-special

This can be used for conflicting spell, like vim and elvis.
BUILD_ROOT=/opt/mozilla-special
HOST_ROOT=/opt/mozilla-special

Normal system, installing into a safe location first

BUILD_ROOT=/opt/safe
HOST_ROOT=/

Further enhancements

As suggested in the existing documentation, we might need some other variables to describe sorcery and grimoire location.
  • SORCERY_ROOT: root of sorcery state files ("${SORCERY_ROOT}/etc/sorcery", "${SORCERY_ROOT}/var/cache/sorcery", "${SORCERY_ROOT}/var/state/sorcery", "${SORCERY_ROOT}/var/log/sorcery", )

    This might be usefull when building a chroot system, to maintain the chroot system state and configuration either in the chroot itself or in any other location, different from the build system.

    Default value: /

  • CODEX_ROOT: root of codex search path. For instance, the stable grimoire will be located at "${CODEX_ROOT}/stable".

    Default value: /var/lib/sorcery/codex

Status

What is described here is not implemented at all.

Links

Valid XHTML 1.0! CSS Valide !
BenoƮt Papillault