Steps of the Compile process

Lara Maia edited this page Oct 7, 2017 · 7 revisions

Normally, you shouldn't need to compile "manually", i.e., without using the Compile tool. However, it is possible to manually run the same commands that Compile uses.


Compiling programs in Linux is typically a three-part process: prepare the sources with ./configure, compile them with make, and install the compiled program with make install.

To this process, Gobo adds a source configuration step to target the GoboLinux directory structure, and after the install phase, a step that symlinks the files from the application directory under /Programs to /System/Index. It is this last step that makes programs "visible" to the GoboLinux system.

These are the relevant commands:

PrepareProgram is a wrapper to the first step described above. SandboxInstall is a wrapper to the third step, ensuring safe execution of "make install". SymlinkProgram performs the final operations that integrate the new program into the system.

Setting up the sources: PrepareProgram

The PrepareProgram script does two things. It creates a directory hierarchy for the program under /Programs, and it attempts to prepare the sources for compilation.

The syntax for the PrepareProgram is:.

    PrepareProgram <program-name> <version-number> [ -- <additional-options> ] 

Passing a program name and version number is mandatory. These names are the ones used in the directories under programs. For example,

    PrepareProgram --tree Foo 1.0 

(the --tree switch) creates the directories /Programs/Foo/Settings, /Programs/Foo/1.0, /Programs/Foo/1.0/bin and so on.

The second task performed by PrepareProgram is to prepare the sources. Since there isn't a standardized format for distribution of source-code tarballs in the free software world, there is no way to implement completely automated preparation. Fortunately, the popularization of the GNU AutoTools brings us much closer.

PrepareProgram, in this second step, will detect availability of preparation tools and perform one of the following:

  1. If the program includes a 'configure' script generated by GNU autoconf, PrepareProgram will run it, passing the necessary options (mainly --prefix, --sysconfdir) as well as any additional options requested by the user in the command line (as <additional-options></additional-options>).
  2. Some authors develop their own 'configure' scripts, but due to the popularity of GNU autoconf, design a command line interface similar to that used by autoconf. PrepareProgram tries to detect if a non-autoconf configure' script accepts at least the --prefix option, and uses it.
In short, PrepareProgram can be considered a wrapper to 'configure'. Instead of running, for example,
    cd foo-1.0
    ./configure --with-shared=yes 

you'll run

    cd foo-1.0
    PrepareProgram Foo 1.0 -- --with-shared=yes 


Strictly speaking, if everything were configured correctly you could simply run "make" and "make install", and all files would be installed under the appropriate subdirectory under Programs/.

To ensure this happens is to guarantee the modularity of the software installation.

To prevent any possibility of files being copied elsewhere in the directory tree than the target under /Programs, GoboLinux conducts the install step in a "sandbox" that is isolated from the rest of the filesystem.

SandboxInstall constructs a container for 'make install'. It uses a sandbox provided by the FiboSandbox script, which configures custom permissions for an allowed set of paths to a special user, fibo. On systems with a UnionFS backend (such as FunionFS, UnionFS-FUSE or OverlayFS), the sandbox is provided by the alternative script UnionSandbox. Installation then runs confined to a sandbox, with no permission to write anywhere but the few places SandboxInstall allows it to, such as /Programs/Foo/Current and /Programs/Foo/Settings. Therefore, no files can be installed in "random places". A typical call to SandboxInstall looks like this:

    SandboxInstall Foo 1.0 

If necessary, additional options can be passed. Refer to the SandboxInstall reference page for details.

Linking the sources: SymlinkProgram

The final step in the compilation of a program is performed by the SymlinkProgram. This is the script responsible for creating the symbolic links under /System/Index.

The syntax for SymlinkProgram is:

    SymlinkProgram program-name [version-number]

The second argument is optional. If no version number is specified, the one linked as Current will be used. A commonly used command-line parameter is &#45;c overwrite, which tells it to overwrite any existing symlinks in case of conflicts (the default action is to preserve the existing links in order to not affect previously existing applications). To integrate a program Foo into the /System structure, overwriting any links, you would type:

    SymlinkProgram -c overwrite Foo 

SymlinkProgram features many command-line switches, to cover more advanced needs. You can refer to the SymlinkProgram reference page for details if necessary.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.