1.9. PNG support: Installing from Source Code

These instructions should be followed if your system does not provide zlib, libpng and gd as optionally installable components. For example, all common Linux distributions do provide these components on the distribution DVD or CDs. Most other operating systems (e.g. IRIX and Solaris) provide zlib as standard but do not provide libpng or gd: they can usually be downloaded precompiled from freeware sites or installed from a companion CD distributed with the operating system. Unfortunately, such freeware has been known to be less than rigorously tested by the hardware companies, or it is too out-of-date to be usable by EMBOSS, and so you may find that you have no option but to compile the libraries yourself from source code.

Before compiling PNG support yourself, read any operating system specific notes for your machine in this chapter.

zlib, libpng and gdIt is imperative that and zlib, libpng and gd files are installed under the same directory tree. The exception is when some of the above components are in standard UNIX library directories and are provided along with the operating system. Standard system library directories usually have names like /lib or /usr/lib. As an example, on most UNIX operating systems, zlib is provided as standard: you therefore only have to install libpng and gd and those should be installed under their own common directory tree. Most UNIX software, when compiled from its source code, will install into the /usr/local directory tree. It's recommended you follow this tradition.

Caution

Note that /usr/local is not regarded as a 'standard system directory' as its name implies. If you already have some of the PNG components installed under the /usr/local directory tree then you should certainly install the rest of the components there as well.

PNG. The PNG components must be installed in the order zlib, libpng and finally gd.

zlib compilation. The procedure for zlib compilation is as follows.

  1. Do a final check to see whether your system already has zlib installed.

    a) On Linux RPM based systems type:

    rpm -q zlib
    rpm -q zlib-devel or just
    rpm -qa "zlib*"

    both library and development packages should be shown. If not then install the relevant RPMs from your distribution DVD or CDs.

    b) On Linux Debian based systems type:

    dpkg --list zlib1g
    dpkg --list zlib1g-dev

    both should give a positive response. If not then install the relevant deb files from your distribution DVD or CDs.

    c) On other Unix systems look in any system library directories (those named lib or lib64 depending on your system) for a file called libz.so. A command that will usually find this file is:

    find /usr -name libz.so -print

    If the file is not found in a standard system directory then it's recommended you compile your own for use with EMBOSS.

  2. Get the zlib source code

    This can be downloaded from http://www.zlib.net . This assumes version 1.2.3 is being used. Use whatever is the latest version of zlib. See the current versions section of this chapter.

  3. In a temporary directory type:

    gunzip zlib-1.2.3.tar.gz
    tar xf zlib-1.2.3.tar
    rm zlib-1.2.3.tar
    cd zlib-1.2.3
  4. Compile zlib:

    ./configure --shared --prefix=/usr/local
    make
    make install

    This will install the library and development files under the /usr/local directory tree.

  5. Delete the zlib source code:

    cd ..
    rm -rf zlib-1.2.3

1.9.1. LIBPNG Compilation

  1. Do a final check to see whether your system already has libpng installed.

    a) On Linux RPM based systems type:

    rpm -q libpng
    rpm -q libpng-devel or just
    rpm -qa "libpng*"

    both library and development packages should be shown. If not then install the relevant RPMs from your distribution DVD or CDs.

    a) On Linux Debian based systems type:

    dpkg --list libpng12-0
    dpkg --list libpng12-dev

    both should give a positive response. If not then install the relevant deb files from your distribution DVD or CDs.

    c) On other Unix systems look in any system library directories (those named lib or lib64 depending on your system) for a file called libpng.so. A command that will usually find this file is:

    find /usr -name libpng.so -print

    If the file is not found in a standard system directory then it's recommended you compile your own for use with EMBOSS.

  2. Get the libpng source code

    This can be downloaded from http://www.libpng.org . This example assumes that version 1.2.38 is being used. Always use the latest version. See the current versions section of this chapter.

  3. In a temporary directory type:

    gunzip libpng-1.2.38.tar.gz
    tar xf libpng-1.2.38.tar
    rm libpng-1.2.38.tar
    cd libpng-1.2.38
  4. Compile libpng

    ./configure --prefix=/usr/local
    make
    make install

    This will install the library and development files under the /usr/local directory tree.

  5. Delete the LIBPNG source code:

    cd ..
    rm -rf libpng-1.2.38

1.9.2. gd Compilation

  1. Do a final check to see whether your system already has gd installed.

    a) On Linux RPM based systems type:

    rpm -q gd
    rpm -q gd-devel or just
    rpm -qa "gd*"

    both library and development packages should be shown. If not then install the relevant RPMs from your distribution DVD or CDs.

    b) On Linux Debian based systems type:

    dpkg --list libgd2-xpm
    dpkg --list libgd2-xpm-dev

    both should give a positive response. If not then install the relevant deb files from your distribution DVD or CDs.

    c) On other Unix systems look in any system library directories (those named lib or lib64 depending on your system) for a file called libgd.so. A command that will usually find this file is:

    find /usr -name libgd.so -print

    If the file is not found in a standard system directory then it's recommended you compile your own for use with EMBOSS.

  2. Get the gd source code

    This can be downloaded from http://www.libgd.org . This example assumes that version 2.0.35 is being used. Always use the latest version. See the current versions section of this chapter. Versions of gd lower than 2.0.28 are completely unsuitable as they lack required GIF support.

  3. In a temporary directory type:

    gunzip gd-2.0.35.tar.gz
    tar xf gd-2.0.35.tar
    rm gd-2.0.35.tar
    cd gd-2.0.35
  4. Compile gd:

    ./configure --prefix=/usr/local --with-png=/usr/local --without-freetype --without-fontconfig --without-jpeg --without-xpm
    make
    make install

    This will install the library and development files under the /usr/local directory tree.

  5. Delete the gd source code:

    cd ..
    rm -rf gd-2.0.35

Note

Note that freetype, fontconfig, jpeg and xpm functionality of the gd library has been disabled. These are not required for EMBOSS; only the PNG functionality is needed. If you have any of the other libraries installed then you can optionally amend the configuration line accordingly.