This package currently works only for Unix, and has so far only been tested on Linux and Solaris.

Requirements

  • GNU make (from any of the GNU mirrors).
    Currently, the compilation using Solaris's native version of make does not seem to work. (libPluginSupport.so is not linked with any object files!). Instead, set the environment variable MAKE to gmake and then run R CMD INSTALL.

    On Linux, GNU make is the default.

  • Netscape!
    I have run this successfully on Linux using version 4.72 of Netscape and on Solaris using version 4.75. It should, however, work for any platform supported by the Netscape Plugin SDK
  • R as a shared library
    You will need to have $R_HOME/bin/libR.so. You can build this by downloading the R source and issuing the following commands
      tar zxvf R-1.2.2.tar.gz
      cd R
      ./configure --enable-R-shlib
      make
    
  • The Netscape Plugin SDK
    Download the SDK from ftp://ftp.netscape.com/pub/sdk/plugin/unix. This provides the necessary header files (jri.h and friends), a library nptemplate.so and the Netscape version of javah, a tool for creating the C-level glue from Java classes.

    I have also found this as an RPM but have not used it.

  • Building the Plugin

    Given these requirements, you can build the plugin. This is almost done as a regular R package, i.e.
     R INSTALL -c SNetscape
    
    But before that will work however, you will have to tell the configuration script where to find the Netscape SDK and potentially what set of files in the SDK are appropriate for your machine.

    The SDK Location

    If you extracted the files in the Plugin SDK tar file into a directory parallel to the SNetscape directory, the configuration script will find it.

    If the Plugin SDK is not located as a sibling directory of the SNetscape package, then you have to help the configuration find it. You can do this with an argument to configure as

     --with-netscape-sdk=/path/to/PluginSDK30b5
    
    To pass this to configure via the R INSTALL command use
     R INSTALL -c --configure-args='--with-netscape-sdk=/path/to/PluginSDK30b5' SNetscape
    

    This can be complicated for a variety of different reasons. A potentially simpler alternative is to set this value as an environment variable before calling INSTALL. The environment variable in question is NETSCAPE_SDK_DIR and therefore, the installation can be done as

     NETSCAPE_SDK_DIR=/path/to/PluginSDK30b5 ; R INSTALL -c SNetscape
    
    You can turn off the compilation of the graphics device plugin. This is done by specifying the argument --enable-graphics=no.

    Platform-specific Files

    Netscape provides support for several different operating systems such as HP, Linux and different versions of SunOS. The configuration script needs to determine the most appropriate one as this contains the relevant version of Netscape's javah and a library that we link against.

    For Linux (and HP and IRIX) there is only one choice. For SunOS, there are three choices. The configuration script tries to match your current version to one of the directories listed in the PluginSDK30b5/bin directory. If it fails to find a match, it uses SunOS5.4. If this is incorrect, specify the correct value (the name of the directory) via the --with-platform argument for configure or by setting the PLATFORM environment variable before calling configure.

     ./configure --with-platform=SunOS5.3
    
     
     export PLATFORM=SunOS5.3; ./configure 
    

    Installation

    The package is quite different from most other R packages because it is R that is embedded in an application rather than vice-versa. To get Netscape to find the plugin, we must install it somewhere that Netscape looks for plugins. For most users, this will be in their home directory in ~/.netscape/plugins/. If one wants to install this for more than one user, this should be installed

    Testing the Installation

    Finally, you will probably want to test that everything worked correctly. The usual R CMD check will not work as that assumes the code is loaded into R, not vice-versa. Instead, you can check the examples in examples/ directory that is installed with the package. To do this, you will need to restart Netscape in order to load the plugin. Before doing this, you will also need to set the environment variable LD_LIBRARY_PATH to contain the directory $R_HOME/bin, wherever R_HOME is. You can find this information by invoking the command
     R RHOME
    

    Now, run Netscape and open the test URL. Clicking on the Rnorm(10) button should update the contents of the other frame and verify that things are working.


    Duncan Temple Lang <duncan@research.bell-labs.com>
    Last modified: Fri Apr 6 11:47:58 EDT 2001