Personal tools
You are here: Home / cmgui / Zinc / Building Zinc

Building Zinc

Set up a directory for you zinc builds

The root zinc directory may end up containing quite a few different zinc builds, as you may choose to have several subdirectories for different zinc build targets (eg ff2 and ff3 versions, optimised and debug versions, 32 bit and 64 bit versions). Create a root zinc directory to keep things tidy:

cd $CMISS_ROOT
mkdir zinc
cd zinc

Subversion Source

The latest Zinc source can be checked out of a subversion repository:

cd $CMISS_ROOT/zinc
svn co https://svn.physiomeproject.org/svn/cmiss/zinc/trunk zinc

First Build

Note the zinc for mozilla 1.8 (which is what Firefox 1.5 and Firefox 2.0.0.*
are based on) is not compatible with zinc for mozilla 1.9. You need to build the correct version. However, for release, there is a script in the zinc source (merge_xpis.pl) which enables you to merge both versions of zinc into a single xpi which automatically switches the version dependent components at run time as required.

Zinc uses autotools to build. Here are some notes on Building With Autotools.

The first time you build zinc you need to create the "configure" and "Makefile":

cd $CMISS_ROOT/zinc/zinc
aclocal
automake --add-missing
autoconf

If you have a common linux distribution, like Ubuntu, you will have to build mozilla or firefox. Once you have done this you can run configure with it pointing to your mozilla build:

./configure --with-mozilla-1-8-branch=PATH-TO-MOZILLA-DIST --with-cmgui=PATH_TO_CMGUI
Note that '--with-mozilla-1-8-branch=' is for Firefox 1.5 or 2.0.0.* source
and '--with-mozilla=' is for Firefox 3.0+. This must be done correctly.

For example on my system when I configure for firefox 3 I type:

./configure --with-mozilla=/home/pbie003/cmiss/mozilla/ff-opt/dist --with-cmgui=/home/pbie003/cmiss/cmgui

If you want to make a debug version of the plugin add the '--enable-debug-zinc' option when running the configure script. If you want to build both an optimised and a debug version I suggest checking out the source twice, using a directory called zinc for the optimised version and one called zinc-debug for the debug version. You can then configure the two builds separately and test either without having to reconfigure all the time.

Before making zinc, you will need to make sure you have built the required
cmgui libraries. Assuming cmgui has been installed, do the following for debug:

cd $CMISS_ROOT/cmgui make cmgui-gtk-debug-lib

or the following for optimised:

cd $CMISS_ROOT/cmgui
make cmgui-gtk-lib

Once the cmgui library files have built you can make your development version of Zinc by typing:

cd $CMISS_ROOT/zinc
make

Subsequent Builds

On subsequent builds most of the previously described steps can be skipped. Below are steps you may need to do depending on what you have updated.

If you have changed cmgui code, you will need to first rebuild the cmgui library used by zinc

cd $CMISS_ROOT/cmgui
make cmgui-gtk-debug-lib

If you want to change from a debug version (with command window) to a non-debug version (or vice versa) you will need to rerun configure with or without the debug flag, eg to enable the debug version I would do

cd $CMISS_ROOT/zinc
make clean
./configure --with-mozilla=/home/pbie003/cmiss/zinc/mozilla/ff-opt/dist --with-cmgui=/home/pbie003/cmiss/cmgui --enable-debug-zinc

If you have updated a Makefile you will need to run config.status before building running make

cd $CMISS_ROOT/zinc
./config.status

If you have edited zinc source code you should run make

cd $CMISS_ROOT/zinc
make

Instructions for Building release versions of Zinc in the Bioengineering Institute

Note that what follows are detailed build instructions for release versions. If releasing zinc you should also read through the Zinc Release Instructions which deals with what to do once you have built the release versions.

Before releasing a new version of zinc you should check that your local development version displays the about dialog correctly (accessible by right clicking in the installed extension under the Tools->addons menu). You should also check that no zinc examples have been broken.

For a Zinc release, versions should be built for 32 bit linux, 64 bit linux and windows. The 32 bit linux version is easier to build so I suggest trying that first.

Before beginning, make sure the required cmgui code has been built on all machines by running

cmissmake cmgui.

Decide on a version number and increment the current version to your new one. You will need to edit the version number in the following file

