3.2. Integration and Compilation

3.2.1. Using myemboss for Application Development

The myemboss package is an almost empty EMBASSY package where developers can safely build their own EMBOSS applications. It provides a way to isolate local application development from the rest of EMBOSS so preserving the integrity of the package. New applications, regardless of whether they are destined for another EMBASSY package or EMBOSS itself, will typically start their life in myemboss.

myemboss requires the GNU tools autoconf, automake and libtool to be installed (see Section 1.2, “Installation of CVS (Developers) Release”). Using the GNU tools you can add new applications very easily. myemboss provides a directory structure and Makefile stubs for integrating new applications. Application ACD files go in the myemboss/emboss_acd directory and source code into the myemboss/src directory.

Applications are built using a Makefile file, but you do not need to edit this file directly. Instead you edit a file Makefile.am which automake converts into a file Makefile.in and configure converts into the Makefile file.

The Makefile.am file is shown below and has been edited to include two applications:

#

SUBDIRS = source emboss_acd emboss_doc

EXTRA_DIST = depcomp ltmain.sh install-sh config.sub config.guess

# tar to pick up the other directories
# then remove any CVS subdirectories

dist-hook:
	tar cBf - emboss_acd | ( cd $(distdir); tar xBf - ; cd emboss_acd; rm -rf CVS) 
	tar cBf - emboss_doc | ( cd $(distdir); tar xBf - ; cd emboss_doc; rm -rf CVS; rm -rf master) 

To compile applications in myemboss, you must configure the package if you have not already done so (see Section 1.2, “Installation of CVS (Developers) Release”), then type the following from the myemboss applications directory (myemboss/src):

make

make will regenerate the Makefile file and build your new application, linking it to the EMBOSS libraries (AJAX and NUCLEUS).

This assumes you have installed and configured EMBOSS and the myemboss package. If you did a full EMBOSS install using make install then you must also type:

make install

to complete the installation of applications developed under myemboss.

For more information on installation see Section 1.2, “Installation of CVS (Developers) Release” and the EMBOSS Administrators Guide.

3.2.2. Adding New EMBOSS Applications

An application that has been developed and tested in myemboss can be added to the main package. Adding new applications to EMBOSS is essentially the same as for myemboss. EMBOSS has its own Makefile.am which, in contrast to myemboss, organises applications into two strands:

  • Standard EMBOSS applications (the "make" applications) are listed after the bin_PROGRAMS line

  • Applications that are not yet fully integrated ("make check" applications) are listed after the check_PROGRAMS line.

Applications which are not entirely complete should be put into the "make check" area of the emboss/Makefile.am file. For example, applications which compile and work correctly, but for which full documentation and quality assurance tests are not yet available, should go here. Only applications which are fully working, tested and documented should go into the "make" area.

An excerpt from the Makefile.am file is below and includes a few "make check" applications and standard "make" applications:

SUBDIRS = acd data

EXTRA_DIST = emboss.default.template

if ISSHARED
if ISAIXIA64
AM_CFLAGS = -Wl,-bdynamic -Wl,-brtl -L../ajax/.libs -lajax
else
AM_CFLAGS =
endif
endif


check_PROGRAMS = acdlog acdxsd ajtest \
complex corbatest \
entrails entrailsbook entrailshtml entrailswiki giep histogramtest intconv \
origsplitter origunion \
newcoils \
... <lines omitted for brevity> 


bin_PROGRAMS = aaindexextract abiview \
acdc acdpretty acdtable acdtrace acdvalid \
aligncopy aligncopypair antigenic \
backtranambig backtranseq banana biosed btwisted \
... <lines omitted for brevity> 

water whichdb wobble \
wordcount wordfinder wordmatch wossname \
yank

INCLUDES = -I$(top_srcdir)/nucleus -I$(top_srcdir)/ajax -I$(top_srcdir)/plplot

aaindexextract_SOURCES = aaindexextract.c
abiview_SOURCES = abiview.c
acdc_SOURCES = acdc.c
acdpretty_SOURCES = acdpretty.c
acdtable_SOURCES = acdtable.c

... <lines omitted for brevity> 

