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.
- README - read this first
- license.html - JSim licensing agreement, read before use
- JSim/ - JSim's java and non-java source code
- home/ - $JSIMHOME for source builds
- build/ - build, test and distribution scripts
- linux/ - linux OS specific directory
- macos/ - Macintosh OS X specific directory
- win32/ - Windows OS specific directory
- unix/ - Common material for Unix-based OS'es (Linux & MacOS)
- third/ - misc 3rd party contributions to JSim
- fpack/ - JSim Fortran package of XSIM-compatible models (available
via NSR CVS access only)
- verify/ - verification suite
- Perform the following in a Bash shell.
- Create a new directory and unpack the source distribution .zip file, or NSR
CVS checkout into it. Set environment variable JSIMSRC to this directory.
- Set your PATH to include $JSIMSRC/build.
- 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.
- 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.
- If building on NSR Linux boxes:
- Set the environment variable JSIMAUXLIB=/NSRware/jsimauxlib/ver#
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:
-
wget -r -np http://www.physiome.org/jsim/download/jsimauxlib/ver#/linux
-
mv www.physiome.org/jsim/download/jsimauxlib/ver# $JSIMSRC/jsimauxlib
-
rm -r -f www.physiome.org/
- Set the environment variable JSIMAUXLIB=$JSIMSRC/jsimauxlib
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.
- 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.
- 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 MacOS is largely similar to build on Linux.
- Perform the following in a Bash shell.
- Create a new directory and unpack the source distribution .zip file, or NSR
CVS checkout into it. Set environment variable JSIMSRC to this directory.
- Set your PATH to include $JSIMSRC/build.
- 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.
- Install gcc and gfortran version 4 on your system and edit
$JSIMSRC/home/lib/Makefile.global.macos to match the appropriate locations.
- Download a copy of the extra libraries:
-
wget -r -np http://www.physiome.org/jsim/download/jsimauxlib/ver#/macos
Where ver#
is current JSim version number (example: 2.07)
-
mv www.physiome.org/jsim/download/jsimauxlib/ver# $JSIMSRC/jsimauxlib
-
rm -r -f www.physiome.org/
- Set the environment variable JSIMAUXLIB=$JSIMSRC/jsimauxlib
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.
- 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.
- 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.
- You should now be able to launch your new built JSim GUI with jsim.db,
or the JSim batch interface with jsbatch.db.
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.
- 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:
-
wget -r -np http://www.physiome.org/jsim/download/jsimauxlib/ver#/win32
Where ver#
is current JSim version number (example: 2.07)
-
mkdir -p $JSIMSRC/jsimauxlib
-
mv www.physiome.org/jsim/download/jsimauxlib/ver#/win32 $JSIMSRC/jsimauxlib/
-
rm -r -f www.physiome.org/
- Set the environment variable JSIMAUXLIB=$JSIMSRC/jsimauxlib
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.
- On your helper workstation, run jsdist.srcaux. This will create
$JSIMSRC/dist/JSim_srcaux_2_??.zip.
- On your Windows workstation, install Cygwin (a Unix-like environment for
Windows). Make sure sh, make and ldd are a part of the installation.
- 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.
- Perform the following operations in a Cygwin bash shell:
- Create a new directory and unzip the srcaux .zip file from above in it. Set
the environment variable JSIMSRC to this directory.
- Edit $JSIMSRC/home/lib/Makefile.global.win32 to match the appropriate locations
of gcc and gfortran (installed above) on your system.
- Set your PATH variable to include $JSIMSRC/build.
- Set the environment variables:
JSIMAUXLIB=$JSIMSRC/auxlib
JSIMJARDIR=$JSIMAUXLIB
JSIMSDK=$JSIMAUXLIB/jre
- 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.
- 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.)
Binary distribution may be created for all 3 supported platforms (Windows,
MacIntosh, Linux) from either a Linux or MacIntosh workstation.
- Build JSim from source on your Linux or MacIntosh workstation.
- 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.
- Run jsdist.bin ARCH, where ARCH is one of linux, macos, or win32. The
resulting .zip archive will be created in $JSIMSRC/dist.
- Install your newly created .zip archive using the standard installation instructions for the
target machine.
$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:
- Perform the following in a Bash shell.
- run ". jsverify.env DIST" where DIST is either "src" for the JSim source
build or a home directory for a JSim binary distribution.
- cd $JSIMSRC/verify
- 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.
- The results of runall are saved in "log" and echoed to the screen. Examine
the runall script for further details.