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 if they contradict each other.
If you know the drill:
tar -jxvf gwyddion-2.4.tar.bz2
cd gwyddion-2.4
./configure
make install
Unpack the source code tarball with
tar -jxvf gwyddion-2.4.tar.bz2or
tar -zxvf gwyddion-2.4.tar.gz
replacing 2.4 with the actual version number. It will create directory
gwyddion-2.4 (again, with the actual version
number in place of 2.4), cd to this directory.
All other compilation actions will take place there.
Tarballs compressed with
bzip2
(.bz2) are considerably smaller than
gzip
compressed tarballs (.gz) but they need bzip2 to
decompress,
which used to be less widespread than gzip, to decompress.
However, modern Unix and Unix-like systems should contain both.
Run
./configureto 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
--prefix=$HOME/opt/gwyddion.
Optional features can be enabled/disabled with options as
--with-fftw3/--without-fftw3
(for FFTW3) and
--with-tiff/--without-tiff
(for LibTIFF).
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.
Run
makeand 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.
Run
make installto 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 installNote 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.
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.