seqretsingle_SOURCES = seqretsingle.c
seqrettype_SOURCES = seqrettype.c
testplot_SOURCES = testplot.c
treetypedisplay_SOURCES = treetypedisplay.c

# Uncomment to use dual libraries
if ISCYGWIN
LDADD = ../nucleus/libnucleus.la ../ajax/libajax.la ../plplot/libeplplot.la $(XLIB)
else
LDADD = ../nucleus/libnucleus.la ../ajax/libajaxg.la ../ajax/libajax.la ../plplot/libeplplot.la $(XLIB)
endif

pkgdata_DATA = emboss.default.template
pkgdatadir=$(prefix)/share/$(PACKAGE)

#if PURIFY
#  LINK = purify $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
#else
#
#endif


Compilation is the same as for myemboss. You must configure the EMBOSS package if you have not already done so (see Section 1.2, “Installation of CVS (Developers) Release”), then from the applications directory (e.g. /home/auser/emboss/emboss/emboss/) type:

make

This will regenerate the Makefile file, build your new application and link it to the libraries. If you installed EMBOSS using make install then you must also type:

make install

to complete the installation of the new application.

For more information on installation see Section 1.2, “Installation of CVS (Developers) Release” the EMBOSS Administrators Guide.

3.2.3. Adding New EMBASSY Applications

Applications are added to EMBASSY packages in exactly the same way as for myemboss (see above).

3.2.4. Adding a New EMBASSY Package

To add an entirely new EMBASSY package you must:

  1. Create the directory structure and required files for the package under the main EMBASSY directory (.../emboss/emboss/embassy/).

  2. Write the application ACD and C source code files and populate the appropriate directories.

  3. Edit the Makefile.am files.

  4. Edit the configure.in file.

  5. Create the application documentation and populate the appropriate directories.

3.2.4.1. Directory Structure

The directory structure and file names are mostly the same regardless of the package. For example, the hmmernew EMBASSY package looks like this:

% cd emboss/emboss/embassy/hmmernew/
% ls
AUTHORS       COPYING  emboss_acd  ltmain.sh    NEWS    Userguide.pdf
ChangeLog     CVS      emboss_doc  m4           README
configure.in  DOCS     INSTALL     Makefile.am  src

The required directories are as follows:

src

The "applications directory" holding the application C source code. This should contain a Makefile.am file (see below).

emboss_acd

The "ACD directory" holding the application ACD files. This should contain a Makefile.am file (see below).

emboss_doc

The "documentation directory". This contains the following sub-directories:

  • html" : documentation in HTML format

  • text : documentation in plain text format

  • master : documentation in final format with include files

There is a Makefile.am file in this directory and in the html" and text subdirectories, all of which need editing (see below) when the new package is created.

There is an semi-automated process (Section 8.1, “Application Documentation Standards”) used to create the files of documentation in these directories .

DOCS

This was intended for peripheral documentation but is not currently used.

m4

This contains macro files used in the automake process. The files can be copied from another EMBASSY package.

Additionally, some packages may have the following directories:

include

Header files that are specific to the package.

data

Data files that are specific to the package.

The CVS directory only appears if the package has been committed to the CVS server.

The required files are as follows. If you omit any of these then the GNU software will complain when you come to bundle the EMBASSY package into a distribution file; the GNU software will then usually add a default file:

README

This is the package user guide and normally contains general comments about the package as a whole such as installation instructions, usage notes and so on. It should not normally contain documentation about individual applications. The README is not strictly required but is very highly recommended, especially where the package contains wrappers to third-party applications (see Chapter 10, Incorporating Third-party Applications) and there are differences between the original applications and the wrappers.

COPYING

Copyright or other information on usage restrictions. This might just be a reference to the README file where such information is given, or contain the GPL licence or something else.

INSTALL

Standard installation instructions for EMBASSY packages. This file can be copied from another EMBASSY package.

NEWS

Package version information. It is used in making a bundled distribution file (via make dist).

AUTHORS

Author contact details. Where an EMBASSY package contains wrapper applications, both the authors of the original software and the EMBASSY package should be mentioned.

ChangeLog

The log file of changes made to the package. It is helpful to provide one but not strictly necessary.

configure.in

