
This file is to help you get going with molly. If you have
downloaded molly_exe.tar.gz, skip down this file to the
relevant section.

Installing from the source code
-------------------------------

To install, edit the makefile, following the instructions.
See the bottom of this file for some tips on installing on MACs
and Ubuntu.

File structure:

command_defs  -- defines names, prompts and classes for commands. 
genhtml.pl    -- Perl script for generating html help on molly.
help_pointers -- list of the files with help for each command. This is
                 generated by 'make help' and is used by genhtml.pl
html/         -- directory containing html help.
makefile      -- file for installing and maintaining molly.
modmolly.pl   -- Perl script used by makefile to modify the main
                 molly fortran file = molly.f.template
perl          -- molly-related perl stuff.
source        -- molly subroutines source code.
startup       -- simple molly startup file.


Don't delete or rename command_defs. It is needed for molly to run; 
similarly help_pointers is required to be able to access help from
within molly. Both files must remain in the directory containing the 
molly 'source' directory.

Now skip to the section on environment variables at the end.

A couple of new points: I now link to the native PGPLOT shipped with
the JAC's STARLINK distribution as compilation of PGPLOT is getting
more and more tricky with time. It seems to work fine, so I recommend
it. Also, I include a runtime path pointing to the shareable libraries
and so LD_LIBRARY_PATH is not needed. The exact form of link options
here may vary with system; see the Makefile for more.

Molly executable
---------------

In this case you will not have all the files listed above, but you
will have a new file 'molly' which is the main executable. You can
move this to where you wish.

Otherwise, it is just a matter of setting up the molly environment.

molly environment variables
---------------------------

To get molly running (however you have installed it) you will need to
define the following environment variables:

MOLLY_DIR   -- must point to the directory containing 'command_defs', 'help_pointers'
              and the molly 'source' directory

PGPLOT_DIR  -- standard PGPLOT environment variable. Must point to the directory
               containing 'grfont.dat', 'rgb.txt', 'pgxwin_server' (if installed).
               These files are supplied along with the molly_exe tar file; they should
               already exist if you compiled molly from source, because you need PGPLOT
               installed.

MOLLY_START -- (optional). Set to point at a startup file to allow initialisation of molly
               on startup. An example is supplied with the tar files.

--------------------------------------------------------------

Here are some Intel MAC-specific tips from Peter Jonker; some of this
may be out-dated by changes of spring 2008.

A good thing is to install the scisoft software suite from ESO, it has the
pgplot that both Tariq and I used for molly
http://web.mac.com/npirzkal/iWeb/Scisoft/Scisoft.html

I used gcc which can be downloaded from http://developer.apple.com/tools/
or if you need gfortran go to http://hpc.sourceforge.net/

Both Tariq and I use aquaterm
http://sourceforge.net/projects/aquaterm/
In the molly Makefile I have this

PGPLOT     = -L$(PGDIR) -lpgplot -lgwm -lgfortran -laquaterm -L/usr/X11R6/lib -lX11 

# I am using g95 as it is the one recommended by the starlink developers. It is 
# very easy to install if you don't have it. It throws up millions of warnings
# which one day I might eliminate
FC         = g95
#pgj g95 comes from scisoft
# For g95, remove the -fno-automatic
FFLAGS     = -Wall -O2 -ffast-math -fno-second-underscore -I$(STAR)/include
CC         = gcc
CFLAGS     = -Wall -DPOSIX -g -O3
MCFLAGS    =


Finally, this links provides other useful stuff for the mac & astronomy

http://www.dsg.port.ac.uk/~eme/mac.html


Another message from Peter (13/11/08):

> This is to let you know that molly compiled more or less out of the box for
> me on my new MacBook Pro (Intel Leopard)!
>
> I only added the bin directory of the Scisoft applications to the PATH in
> your Makefile and I think there might be a typo in the Makefile  RPATH
> variable (I had to remove 1 of the dashes before "rpath", there were two in
> my original Makefile "--rpath" but "-rpath" works for Mac).
>
> RPATH = -Wl,-rpath -Wl,$(STAR)/lib

[I have made the change to rpath now so you should not need to change it, TRM]


##################
Another message from Peter Jonker, this time for 
Mac OS X (Mountain Lion)

download and install gfortran 4.8 from
http://hpc.sourceforge.net/

download and install starlink Kapuahi from
starlink.jach.hawaii.edu/starlink

Download molly from:
http://deneb.astro.warwick.ac.uk/phsaap/software/
unzip and untar
cd into F77/molly
edit the Makefile:
change the INSTALL variable to where you want to install molly
change the FC variable to gfortran

Make sure you have Xcode installed on your MAC
also download the Command Line Tools (go to Xcode preferences -> Downloads
click install after the Command Line Tools).

I removed the FFLAGS options -Wno=104 and -fstatic
and I added the FFLAGS option -fno-range-check

then it compiles giving an error message about git at the end, which I ignore.

#######################
From a message from Elme Breedt, this for Ubuntu MATE 19.04

From a clean install of Ubuntu MATE 19.04, I installed
- starlink 2018A (the latest version available)
and for the extra libraries I only had to install
- readline8
- libreadline-dev
Everything else needed was already available. (On OpenSuse I also had to install ICE and SM)

The trouble I had was in the Makefile - apparently Ubuntu is much more
finicky than other distros about the sequence in which libraries are
linked.

I used gfortran (I've never got it to work with the g95 compiler)
and then in the line
$(FC) $(FFLAGS) -o $(INSTALL)/molly molly.o $(EXTRA_LIBS) \
-L$(INSTALL) -l$(ARCH) $(NDF) $(PDA) $(FITS) $(PGPLOT) $(SLA) $(RPATH)
I had to move the extra_libs to later in the list, like this
$(FC) $(FFLAGS) -o $(INSTALL)/molly molly.o  \
-L$(INSTALL) -l$(ARCH) $(EXTRA_LIBS) $(NDF) $(PDA) $(FITS) $(PGPLOT) $(SLA) $(RPATH)
otherwise it complains about an 'undefined reference to readline'