Official:Compile with CMake

Compiling and Installing using CMake and Scribus 1.3.3.6, 1.3.4, 1.4 or higher
After many years of using the autotools build system, the developers of Scribus have selected CMake as a replacement system. It provides a much more flexible setup with a lot less complexity. It also provides compatibility with build tools on Linux and variants of Unix, Windows and Mac OS X.

To build with the CMake build system you will of course need CMake itself. Most Linux and some Unix distributions provide it as a standard package. If not, please download it, make sure you get a recent version, like 2.4.3 or higher. Mac OS X users can also find installers there, as well as, getting it from macports.org. Scribus does not yet use CMake for Windows, although this may be added in the future.

One of the advantages of CMake is that we can build "out of source". By creating a separate directory where the program is being being compiled, the temporary files and resulting application files are not stored in the same location as the Scribus source files. This helps keep directory structures clean and will also reduce the download time for updating your source tree a little. This is the preferred method and strongly recommended by our developers. CMake is also much simpler to maintain for developers and errors can be understood by mere mortals.

Preparation
Let's assume the following:


 * Scribus source is in a directory like  (where username is your username)
 * CMake is in
 * You want to install into

Starting an Out-of-Source Build

 * Change to the source directory:

 


 * Make a directory to build Scribus in:

 


 * Change to the build directory:

 


 * Then run:

 

If this is the build location you have chosen, please skip down to the Build Stage section

Continuing onto the Build Stage
Once the CMake command you have chosen above has completed successfully (remember it needs to find the dependencies of Scribus and record their locations), then you need to run:

 

Build Options
Some options that the Scribus 1.3.3.x CMake files know about:


 * WANT_VERSIONING=1 : Sets the build to use the VERSION setting as a suffix for the install directories and the binary. Eg, the binary could be scribus-1.3.4cvs. This should mean that you can install multiple versions with the same prefix with no clashes.
 * WANT_DEBUG=1 : Sets the build to be a debug release and use -O0 -g3, instead of -O2 (This is the default for now, and cannot be turned off unless you edit the CMakeFiles.txt file).
 * WANT_CAIRO=1 : Makes CMake search for cairo and build with cairo instead of LibArt_LGPL.
 * WANT_LIBART=1 (default): Makes CMake search for and build with LibArt_LGPL instead of cairo.
 * WANT_NOHEADERINSTALL=1 : Do not install header files used for developers. Distributions should not use this if they split up Scribus into multiple packages.

Some options that the Scribus 1.3.5+ CMake files know about (more to come!):


 * WANT_VERSIONING=1 : Sets the build to use the VERSION setting as a suffix for the install directories and the binary. Eg, the binary could be scribus-1.3.4cvs. This should mean that you can install multiple versions with the same prefix with no clashes.
 * WANT_DEBUG=1 : Sets the build to be a debug release and use -O0 -g3, instead of -O2 (This is the default for now, and cannot be turned off unless you edit the CMakeFiles.txt file).
 * WANT_CAIRO=1 (default): Makes CMake search for cairo and build with cairo instead of Qt's Arthur.
 * WANT_QTARTHUR=1 : Makes CMake search for and build with Qt's Arthur instead of cairo.
 * WANT_NOHEADERINSTALL=1 : Do not install header files used for developers. Distributions should not use this if they split up Scribus into multiple packages.
 * WANT_NORPATH : Turn off setting a specific RPATH.
 * WANT_DISTROBUILD : An option for OS distributors to use for their builds options.
 * WANT_LIB64 : Force 64 bit builds.
 * WANT_RELEASEWITHDEBUG : Set Release style build flags, but also include debug information.
 * WANT_UNIVERSAL_BUNDLE : Mac OS X only, enable building of a .app bundle.
 * WANT_QT4MAC_COCOA : Mac OS X only, enable the Cocoa version Qt4.5+.
 * WANT_QT3SUPPORT : Enable Qt3 support in case you have a custom plugin that you have not converted fully to Qt4. Not needed for base Scribus code.
 * APPLICATION_DATA_DIR : Set the name of the preferences location for Scribus (instead of default of ~/.scribus on *nix and /Users/username/Library/Preferences/Scribus on Mac OS X.)

For example: to make a cairo debug build, then something like this (all on one line):

/usr/bin/cmake. -DCMAKE_INSTALL_PREFIX:PATH=/home/username/scribusinstall -DWANT_CAIRO=1 -DWANT_DEBUG=1 -DWANT_VERSIONING=1

Specifying Library Locations
Whenever your distribution releases their package for a library Scribus depends on, it may still not be the very latest stable or unstable version from the writers of the library. In some cases, the Scribus developers have had to rely on the very latest code to further some parts of Scribus. In this case it is necessary to build your own version of such a library.

On example of this is the cairo graphics library. Right now, 1.3.4+ has the capability to use the very very latest code from the just released cairo 1.4.10 or later and we recommend it for performance reasons as well.

To specify a new cairo install path, other than your system's default add this to the cmake command line:

When system has both Qt3 and Qt4 installed
Systems with both Qt3 and Qt4 installed: You have  and   from Qt4 in the path and it may results to the compilation crash. This should NOT be the case with CMake 2.4.2 and higher, or when using current Scribus SVN. However, this might be a useful workaround:

Remove cached options from previous cmake configuration run from your build location:

Then change PATH variable (for Gentoo) e.g.:

export PATH=/usr/qt/3/bin/:$PATH

And run cmake config phase again:

/usr/bin/cmake. -DCMAKE_INSTALL_PREFIX:PATH=/home/username/scribusinstall/

Making a tarball for distribution
To make a tarball for distribution, the old way would be to.

The new way is to run:

make package_source

or

/usr/bin/cpack -G TBZ2 --config CPackSourceConfig.cmake

to give you a bundle of the source.

Important: If you need to re-run cpack remove the  before running this a second time.

You can also use svn export

/path/to/scribus/svn

in a temporary directory and then tar or zip the directory to create a tarball.

Troubleshooting and Success Stories
If after reading these instructions through and you still have issues, please join us on IRC or post a mail to our mailing list with specifics of your problem. We also are interested in hearing from folks who have successfully compiled Scribus on non-Linux platforms too. We know it is very reliable on Mac OS X as well.