Linux/Unix from Source Code Tarball

Gwyddion Unix build system is based on GNU autotools (autoconf, automake, libtool), like most of current Unix Free and Open Source Software. If you have ever compiled software from source code, you very likely met autotools and already know how to proceed. This section shall describe the compilation procedure in enough detail even for the uninitiated though. File INSTALL in the top-level directory of the source tarball contains generic GNU autotools installation instructions. Gwyddion specific information can be found in file INSTALL.gwyddion. Since this file comes with a particular version of Gwyddion it may contain more concrete or up-to-date information and you should follow it instead of this general guide should they disagree.

Quick Instructions

If you know the drill:

tar -jxvf gwyddion-2.16.tar.bz2
cd gwyddion-2.16
./configure
make install

Source Unpacking

Unpack the source code tarball with

tar -jxvf gwyddion-2.16.tar.bz2

replacing 2.16 with the actual version number. It will create directory gwyddion-2.16 (again, with the actual version number in place of 2.16), cd to this directory. All other compilation actions will take place there.

If your operating system does not come with bzip2 you might want to download gwyddion-2.16.tar.gz (compressed with gzip) instead and unpack it with

tar -zxvf gwyddion-2.16.tar.gz

However, modern Unix and Unix-like systems come with both bzip2 and gzip so, the considerably smaller gwyddion-2.16.tar.bz2 should be normally the better choice.

Configuration

Run

./configure

to configure Gwyddion.

The configure shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a Makefile in each directory of the package, a couple of header .h files containing system-dependent definitions and a few other system-dependent auxiliary files. Finally, it creates a shell script config.status that you can run in the future to recreate the current configuration, and a file config.log. This file contains the details of the detection process and it is helpful to include it in compilation related bug reports.

If configure reports missing required packages, install these packages and re-run it. The same applies to the case when configure passes but you find you have not installed an optional package you want to compile Gwyddion with. It is possible a package is not found or it is misdetected even if you have installed it, namely when it is installed into a non-standard directory. In this case it is necessary to adjust certain environment variables to make configure able to find the packages:

PKG_CONFIG_PATH

Most packages come with so called pkg-config files (.pc) that describe how programs should compile and link with them. configure uses information from these files, therefore PKG_CONFIG_PATH must be set to list all non-standard directories with relevant pkg-config files. To add for instance a Gtk+ installation in /opt/gnome and a FFTW3 installation in $HOME/opt/fftw3 one can do PKG_CONFIG_PATH=/opt/gnome/lib/pkgconfig:$HOME/opt/fftw3/lib/pkgconfig; export PKG_CONFIG_PATH

PATH, LD_LIBRARY_PATH

It may be necessary to adjust these variables to include non-standard directories with executables and libraries of relevant packages, respectively.

CPPFLAGS, LDFLAGS

It may be necessary to adjust these variables to include non-standard directories with header files and libraries of packages that do not come with pkg-config files, for example for libTIFF in /usr/local one can do CPPFLAGS=-I/usr/local/include; export CPPFLAGS and LDFLAGS=-L/usr/local/lib; export LDFLAGS.

The directory Gwyddion will install to and various optional features can be enabled/disabled with configure command line options. To obtain the complete list of these options, run

./configure --help

Option --prefix sets the base installation directory. Program components will be installed into its bin, lib, share, etc. subdirectories (they will be created if they do not exist). More detailed control is possible with options specifying particular subdirectories as --bindir, --libdir. The default prefix is /usr/local/bin, to install Gwyddion to your home directory you may want to use for instance

./configure --prefix=$HOME/opt/gwyddion

Configuration tweaks

Optional features can be enabled/disabled with options such as --with-fftw3/--without-fftw3 (for FFTW3):

./configure --with-fftw3

By default all optional features are enabled if their prerequisites are found. A brief summary enabled and disabled optional features is printed near the end of configure output.

Certain auxiliary installation actions can be disabled in configure: Updating of Freedesktop files can be disabled with --disable-desktop-file-update. Installation of GConf2 schemas can be disabled with --disable-schemas-install. However, the usual reason for disabling these actions is that Gwyddion is installed into a staging area instead of the final directory (commonly done when building Linux packages). In this case the auxiliary actions are disabled automatically by non-empty DESTDIR (see installation) and hence they need not be disabled in configure.

Compilation

Run

make

and wait until Gwyddion is compiled. If configure finished without errors the compilation should pass too.

If you need to do unusual things to compile the package, please try to figure out how configure could detect whether and what to do, and e-mail patches or instructions to the bug-report address so they can be considered for the next release.

Installation

Run

make install

to install Gwyddion to the target directory. If you install Gwyddion to a system directory you have to become root for running this command, for example using sudo:

sudo make install

Note Gwyddion has to be installed to be run, it is not possible to run it uninstalled.

To install Gwyddion to a staging area, for example for packaging, set make DESTDIR variable to a prefix that will be prepended to all target directories:

make install DESTDIR=/var/tmp/gwyddion-buildroot

Do not override individual directory variables as bindir, libdir.

If you do not install to a system directory, e.g. install to a subdirectory of your home directory, you may need to adjust the following variables during installation:

  • GCONF_SCHEMA_CONFIG_SOURCE – location of GConf2 schemas
  • KDE4_MODULE_DIR – location of KDE4 modules

Also, variable XDG_DATA_DIRS might need to be adjusted after installation to get full desktop integration.

Deinstallation

Run

make uninstall

in the directory you previously compiled Gwyddion to remove it. If you have lost the source directory meanwhile you can try to unpack, configure and build it exactly as before and then issue make uninstall, although this relies on your ability to reproduce the build process.

RPM Packages

It is possible to build RPM packages on RPM-based GNU/Linux distributions directly from source code tarballs with

rpmbuild -tb gwyddion-2.16.tar.bz2

where 2.16 is to be replaced with the actual version as above. This method was tested mainly on Fedora, openSuSE and Mandriva and the RPM spec file contains some specific provisions for these systems. Specific support for other RPM-based systems can be added on request.