Building JSim From Source

Introduction

This page describes how JSim source code is structured, and how to build a JSim binary distribution from that source code. Use of JSim source code must be in accordance with the file license.html found in the distribution root directory.

Source distribution contents

Building JSim on Linux

  1. Perform the following in a Bash shell.
  2. Create a new directory and unpack the source distribution .zip file, or NSR CVS checkout into it. Set environment variable JSIMSRC to this directory.
  3. Set your PATH to include $JSIMSRC/build.
  4. Install the Sun Java SDK version 1.6 on your system. Set environment variable JSIMSDK its location. On NSR Linux systems, this is /usr/local/jdk.
  5. Install gcc and gfortran version 4 on your system and edit $JSIMSRC/home/lib/Makefile.global.linux to match the appropriate locations. The distributed version of thie file targets NSR's Linux build machine, currently 64-bit EL5. Comments in the file allow modification for other NSR Linux boxes, including a mix of 32 and 64 bit EL6. For building on NSR Linux boxes, uncommment and comment this file to match your particular machine.
  6. If building on NSR Linux boxes: Where ver# is current JSim version number (example: 2.07) If on some other system, you'll need to download a copy of the extra libraries: JSIMAUXLIB contains libsbml native libraries and redistributable JREs for each architecture. The libsbml library is specific to the jar file used in the source distribution, and other versions will not work.
  7. Build JSim entirely with the command jsbuild.all. If you are modifying JSim, examine this script to find short ways of building limited parts of JSim. This will save you a lot of time because the entire build takes a long time.
  8. You should now be able to launch your new built JSim GUI with jsim.db, or the JSim batch interface with jsbatch.db.

Building JSim on MacIntosh

Building JSim on MacOS is largely similar to build on Linux.

  1. Perform the following in a Bash shell.
  2. Create a new directory and unpack the source distribution .zip file, or NSR CVS checkout into it. Set environment variable JSIMSRC to this directory.
  3. Set your PATH to include $JSIMSRC/build.
  4. Sun's Java SDK 1.6 in already installed on MacIntosh and JSIMSDK does not need to be set here for JSim to build properly.
  5. Install gcc and gfortran version 4 on your system and edit $JSIMSRC/home/lib/Makefile.global.macos to match the appropriate locations.
  6. Download a copy of the extra libraries: JSIMAUXLIB contains libsbml native libraries for each architecture. The libsbml library is specific to the jar file used in the source distribution, and other versions will not work.
  7. Build JSim entirely with the command jsbuild.all. If you are modifying JSim, examine this script to find short ways of building limited parts of JSim. This will save you a lot of time because the entire build takes a long time.
  8. JSim versions 2.03 and above support or Intel-based MacIntoshes. The script jsbuild.fat, used in 2.02 and below, is no longer in use.
  9. You should now be able to launch your new built JSim GUI with jsim.db, or the JSim batch interface with jsbatch.db.

Building JSim on Windows

JSim's Windows build requires assistance from a helper Linux or MacIntosh workstation to build JSim Java code. Only Windows native code is built on Windows itself.

  1. Build JSim from source on your helper workstation, following the above instructions, with one change: the auxilliary libraries to be downloaded need to be the native windows versions, not ones for linux. If you are building on an NSR system, the above instructions need not be changed at all, as versions for all systems exist in /NSRware/jsimauxlib/. If you are not on an NSR system, download the win32 versions with the following commands: JSIMAUXLIB contains libsbml native libraries and redistributable JREs for each architecture. The libsbml library is specific to the jar file used in the source distribution, and other versions will not work.
  2. On your helper workstation, run jsdist.srcaux. This will create $JSIMSRC/dist/JSim_srcaux_2_??.zip.
  3. On your Windows workstation, install Cygwin (a Unix-like environment for Windows). Make sure sh, make and ldd are a part of the installation.
  4. Install Mingw versions of gcc 4.x and gfortran 4.x (http://www.mingw.org/). Do not use the Cygwin compilers since we need to generate libraries that depend only on MS Windows libraries.
  5. Perform the following operations in a Cygwin bash shell:
  6. Create a new directory and unzip the srcaux .zip file from above in it. Set the environment variable JSIMSRC to this directory.
  7. Edit $JSIMSRC/home/lib/Makefile.global.win32 to match the appropriate locations of gcc and gfortran (installed above) on your system.
  8. Set your PATH variable to include $JSIMSRC/build.
  9. Set the environment variables:
      JSIMAUXLIB=$JSIMSRC/auxlib
      JSIMJARDIR=$JSIMAUXLIB
      JSIMSDK=$JSIMAUXLIB/jre
    
  10. Build JSim native libraries with jsbuild.native. Do not run jsbuild.all like on other systems above. jsbuild.all does not work properly on Windows.
  11. You should now be able to launch your new built JSim GUI from Cygwin with jsim.db, or the JSim batch interface with jsbatch.db. (jsim.bat and jsbatch.bat will also work from a Windows command-line, or by double-clicking.)

Creating JSim binary distribution

Binary distribution may be created for all 3 supported platforms (Windows, MacIntosh, Linux) from either a Linux or MacIntosh workstation.

  1. Build JSim from source on your Linux or MacIntosh workstation.
  2. If you wish to build binary distributions for other platforms as well, build on those platforms and copy the architecture-specific files to $JSIMSRC/native.
  3. Run jsdist.bin ARCH, where ARCH is one of linux, macos, or win32. The resulting .zip archive will be created in $JSIMSRC/dist.
  4. Install your newly created .zip archive using the standard installation instructions for the target machine.

Running the JSim verify suite

$JSIMSRC/verify contains various regression tests of JSim computational functionality. These regressions tests are fairly exact for Linux builds, and somewhat less exact for other architectures. The fpack, xsim and xfunc tests are not currently supported under Windows. Run the suite as follows:

  1. Perform the following in a Bash shell.
  2. run ". jsverify.env DIST" where DIST is either "src" for the JSim source build or a home directory for a JSim binary distribution.
  3. cd $JSIMSRC/verify
  4. Execture "runall [SWITCHES] [DIRS]" where DIRS is a list of subdirectories to verify. If DIRS is empty, all subdirectories are verified. If DIRS is the special value "win32" (which is not a subdirectory), all subdirectories except fpack, xfunc and xsim are verified.
  5. The results of runall are saved in "log" and echoed to the screen. Examine the runall script for further details.