The configure file that is processed using autoconf to produce a configure script (see Section 1.2, “Installation of CVS (Developers) Release”). It should be copied from another EMBASSY package but requires some simple customisation before it can be used (see Section 3.2.4.3, “Editing the configure.in Files”).

ltmain.sh

The libtool package front-end script. It can be copied from another EMBASSY package.

Other files can be given. For example, HMMERNEW includes the file (Userguide.pdf) which is documentation for the original HMMER application.

3.2.4.2. Editing the Makefile.am Files

The Makefile.am files used in EMBASSY are different from those used in the main EMBOSS package. When creating a new EMBASSY package, there are six Makefile.am files which must be edited, in each of the following directories:

  • /packagename/

  • /packagename/src

  • /packagename/emboss_acd

  • /packagename/emboss_doc

  • /packagename/emboss_doc/html

  • /packagename/emboss_doc/text

The required edits to these files should be obvious from inspecting the files below, which are for the myemboss package.

/myemboss/Makefile.amThe file is shown below:

#

SUBDIRS = source emboss_acd emboss_doc

EXTRA_DIST = depcomp ltmain.sh install-sh config.sub config.guess

# tar to pick up the other directories
# then remove any CVS subdirectories

dist-hook:
	tar cBf - emboss_acd | ( cd $(distdir); tar xBf - ; cd emboss_acd; rm -rf CVS) 
	tar cBf - emboss_doc | ( cd $(distdir); tar xBf - ; cd emboss_doc; rm -rf CVS; rm -rf master) 

The SUBDIRS line must reference all top-level subdirectories in the package for which there are Makefile.am files.

The dist-hook entry must be edited accordingly.

/myemboss/src/Makefile.amThe file is shown below:

## Process this file with automake to produce Makefile.in

EXTRA_DIST = Makefile.am

bin_PROGRAMS = myseq mytest

if LOCALLINK
INCLUDES = -I../include -I../../../nucleus -I../../../ajax -I../../../plplot
else
INCLUDES = -I../include -I${embprefix}/include -I${embprefix}/include/eplplot
endif


if ISSHARED
if ISAIXIA64
if LOCALLINK
AM_CFLAGS = -Wl,-bdynamic -Wl,-brtl -L../../../plplot/.libs -L../../../ajax/.libs -L../../../nucleus/.libs -lnucleus -lajax -leplplot
else
AM_CFLAGS = -Wl,-bdynamic -Wl,-brtl -L${embprefix}/lib -lnucleus -lajax -leplplot
endif
else
AM_CFLAGS =
endif
endif


myseq_SOURCES = myseq.c
mytest_SOURCES = mytest.c



if LOCALLINK
LDADD = ../../../nucleus/libnucleus.la ../../../ajax/libajaxg.la ../../../ajax/libajax.la ../../../plplot/libeplplot.la $(XLIB)
else
LDADD = -L${embprefix}/lib -lnucleus -lajaxg -lajax -leplplot $(XLIB)
endif

The names of all the applications must be given on the bin_PROGRAMS entry, which may span multiple lines if these are delimited by a backslash character. A reference to the C source code file of each application is given towards the bottom of the file, for example ehmmcalibrate_SOURCES = ehmmcalibrate.c.

/myemboss/emboss_acd/Makefile.amThe file is shown below:

EXTRA_DIST = Makefile.am

pkgdata_DATA = myseq.acd mytest.acd

pkgdatadir=$(prefix)/share/EMBOSS/acd

The name of all the application ACD files must be given following the pkgdata_DATA entry, which may span multiple lines.

/myemboss/emboss_doc/Makefile.amThe file is shown below:

SUBDIRS = html text

The file does not typically require editing.

/myemboss/emboss_doc/html/Makefile.amThe file is shown below:

pkgdata_DATA = index.html \
	myseq.html

pkgdatadir=$(prefix)/share/EMBOSS/doc/html/embassy/myseq

All the application documentation files (Section 8.1, “Application Documentation Standards”) in HTML format must be listed in the pkgdata_DATA entry, which may span multiple lines. Any other documentation files that are automatically generated are listed here also. The line beginning with pkgdatadir= must be changed so that it gives the correct package name.

/myemboss/emboss_doc/text/Makefile.amThe file is shown below:

pkgdata_DATA =  myseq.txt