zinc/zinc/components/zinc/base/public/zincICmgui.idl

The version number for the zincICmgui.idl is set by editing the value of various constants like BUILD_VERSION. The format of a zinc version number is as follows:

zinc-MAJOR_VERSION.MINOR_VERSION.SUBMINOR_VERSION.BUILD_VERSION-ARCH-OS-ALPHA_BETA.xpi

For example 'zinc-0.5.0.1-i686-linux-a2.xpi' is the 2nd alpha release for i686 machines running linux, with a version number of 0.5.0.1

Note that as shown in the example above the operating system is sometimes followed by an optional a or b and a number to indicate an alpha or beta release. The Major version value is only incremented if a major amount of new functionality has been added or the code has been significantly altered.

For small changes only the build version should be incremented. We follow the convention that versions less than 1.0.0.0 are deemed to be pre-release versions, ie alpha and beta versions for testing purposes and internal use. If a version is not stable enough for practical deployment it should have an "a" suffix added to the end of the name before the extension.

Once you have increased the version number you will need to increase the allowable version numbers for all the examples.

Linux build for 32 bit machines

The 32 bit linux versions should be built on bioeng85. The steps are as follows:

  1. ssh to bioeng85: 'ssh cmiss@bioeng85'

  2. Change into the appropriate zinc directory: 'cd /hpc/cmiss/zinc/zinc-i686-linux'

  3. Get the most up to date zinc code from svn: 'svn update'

  4. Build the Makefiles: './config.status'

  5. Make Zinc:

    i386-glibc23-linux-cross-make

  6. Repeat for firefox 3 target:

    cd /hpc/cmiss/zinc/zinc-i686-linux-ff3
    svn update
    ./config.status
    i386-glibc23-linux-cross-make
    
  7. Run merge_xpi.pl to merge the firefox2 xpi and firefox3 xpi together:

    cd /hpc/cmiss/zinc/zinc-i686-linux-merged
    bash build_merged.sh
    
  8. Sign the merged xpi.

  9. Copy the merged xpi file to the ftp directory (note you should use your version number):

    scp merged.xpi /ftp/pub/cmiss/zinc/zinc-0.6.1.1-i686-linux.xpi
    
  10. Check that the about window and all the examples still run.

  11. Add the release to the release centre: http://www.cmiss.org/ReleaseCenter/zinc

  12. Upload to addons.mozilla.org and request public release.

Linux build for 64 bit machines

The linux 64 bit version should be built on bioeng22. The steps are as follows:

  1. ssh to bioeng22: 'ssh cmiss@bioeng22'
  2. Change into the appropriate zinc directory: 'cd /hpc/cmiss/zinc/zinc-x86_64-linux'
  3. Get the most up to date zinc code from svn: 'svn update'
  4. Build the Makefiles: './config.status'
  5. Make Zinc:
make
  1. Copy the xpi file to the ftp directory (note you should use your version number):

    scp install/zinc.xpi /ftp/pub/cmiss/zinc/zinc-0.6.1.1-x86_64-linux.xpi
    
  2. Check that the about window and all the examples still run.

  3. Copy the xpi file to the release centre: http://www.cmiss.org/ReleaseCenter/mozcmgui

Windows build

The windows version should be built on bioeng128. The steps are as follows:

  1. ssh to bioeng128: 'ssh cmiss@bioeng128'

  2. Change into the d: drive cmiss directory: 'cd /cygdrive/d/cmiss' and set up the msvc8 compiler: 'source ./msvc8.sh'

  3. Update cmgui

    cd /cygdrive/c/cmiss/cmgui source ./update.sh

  4. Build Zinc:

    cd /cygdrive/c/cmiss/zinc/zinc-firefox3 svn update ./config.status --recheck make

  5. Copy the xpi file to the ftp directory (it will be built with the correct filename in the install directory, such as ):

cd install scp WHATEVERTHELATESTBUILDIS bioeng22:/ftp/pub/cmiss/zinc/
  1. Repeat the process for the firefox2 build with MSVC6 (although this is currently not available on bioeng128)
  2. Merge the two xpis generated using merge_xpis.pl
  3. Check that the about window and all the examples still run.
  4. Make a new release at the release centre: http://www.cmiss.org/ReleaseCenter/zinc

VWware Windows build

