[GRASS5] New Makefile
Justin Hickey
jhickey at hpcc.nectec.or.th
Fri Dec 22 10:14:51 EST 2000
Hello all
I have finally finished the new Makefile system which now behaves
similar to GNU software projects and have committed it to CVS. I guess
I'll outline the features and then give a method for testing.
The first thing to note is that to compile and install grass you perform
the following steps:
configure
make
make install
Configure is basically the same except for a few additional variables
were defined and create_fifos.sh.in no longer exists. The GISBASE is now
passed in to create_fifos.sh since I needed to call this script with a
different GISBASE to install the binaries. Note that if you don't have
an updated configure file it will delete the create_fifos.sh script and
thus the fifos will not be created. If this happens, do a CVS update for
configure.in, configure, and src/scripts/shells/create_fifos.sh and then
run autoconf and configure again.
The first thing "make" will do is check if you are user root and if you
are, it will warn you and ask if you want to continue. Next, it will
compile grass as it always has but the destinations will be
$SRCDIR/dist.$ARCH for the bin/, etc/, documents/, and other
directories, and $SRCDIR/bin.$ARCH for grass5, gmake5, and gmakelinks5.
Note that dist.$ARCH is the new GISBASE (at least until you type make
install). The reason for the $ARCH variable is to allow for multiple
distributions to be compiled from the same sources. I haven't tested
this though since I only have one machine. If somebody can test this
feature and send me a note of any problems I would appreciate it.
Once "make" finishes you can then use grass if SRCDIR/bin.$ARCH is in
your path or you call it directly as SRCDIR/bin.$ARCH/grass5.
For "make install" if you have designated root accessible directories
for the install directories and you try to install as another user, make
will die if the directories do not exist, and if they do, you will
probably get a lot of permission errors. The first thing "make install"
does is check if it can find the grass5 executable and dies if it can't
find it. The reason it dies instead of compiling grass is that the user
will typically be root and we are trying to promote non-root compilation
of grass. Next, it checks if the word 'grass' is part of the
distribution directory name. By default it is $PREFIX/grass5 and we are
trying to avoid installing the grass binaries in system directories that
could lead to conflicts. The idea is that if grass is in the directory
name, then it is likely not a system directory. Next it will install the
three executables in $BINDIR changing the GISBASE variable in grass5 as
it does so to $PREFIX/grass5. Then the directories in $GISBASE are
copied to $PREFIX/grass5, the fifos are created, the monitorcap file is
updated, and finally, the permissions on the locks directory are set.
The make clean targets now clean the $SRCDIR/dist.$ARCH and
$SRCDIR/bin.$ARCH directories. One thing to note is that "make clean"
will attempt to remove these directories with rmdir which causes an
error message if they are not empty. This gives users the chance to
check what is in these directories and lets them delete them if so
desired. And of course create_fifios.sh is no longer deleted.
Now for "make uninstall". No matter what your setup is, make uninstall
will always warn you what you are about to do and ask you to confirm it.
If you have grass in your install directory name, then you are informed
that all files in the $PREFIX/grass5 directory will be deleted as well
as the three executables in $BINDIR. If you do not have grass in the
install directory name, then the directories in the distribution
directory are listed with their full path to inform the user that these
directories will be deleted. This is to catch things like
/usr/local/bin. Also, the three executables are listed. The user then
has a choice to quit make if so desired. After all the files are
deleted, make will try to remove $PREFIX/grass5 with rmdir, again
creating an error message if it is not empty. If you try to run "make
uninstall" as another user besides root, then you should have
permissions to delete these directories. If not, then a lot of
permission errors are generated.
I also had to change the bindist target. The first thing the "make
bindist" will do is check if you are root user. The bindist target now
gets its files from the distribution directory and thus, requires write
permissions. Thus we assume you will need root permission to create a
binary distribution. Next it checks if grass5 exists in $BINDIR
indicating that grass has been installed. Then it basically does what it
has always done.
Those are most of the features, now for a method of testing this fairly
safely. Below will be a step by step process for testing the new
Makefile. Any lines beginning with # are basically comments. First
checkout a fresh version of grass from CVS preferably in a directory
that never existed before and with a user other than root. Run autoconf
if necessary. Those of you who prefer to compile as root should probably
test root access compiles second, just to be safe. Now set up the
install directory.
# Switch to user root and set up the following in a "safe" place
su
cd /tmp
mkdir grassTest
cd grassTest
# Simulate /usr/local
mkdir bin
mkdir lib
mkdir include
touch bin/a
touch bin/b
touch lib/c
touch lib/d
touch include/e
touch include/f
# Switch from root back to user
exit
# cd to your $SRCDIR
cd /whatever/SRC/happens/to/be
# Compile grass - add whatever configure flags you need
./configure --prefix=/tmp/grassTest
make
# Now test grass - arch is whatever works for you
bin.arch/grass5
# Perform some grass stuff and exit
# Optionally do a make distclean to verify operation
# Depends on how long your compile time is
make distclean
./configure --prefix=/tmp/grassTest
make
# Switch to user root and do a make install
su
make install
# exit from root and run installed grass
exit
/tmp/grassTest/grass5
# Perform some grass stuff and exit
# Do a make clean to verify binaries installed properly
make clean
/tmp/grassTest/grass5
# Perform some grass stuff and exit
# Switch to root and optionally test the bindist feature
su
make bindist
# Uninstall grass
make uninstall
# verify uninstall - check that file a, b, c, d, e, and f are still
# there
# exit from root and make distclean
exit
make distclean
This is only a suggestion for testing. Feel free to test the Makefile
whatever way you want.
Note that I also did a minor clean up of Makefile.in. Please let me know
if I have removed something that I shouldn't have.
As always please let me know of any problems or concerns.
--
Sincerely,
Jazzman (a.k.a. Justin Hickey) e-mail: jhickey at hpcc.nectec.or.th
High Performance Computing Center
National Electronics and Computer Technology Center (NECTEC)
Bangkok, Thailand
==================================================================
People who think they know everything are very irritating to those
of us who do. ---Anonymous
Jazz and Trek Rule!!!
==================================================================
----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'
More information about the grass-dev
mailing list