R-beta: updating the library index / overriding compile options

Albrecht Gebhardt (agebhard@zidsrv.sci.uni-klu.ac.at)
Mon, 19 Jan 1998 14:37:35 +0100 (MET)


Date: Mon, 19 Jan 1998 14:37:35 +0100 (MET)
From: Albrecht Gebhardt <agebhard@zidsrv.sci.uni-klu.ac.at>
To: r-help@stat.math.ethz.ch
Subject: R-beta: updating the library index / overriding compile options
Message-Id: <Pine.OSF.3.93.980119135100.9932A-100000@alpha2-stat.sci.uni-klu.ac.at>


Would it be possible to include a new command in the ${RHOME}/etc path, which
updates the Library index (Rd and html) via  "R LIBINDEX".

I need it because I use RPM to manage three different R installations (at home,
at the institute and in the seminar rooms). I put all libraries into several
packages, so it is easy for me to update a single library at all these
different places. 

But after installation or removal of a library via rpm the help indices have to
be updated.  A call like "R INSTALL +help" in the post/pre install/uninstall
script calls also "make" in the library source trees, which is unnecessary (and
may even fail, e.g. because of a missing Fortran compiler). 

The following script does exactly what I want (I don't know if it will work
for library directories other then $RHOME/library):
##############################################################################
#! /bin/sh

# ${RHOME}/etc/LIBINDEX for updating the library index
# Usage:
#       R LIBINDEX [lib]
#                



lib=${1:-${RHOME}/library}
test -d ${lib} || exit 1;
lib=`cd ${lib}; pwd`

rm -f ${lib}/LibIndex 

echo updating LibIndex ...
for pkg in `ls -d ${lib}/*`; do
    if test -d ${pkg}; then
        if test -f ${pkg}/TITLE; then
#          echo " adding entry for library" ${pkg##*/}
           cat ${pkg}/TITLE >> ${lib}/LibIndex 2> /dev/null
        fi
    fi
done

echo updating HTML index ...

${RHOME}/etc/build-htmlpkglist

echo "DONE"
##############################################################################

It would also be good, if some of the compile options could be overridden in
a "R INSTALL ..." call. Especially I'm using GNU Fortran when compiling the base
R disribution, that means $src is set to "src". But g77 fails on some of the
libraries. So I want to do "R INSTALL +docs src-c libname" for this library
which sets $dir to "src-c".

I would propose the following patch to includes these two options
("src" or "src-c") into "R INSTALL":
##############################################################################
--- etc/INSTALL.in
+++ etc/INSTALL.in      1997/12/10 09:16:00
@@ -3,7 +3,7 @@
 # ${RHOME}/etc/INSTALL for installing add-on packages
 # Usage:
 #      R INSTALL [(+|-)debug] [-help/+help] [-html/+html] [-latex/+latex]
-#                 [+docs/-docs] pkg [lib]
+#                 [+docs/-docs] [src/src-c] pkg [lib]
 
 IHELP=y
 IHTML=y
@@ -33,6 +33,10 @@
     ILATEX="y"
 fi
 
+if [ "$1" = "src" ]; then shift; src=src;  fi
+if [ "$1" = "src-c" ]; then shift; src=src-c;  fi
+if [ ! "$src" ]; then src=@LIBSRC@; fi
+
 if [ "$1" ]
 then
     pkg=$1
@@ -53,7 +57,6 @@
 
 test -d ${lib}/${pkg} || mkdir ${lib}/${pkg} || exit 1;
 
-src=@LIBSRC@
 
 cd ${pkg}
 pkg=`basename ${pkg}`
############################################################################

I'm not sure if this is the best way. Any other ideas?

Albrecht

-------------------------------------------------------------------------------
Albrecht Gebhardt                   email   : albrecht.gebhardt@uni-klu.ac.at
Institut fuer Mathematik            Tel.    : (++43 463) 2700/837
Universitaet Klagenfurt             Fax     : (++43 463) 2700/834
Villacher Str. 161
A-9020 Klagenfurt, Austria
-------------------------------------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._