pkgdatadir=$(prefix)/share/EMBOSS/doc/programs/text

This is essentially the same as /myemboss/emboss_doc/html/Makefile.am but references the documentation in plain text format.

3.2.4.3. Editing the configure.in Files

Two lines only need to be edited here:

  • The AC_INIT line must be changed so that it references one (any) application C source code file in the package.

  • The AM_INIT_AUTOMAKE line should give the package name and version number.

Once the application ACD files and C source code are written and integrated, compilation is as for any other EMBASSY package (see Section 3.2.1, “Using myemboss for Application Development”).

3.2.5. Adding New Functions and Datatypes

Any new functions and datatypes added to AJAX or NUCLEUS should be properly documented (Appendix D, Code Documentation Standards) if they are to be incorporated into the EMBOSS distribution. To compile the new code, type:

make

from the AJAX or NUCLEUS directory as appropriate. Of course, you will need to recompile any statically linked applications to use the changes. Alternatively, recompile the whole package by typing make from the second level EMBOSS directory e.g.:

/home/auser/emboss/emboss/.

3.2.6. Adding New Library Files

If you have added entirely new library files then these must be integrated into AJAX or NUCLEUS by editing the Makefile.am in the AJAX or NUCLEUS directory as appropriate.

An excerpts of the the AJAX Makefile.am file:

## Process this file with automake to produce Makefile.in

if ISCYGWIN
lib_LTLIBRARIES = libajax.la
else
lib_LTLIBRARIES = libajax.la libajaxg.la
endif

if ISSHARED
if ISAIXIA64
if NEEDAJAX
AM_CFLAGS = -Wl,-G -L../plplot/.libs -L.libs -lajax -leplplot -lm
else
AM_CFLAGS = -Wl,-G -L../plplot/.libs -L.libs -leplplot -lm
endif
else
AM_CFLAGS =
endif
endif

if ISCYGWIN
AM_LDFLAGS = -no-undefined -Wl,--add-stdcall-alias -Wl,--export-all-symbols -Wl,--enable-auto-import -L../plplot -leplplot
endif

## PCRE stuff (version 4.3)

POSIX_MALLOC_THRESHOLD = @POSIX_MALLOC_THRESHOLD@
PCRELIBVERSION = @PCRE_LIB_VERSION@
PCREPOSIXLIBVERSION = @PCRE_POSIXLIB_VERSION@

INCLUDES = -DAJAX_FIXED_ROOT=$(AJAX_FIXED_ROOT) -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/plplot $(POSIX_MALLOC_THRESHOLD) 
#LDFLAGS = -no-undefined
LIBS =

AJAXSRC = ajacd.c ajalign.c ajarr.c ajassert.c \
ajbase.c \
ajcall.c ajcod.c \
ajdan.c ajdmx.c ajdom.c ajdomain.c ajexcept.c \
ajfeat.c ajfile.c ajfmt.c ajgraphxml.c ajindex.c ajjava.c ajlist.c \
ajmath.c ajmatrices.c ajmem.c ajmess.c ajnam.c ajnexus.c \
ajpat.c ajpdb.c ajpdbio.c ajphylo.c \
ajrange.c ajreg.c ajreport.c \
ajseq.c ajseqabi.c ajseqdb.c ajseqread.c ajseqtype.c ajseqwrite.c \
ajsort.c ajstr.c ajsys.c \
ajtable.c ajtime.c ajtranslate.c ajtree.c ajutil.c ajvector.c \
pcre.c pcre_study.c pcreposix.c

AJAXGSRC = ajgraph.c ajhist.c

include_HEADERS = ajax.h ajarch.h ajdefine.h \
ajacd.h ajalign.h ajarr.h ajassert.h \
ajbase.h ajcall.h ajcod.h \
ajdan.h ajdmx.h ajdom.h ajdomain.h ajexcept.h \
ajfeat.h ajfeatdata.h ajfile.h ajfmt.h \
ajgraph.h ajgraphxml.h ajgraphstruct.h ajhist.h ajindex.h ajjava.h ajlist.h \
ajmath.h ajmatrices.h ajmem.h ajmess.h ajnam.h ajnexus.h \
ajpat.h ajpdb.h ajpdbio.h ajphylo.h \
ajrange.h ajreg.h ajreport.h \
ajseq.h ajseqabi.h ajseqdata.h ajseqdb.h ajseqread.h ajseqtype.h ajseqwrite.h \
ajsort.h ajstr.h ajsys.h \
ajtable.h ajtime.h ajtranslate.h ajtree.h ajutil.h ajvector.h \
pcre.h pcre_chartables.c pcre_config.h pcre_get.c pcre_printint.c \
pcre_internal.h pcreposix.h


