[mercury-users] the "extras" package

Fergus Henderson fjh at cs.mu.OZ.AU
Sun May 30 15:46:47 AEST 1999


On 29-May-1999, Warwick HARVEY <warwick at cs.mu.OZ.AU> wrote:
> Robert Ernst Johann JESCHOFNIK <rejj at students.cs.mu.OZ.AU> wrote:
> > I just realised that I had not grabbed the "extras" package yet, so I
> > thought I would.. and am no faced with the task of installing them. heh.
> > I can compile a lib (I started with the complex_numbers one) but I have no
> > idea where to install it, and there is no target for install in
> > the Mmakefile..
> > 
> > How/where do I install these "extra" libraries?
> 
> Support for installing and using "extra" libraries is currently rather 
> lacking in Mercury.

Well, the support for installing and using libraries could certainly be
improved, but the current support is not that bad -- it's quite possible
to install and use libraries, and the method for doing this is
documented in the "Libraries" chapter of the Mercury User's Guide.

To "install" a compiled version of a library, you just use mmake to build
the library and then (optionally) copy the appropriate files into a directory
of your choosing.  To use a library you just need to set some variables in
your Mmakefile to tell mmake which directories it should search for those
files.

So the answer to "where" is "wherever you like", and the
the answer to "how" is just to use "cp" to copy the files.

For example, if you decide to install the files in the directory
/usr/local/lib/complex-numbers, then you could
use the following commands:

	cd extras/complex_numbers
	mmake depend
	mmake
	cp *.int* *.opt *.init *.a *.so /usr/local/lib/complex-numbers

Then to use the library, you just need to set the appropriate
variables in your Mmakefile, as described in the "Using libraries"
subsection of the "Libraries" chapter of the Mercury User's Guide,
so that it will search /usr/local/lib/complex-numbers.

Alternatively, you can install the files directly in the directories
that the Mercury system searches automatically.  For an example of
how to do this, see the Mmakefile in the extras/clpr directory.
Or just use the following commands:

	cd extras/complex_numbers
	mmake depend
	mmake
	cp *.int* *.opt /usr/local/lib/mercury-0.8/lib/mercury/ints
	cp *.init /usr/local/lib/mercury-0.8/lib/mercury/ints
	cp *.a *.so /usr/local/lib/mercury-0.8/lib/mercury/$ARCH/$GRADE

Here you need to set $ARCH and $GRADE appropriately, e.g. to
`i586-pc-linux-gnu' and `asm_fast.gc' if you're using a Linux Pentium
system with the default grade, and the base part of the directory
must match the location that you installed the Mercury system in
(e.g. if you're using 0.8.1 rather than 0.8 then you would normally
need to make it /usr/local/lib/mercury-0.8.1.)

The advantage of this approach is that you don't need anything special
in the Mmakefile of code that uses the library.

P.S.  I don't want to discourage Warwick from contributing
improvements in this area.  It would be nice if we had better
support for installing libraries, so that `mmake' would handle the
`mmake complex_numbers.install' target automatically.  But I just
didn't want people to get overly discouraged by Warwick's statement
that our current support is "rather lacking".  Our current support is
not as convenient as it could be, but it is comparable with the support
that you typically get with compilers for other languages, such as C,
C++, etc.

Probably the documentation for the extras distribution should be
improved, though.  I think a pointer from the README file in the
extras distribution to the "Libraries" chapter of the Mercury User's Guide
would help quite a bit.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list