Building Synfig using Autotools

Things to know before you start

Synfig is divided into three components: ETL, synfig-core and synfig-studio.

  • ETL - the extended template library.
  • synfig-core - contains the render engine and core/command-line tool (cli)
  • synfig-studio - gui for the application.

All those three components are included with the main source repository of Synfig - https://github.com/synfig/synfig.git.

ETL is required for synfig-core and synfig-core is required for building synfig-studio.

So, first builds ETL, then synfig-core, and then synfig-studio.

First build

We have a special script, which carries all build routines for you. In fact, there are two of them - “2-build-debug.sh” and “2-build-production.sh”.

As you might guess, the first one is for building development version with debug symbols (useful for development itself) and the second one is without debug symbols (useful for production).

Another difference is that first script places result of the build in “_debug/build” subdirectory, and with second script the result will reside in “_production/build”.

In all other aspects both scripts work exactly the same and accept the same arguments.

I will assume that your intention is to develop Synfig, so let’s continue with first script - “2-build-debug.sh”.

You can build everything by simply executing the script:

$ ./2-build-debug.sh

The script will build and install ETL, then synfig-core and finally - synfig-studio.

When building is done, you can launch Synfig by executing

$ ~/synfig.git/_debug/build/bin/synfigstudio

Re-building your changes

Of course it is not very efficient to run a full rebuild process on every change. So, the script provides a set of arguments that allow you to execute particular stages of the build:

The syntax is:

$ ./2-build-debug.sh [package] [phase]

where

  • [package] can have following values:
    • all - builds all three packages (default).
    • etl - builds ETL only.
    • core - builds synfig-core only.
    • studio - builds synfig-studio only.
  • [phase] allows you to choose particular phase to execute for given package:
    • clean - does “make clean” operation.
    • configure - running “./configure” script with all necessary options.
    • make - running “make” command and “make install”.
    • build - executes “configure” and “make” phases (default).
    • full - executes all phases: “clean”, “configure” and “make” (exactly in that order).

You might ask: why execute those commands/phases from a script , while it is possible to call “./configure” and “make” commands by hand in particular directories? Well, for “make” this would work and is desirable for many cases. But for “./configure” you have to specify many parameters, such as prefix, and locations of some dependent libraries. So it is more convenient to call “./configure” using this helper script.

Examples:

  1. Configure and (re)build synfig-core (executes “./configure”, “make” and “make install”):
./2-build-debug.sh core

equivalent to:

./2-build-debug.sh core build
  1. Do a full clean build of synfig-core (executes “make clean”, “./configure”, “make” and “make install”):
./2-build-debug.sh core full
  1. Quick rebuild of synfig-core (without executing “./configure”):
./2-build-debug.sh core make

Since “make” doesn’t require any parameters, the same result can be achieved by executing:

cd ~/synfig.git/_debug/synfig-core/
make install
  1. Quick rebuild of of everything - ETL, synfig-core and synfig-studio (without executing “./configure”):
./2-build-debug.sh all make

Here are some recommendations when to call particular phases:

Considering the structure of Synfig (see first chapter of this article), we have following dependency chain:

synfig-studio -> synfig-core -> ETL

So, you should follow this logic:

  • when change is made to ETL, then rebuild everything - ETL, synfig-core and synfig-studio;
  • when change is made to synfig-core, then you need to rebuild synfig-core and synfig-studio only;
  • when change is made to synfig-studio, then you have to to rebuild synfig-studio only;

You might notice that if you rebuild simply by running “make install” that takes considerably less time than when you do a ful-cycle rebuild with “./configure” and then “make install”.

So, when it is safe to skip “./configure”?

The answer is: if you edited .h and .cpp files only, then it is safe to skip. In all other cases it is safer to re-start ./configure on rebuilding.

Let’s suppose you made changes in synfig-studio (only .h and .cpp files) and want to rebuild it. The following command is enough:

./2-build-debug.sh studio make

And finally a quick note about “build.conf.sample” file in the root of source repository.

With this file you can tweak the number of threads used by the build scripts. Just copy “~/synfig.git/build.conf.sample” to “~/synfig.git/build.conf” and adjust its contents according to your needs.