If you have a virtual machine set up on your linux pc that is running windows XP you can do a windows release build on your own machine. The steps are as follows:

  1. Open up a linux console on your machine. We will refer to this as L.

  2. Start up your vm machine and open a cygwin console. We will refer to this as VM.

  3. VM: type 'ipconfig' to get the ip address (required for rsync and scp access to your VM)

  4. L: Copy the required i386-win32 library files from hpc to your linux machine (if you do not already build them yourself) You may want to build the debug version and optimized, or just the optimised

    cd $CMISS_ROOT/cmgui/lib/i386-win32/cmgui-win32-debug scp hpc:/hpc/cmiss/cmgui/lib/i386-win32/cmgui-win32-debug/.dll . scp hpc:/hpc/cmiss/cmgui/lib/i386-win32/cmgui-win32-debug/.def .

    cd $CMISS_ROOT/cmgui/lib/i386-win32/cmgui-win32 scp hpc:/hpc/cmiss/cmgui/lib/i386-win32/cmgui-win32/.dll . scp hpc:/hpc/cmiss/cmgui/lib/i386-win32/cmgui-win32/.def .

  5. L: Rsync the required zinc source, cmgui source and lib files over to the virtual machine (also the top level makefile if it is the first build)

    rsync --one-file-system --update --archive --verbose --exclude=*.so --exclude=*.xpi /home/pbie003/cmiss/zinc/zinc 192.168.153.128: rsync --one-file-system --update --archive --verbose --exclude=.#* /home/pbie003/cmiss/cmgui/source 192.168.153.128:cmgui rsync --one-file-system --update --archive --verbose /home/pbie003/cmiss/cmgui/lib/i386-win32 192.168.153.128:cmgui/lib

  6. L: Rsync any examples you want to test

    rsync --one-file-system --update --archive --verbose /home/pbie003/cmiss/examples/a/emoter 192.168.153.128:examples/a rsync --one-file-system --update --archive --verbose /home/pbie003/cmiss/examples/a/melanoma 192.168.153.128:examples/a rsync --one-file-system --update --archive --verbose /home/pbie003/cmiss/examples/a/eye 192.168.153.128:examples/a rsync --one-file-system --update --archive --verbose /home/pbie003/cmiss/examples/a/digitise 192.168.153.128:examples/a

  7. VM: You need to set up access for the microsoft visual c compiler. On your cygwin console type

    source ~/msvcrt6.sh

  8. VM: Build the required library files (either for the debug or optimized version, or both):

    cd ~/cmgui/lib/i386-win32/cmgui-win32-debug lib /machine:i386 /def:libcmgui.def lib /machine:i386 /def:libcmgui_finite_element.def lib /machine:i386 /def:libcmgui_general.def

    cd ~/cmgui/lib/i386-win32/cmgui-win32 lib /machine:i386 /def:libcmgui.def lib /machine:i386 /def:libcmgui_finite_element.def lib /machine:i386 /def:libcmgui_general.def

  9. VM: Build Zinc (with optional --enable-debug-zinc if you want a command window)

    cd ~/zinc

./configure --with-mozilla-1-8-branch=/cygdrive/c/cygwin/home/pbie003/firefox-1.5-src/mozilla/dist --with-cmgui=/cygdrive/c/cygwin/home/pbie003/cmgui
make
  1. VM: Check that the about window and all the examples still run.
  2. L: Copy the xpi file to the ftp directory (note you should use your upi and version number):
cd ~/tmp scp pbie003@192.168.153.128:~/zinc/install/zinc.xpi . scp zinc.xpi cmiss@bioeng22:/ftp/pub/cmiss/zinc/zinc-0.6.1.1-i386-win32.xpi
  1. L: Copy the xpi file to the release centre: http://www.cmiss.org/ReleaseCenter/mozcmgui

XulRunner and Gecko Embedding builds

For mozilla 1.9 zinc should be portable between firefox, mozilla, xulrunner
or embedded builds with out recompiling.

For mozilla 1.8 source zinc needs to be compiled against the xulrunner or embedding version of mozilla that it is to work with. The configure script will attempt to recognise if the mozilla directory is a xulrunner/embedding version and adjust the compilation appropriately.

To install Zinc into a xulrunner/embedding build you currently need to manaully put things into the right places. The right places vary depending upon how you intend to deploy the application.