Installing Grapnel Compiler

Configuring the grp2c package

grp2c package has a configurator utility (a shell script actually) which can be used to set up the package to compilation. Invoke this program first: -

$ ./configure [option(s)]

You can use following options:

--help

Print out very short explanation of options.

--prefix=PREFIX

PREFIX is the directory where the package will be installed to. Note that different parts of the package will go to the different subdirectories of this base directory. Default is value of the GRP2C_ROOT environment variable, or if it not defined then /usr/local.

--bindir=DIR

Install executable programs into DIR. Default is PREFIX/bin.

--libdir=DIR

Install libraries into DIR. Default is PREFIX/lib.

--includedir=DIR

Put include files into DIR. Default directory is PREFIX/inlude.

--datadir=DIR

Put architecture-independent data files, such as templates, into DIR directory. Default directory is PREFIX/share.

--enable-dynamic[=ARG] (ARG can be yes or no, default is yes)
--disable-dynamic (same as --enable-dynamic=no)

This option enables or disables the dynamic linking of utility programs. Binaries are linked statically by default, dynamic link is possible if you enables it with enable-dynamic option of the configure explicitly and configure detects that your system is able to do it.

--with-pvm[=ARG]
--without-pvm

ARG can be yes or no, default is yes (--with-pvm=no option is equivalent with --without-pvm). This option determines if Grapnel Library for PVM should be produced or not. It is produced by default so you should use this option when you would like to disable it only. Autodetect of installation of the PVM package overrides this option. It means that you can not ask to produce PVM specific part of Grapnel Library if PVM is not installed correctly.

--with-tape[=ARG]
--without-tape

ARG can be yes or no, default is yes (--with-tape=no option is equivalent with --without-tape). If PVM part of Grapnel Library can be produced (see --with-pvm[=ARG] option), using this option you can enable or disable compilation of TAPE-PVM instrumented version of the Grapnel Library.

--with-pg[=ARG]
--without-pg

ARG can be yes or no, default is yes (--with-pg=no option is equivalent with --without-pg). If PVM part of Grapnel Library can be produced (see --with-pvm[=ARG] option), using this option you can enable or disable compilation of PG-PVM instrumented version of the Grapnel Library.

There are several other options, but they are not used by the package actually. Configurator utility prepares the package for the compilation. It makes Makefiles for subprojects and ddconfig.h file in root directory of the package. The ddconfig.h file contains macro definitions depending on your system. If you have any problem during compilation you may try to edit ddconfig.h file to fix problems caused by miss-configuration.

Compilers and Options

Some systems require unusual options for compilation or linking that the configure script does not know about. You can give configure initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this:

$ CXX=CC CXXFLAGS=-O2 LIBS=-lposix ./configure

Or on systems that have the env program, you can do it like this:

$ env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure

Compiling the grp2c package

You can compile whole project in one step or compile parts of the package step-by-step. To compile everything just type:

$ make

This command compiles subprojects in following order: parser, grp2c, grapnel. Remember, that you have to use GNU make program to compile the grp2c package.

If you would like to compile one or several subprojects only, you can compile main subprojects separately. To compile parser only, type:

$ make parser

This command compiles source files in parser.src subdirectory only and makes parser library (libparser.a)and parser utility program (grppars). If you would like to compile grp2c utility only, you can do it in following way:

$ make grp2c

Note that this command compiles parser subproject first because the parser library is required to compile grp2c program. It is not required to install the grapnel parser library because compilation of grp2c uses library from place of source of the library. If you would like to compile C programs generated by the grp2c utility you have to compile grapnel part of the package as well. To do it execute following command:

$ make grapnel

This command compiles everything in grapnel.src subdirectory. Compilation of grapnel produces a library called libgrpstuff.a. It contains usefull utility functions which is used by generated C programs in server program. This library is developed by me and everything that is not a direct requironment by our partners is going to be built into this library.

Grapnel library for PVM system is also produced. Source files of this version of Grapnel library are in pvm.src subdirectory (under grapnel.src). Result of Grapnel library's comilation is libgrppvm.a library and libgrppvm_t.a which is "instrumented" version for Tape-pvm system.

Installing the grp2c package

After compilation you can install the package. To install everything in the grp2c package execute the following command:

$ make install

Subprojects can be installed separately using one of the following commands:

$ make installparser

This command will copy libparser.a library file into PREFIX/lib directory (PREFIX can be specified by the configuration of the package, default is /usr/local). Header files which required to use parser library will be placed in PREFIX/include directory. Parser utility program (grppars) will be copied into PREFIX/bin directory.

This command installs shared version of the Parser Library too. It copies libparser.so.VERSION into the PREFIX/lib directory where VERSION is major, minor, and patch level number of the package, for example 0.26.4. The installation procedure makes a symbolic link to point this library with name libparser.so.MAJOR.MINOR. This name contains only major and minor version numbers of the package because the dynamic linker looks for this file when it loads any application that was dynamically linked with the shared Parser Library.

This command does not removes old (or other) versions of the library and unnecessary links. This can be done with the following command:

$ make cleanshared

Installation of the Parser Library does not do anything else because it is enough to write and compile your program which uses this library. If you would like to execute your program you must do some further steps and give necessary information to dinamic linker so it will be able to find and load shared library. These steps are described in chapter How to use Parser Library.

$ make installgrp2c

This command will install Grapnel Compiler program (grp2c) into PREFIX/bin directory and grp2c.mk file (template file for Makefile) into PREFIX/share directory.

$ make installgrapnel

This command installs libgrpstuff.a library into PREFIX/lib and header file that required to use this library into PREFIX/include directory.

PVM version of Grapnel library is installed too. It includes tapepppost utility (it goes to PREFIX/bin), libgrppvm.a library (PREFIX/lib) and it's header files (installed into PREFIX/include), and grp2c.mk.pvm Makefile template (PREFIX/share).

Installing precompiled binary versions

If you get precompiled binary version of the grp2c package, it is very easy to install it:
  1. First go to the directory where you are going to install the package (/usr/local in this example):
    $ cd /usr/local
    
  2. Uncompress and untar the package:
    $ gunzip grp2c-XXX.platform.tar.gz
    $ tar xf grp2x-XXX.platform.tar
    
    where XXX is the version number and the platform is freebsd, solaris, or other platform name respectively. This step makes four subdirectories (if they do not exist already) bin for executable binaries, lib for libraries, include for include files, and share for data files.

  3. Because root directory of the installed package may be different than the directory which was used during the compilation, you must set up an environment variable which tells to binaries where the package is installed to:
    $ export GRP2C_ROOT=/usr/local
    
    if you use sh type shell, or in csh:
    $ setenv GRP2C_ROOT /usr/local
    
    If you are installing the package elsewhere (not into /usr/local), use the name of that directory. I recommend to put this command into your startup file (.profile, or .cshrc).

  4. To save disk space, you can delete the archive file of the package:
    $ rm grp2c-XXX.platform.tar
    

Back to Grapnel Compiler.