Rev 6529 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
#! /bin/sh# ${R_HOME}/bin/INSTALL for installing add-on packages# Usage:# R INSTALL [options] [-l lib] pkg_1 ... pkg_n# @configure_input@VERSION="0.2-2"USAGE_MSG="Usage: R INSTALL [options] [-l lib] pkg_1 ... pkg_n"CLEAN=falseDEBUG=falseERROR=falseBUILD_TEXT=trueBUILD_HTML=trueBUILD_LATEX=trueBUILD_HELP=trueBUILD_HELP_OPTS=BUILD_EXAMPLE=trueSHLIB_OPTS=USE_ZIP=INSTALL='@INSTALL@'NO_PERL5=@NO_PERL5@NO_PERL5_MSG="\*** Formatting and installing R help pages needs Perl version 5, which*** does not seem to be installed on your system or is not in your path.*** Please install either Perl 5 on your system and re-configure R or*** get pre-formatted help pages from the nearest CRAN server.*** The CRAN master site can be found at*** http://www.ci.tuwien.ac.at/R*** ftp://ftp.ci.tuwien.ac.at/pub/R"PKGS=lib=${R_HOME}/libraryMAKE=${MAKE-@MAKE@}TMPDIR="/tmp/R.INSTALL.$$"umask 022while test -n "${1}"; docase ${1} in-h|--help|-\?)echo "${USAGE_MSG}"; exit 0 ;;-V|--version)echo "${VERSION}"; exit 0 ;;-c|--clean)CLEAN=true ;;--debug)DEBUG=true; SHLIB_OPTS="${SHLIB_OPTS} --debug" ;;--no-docs)BUILD_TEXT=falseBUILD_HTML=falseBUILD_LATEX=falseBUILD_EXAMPLE=false ;;--no-text)BUILD_TEXT=false ;;--no-html)BUILD_HTML=false ;;--no-latex)BUILD_LATEX=false ;;--no-example)BUILD_EXAMPLE=false ;;--use-zip)USE_ZIP=true ;;-l|--library)lib=${2}; shift ;;*)if test -f "${1}"; thenmkdir -p ${TMPDIR}PKGNAME=`basename "${1}"`PKGNAME=`echo "${PKGNAME}" | sed 's/_.*//'`gzip -dc "${1}" | (cd ${TMPDIR} && tar -xf -)if test -d "${TMPDIR}/${PKGNAME}"; thenPKGS="${PKGS} \"`cd "${TMPDIR}/${PKGNAME}"; pwd`\""elseecho "ERROR: cannot extract package from ${1}"exit 1fielif test -d "${1}"; thenPKGS="${PKGS} \"`cd "${1}"; pwd`\""elseecho "WARNING: package \`"${1}"' does not exist"fi;;esacshiftdoneif test -z "${PKGS}"; thenecho "${USAGE_MSG}"exit 1fiif test -d ${lib} -a -w ${lib} || mkdir ${lib} 2> /dev/null; thenlib=`cd ${lib}; pwd`elseecho "ERROR: cannot write to or create directory \`${lib}'"exit 2fiif ${BUILD_TEXT}; thenBUILD_HELP_OPTS="${BUILD_HELP_OPTS} --nroff"fiif ${BUILD_HTML}; thenBUILD_HELP_OPTS="${BUILD_HELP_OPTS} --html"fiif ${BUILD_LATEX}; thenBUILD_HELP_OPTS="${BUILD_HELP_OPTS} --latex"fiif ${BUILD_EXAMPLE}; thenBUILD_HELP_OPTS="${BUILD_HELP_OPTS} --example"fiif test -z "${BUILD_HELP_OPTS}"; thenBUILD_HELP=falseelif ${DEBUG}; thenBUILD_HELP_OPTS="--debug ${BUILD_HELP_OPTS}"fido_install () {cd "${1}"pkg=`basename "${1}"`mkdir -p ${lib}/${pkg} || exit 3echo "Installing package \`${pkg}' ..."if test -x ./configure ; then./configurefiif test -d src; thenecho " libs"if ${DEBUG}; then set -x; fimkdir -p ${lib}/${pkg}/libsif test -f src/Makefile; then(cd src;${MAKE} -f ${R_HOME}/etc/Makeconf -f Makefile \&& cp *.@SHLIBEXT@ ${lib}/${pkg}/libs \|| ERROR=true; \if ${CLEAN}; then ${MAKE} clean; fi)else(cd src;sh ${R_HOME}/bin/SHLIB ${SHLIB_OPTS} \-o ${lib}/${pkg}/libs/${pkg}.@SHLIBEXT@ *.[cf] \|| ERROR=true; \if ${CLEAN}; then rm -f *.o; fi)fiif ${ERROR}; thenecho "ERROR: Compilation failed for package \`${pkg}'"exit 4fiif ${DEBUG}; then set +x; fifiif test -d R; then dir=R; elif test -d funs; then dir=funs; fiif test "${dir}"; thenecho " ${dir}"mkdir -p ${lib}/${pkg}/Rcat `ls ${dir}/*.[RSqrs] ${dir}/unix/*.[RSqrs] 2>/dev/null` \> ${lib}/${pkg}/R/${pkg}fidir=if test -d data; thenecho " data"mkdir -p ${lib}/${pkg}/datacp data/* ${lib}/${pkg}/datachmod 644 ${lib}/${pkg}/data/*fiif test -d exec; thenecho " exec"mkdir -p ${lib}/${pkg}/execcp exec/* ${lib}/${pkg}/execchmod 755 ${lib}/${pkg}/exec/*fiif test -d inst; thenecho " inst"cp -r inst/* ${lib}/${pkg}fiif test -f INDEX; thencp INDEX ${lib}/${pkg}fiif test -f TITLE; thencp TITLE ${lib}/${pkg}fiif test -f DESCRIPTION; thencp DESCRIPTION ${lib}/${pkg}fi(cd ${lib}; cat */TITLE > LibIndex 2> /dev/null)if test -d man; thenecho " help"if ${BUILD_HELP}; thenif ${NO_PERL5}; thenecho "${NO_PERL5_MSG}"elseif ${DEBUG}; thenecho " ${R_HOME}/bin/build-help ${BUILD_HELP_OPTS} ../${pkg} ${lib}"fi${R_HOME}/bin/build-help ${BUILD_HELP_OPTS} ../${pkg} ${lib}${R_HOME}/bin/Rd2contents ../${pkg} > ${lib}/${pkg}/CONTENTSif test ${lib} = ${R_HOME}/library; then${R_HOME}/bin/build-help --htmllistscat ${R_HOME}/library/*/CONTENTS \> ${R_HOME}/doc/html/search/index.txtfifiif test -n "${USE_ZIP}" -a -n "${R_UNZIPCMD}" -a -n "${R_ZIPCMD}"; thencd ${lib}/${pkg}if test -d R-ex; then(cd R-ex; ${R_ZIPCMD} -m Rhelp *.R)fi## NOT YET:## if test -d latex; then## (cd latex; ${R_ZIPCMD} -m Rhelp *.tex)## fiif test -d help; then(cd help; ${R_ZIPCMD} -m Rhelp * -x 00Titles AnIndex);fififielseecho " No man pages found in package \`${pkg}'"fiif ${CLEAN}; thenif test -x ./cleanup ; then./cleanupfifichmod -R a+r ${lib}/${pkg}echo " DONE (${pkg})"echo}eval "for pkg in ${PKGS}; do do_install \"\${pkg}\"; done"if test -d "${TMPDIR}"; thencd /rm -rf "${TMPDIR}"fiecho "DONE (INSTALL)"### Local Variables: ***### mode: sh ***### sh-indent: 2 ***### End: ***