if ISCYGWIN
libajax_la_SOURCES = $(AJAXSRC) $(AJAXGSRC)
libajax_la_LDFLAGS = -version-info 5:0:0
else
libajax_la_SOURCES = $(AJAXSRC)
libajax_la_LDFLAGS = -version-info 5:0:0
libajaxg_la_SOURCES = $(AJAXGSRC)
libajaxg_la_LDFLAGS = -version-info 5:0:0
endif

The NUCLEUS Makefile.am file:

## Process this file with automake to produce Makefile.in

lib_LTLIBRARIES = libnucleus.la

if ISSHARED
if ISAIXIA64
AM_CFLAGS = -Wl,-G -lm -L../ajax/.libs -lajax
else
AM_CFLAGS =
endif
endif

if ISCYGWIN
AM_LDFLAGS = -no-undefined -Wl,--add-stdcall-alias -Wl,--export-all-symbols -Wl,--enable-auto-import -L../plplot -L../ajax -leplplot -lajax
endif


INCLUDES = -I$(top_srcdir)/plplot $(X_CFLAGS) -I$(srcdir)/ -I$(top_srcdir)/ajax

LIBS =

NUCLSRC =  embaln.c embcom.c embcons.c \
	   embdata.c embdbi.c embdmx.c embdomain.c \
	   embest.c embexit.c embgroup.c \
	   embiep.c embindex.c embinit.c \
	   embmat.c embmisc.c embmol.c \
	   embnmer.c embpat.c embpatlist.c embprop.c embpdb.c \
           embread.c embsig.c \
	   embshow.c embword.c

libnucleus_la_SOURCES = $(NUCLSRC)

libnucleus_la_LDFLAGS =  -version-info 5:0:0

include_HEADERS = emboss.h \
		 embaln.h embcom.h embcons.h \
		 embdata.h embdbi.h embdmx.h embdomain.h \
		 embest.h embexit.h embgroup.h \
		 embiep.h embindex.h embinit.h \
		 embmat.h embmisc.h embmol.h \
		 embnmer.h embpat.h embpatlist.h embprop.h embpdb.h \
                 embread.h embsig.h \
                 embshow.h embword.h 

You must also add any new header files to ajax.h and / or emboss.h. ajax.h looks like this:

#ifdef __cplusplus
extern "C"
{
#endif

/*
**
** AJAX master include file
**
*/

#ifndef ajax_h
#define ajax_h

#include <stdio.h>

#include "ajarch.h"

#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*#include <malloc.h>*/

#include "ajassert.h"
#include "ajdefine.h"
#include "ajstr.h"
#include "ajtime.h"
#include "ajfile.h"
#include "ajlist.h"

#include "ajtable.h"
#include "ajnexus.h"
#include "ajfeat.h"
#include "ajseq.h"
#include "ajseqdata.h"
#include "ajseqtype.h"
#include "ajarr.h"
#include "ajseqread.h"
#include "ajseqwrite.h"
#include "ajindex.h"
#include "ajseqdb.h"
#include "ajseqabi.h"
#include "ajreport.h"
#include "ajfmt.h"
#include "ajmatrices.h"
#include "ajalign.h"

#include "ajrange.h"
#include "ajcod.h"
#include "ajmath.h"

...
... Entries omitted for brevity
...

#endif

#ifdef __cplusplus
}
#endif

emboss.h looks like this:

#ifndef emboss_h
#define emboss_h

#include "ajax.h"
#include "ajgraph.h"
#include "embaln.h"
#include "embcom.h"
#include "embcons.h"
#include "embdbi.h"
...
... Entries omitted for brevity
...

#ifdef WIN32
#define VERSION "5.0.0"
#endif


#endif