Xmgr 32/64 bit packages for Debian Etch and Lenny GNU/Linux distros.

The problem

Nowadays, modern GNU/Linux distributions have a substitutive package for Xmgr, so-called xmgrace. Some people prefer to use the old Xmgr and disagree completely with the new options added to this new piece of software. Unluckily, there’s no package at all available for Debian distros (no matter if they are 32 or 64 bit ones ), so the user has to download  it and compile it directly from the sources.

Building our own binary package

So we decided to create different packages by hand, using the Debian GNU/Linux packages developers’ tools, that is, dpkg-deb command. We began with the original sources placed at ftp://plasma-gate.weizmann.ac.il/pub/xmgr4/src/xmgr-4.1.2.tar.gz. After compiling the sources successfully, we wrote a minimal Debian control file so as to configure the dependencies needed to install and execute xmgr without problems. This file is shown below, for a Debian GNU/Linux Etch 32 bits:

Package: xmgr-netcdf
Version: 4.1.2-32bit
Section: utilities
Priority: optional
Architecture: i386
Depends: libxmu6 (>=1.0.2-2), lesstif2 (>=0.94.4-2), libxp6 (>=1.0.0), libxt6 (>=1.0.2-2), libxext6 (>=1.0.1-2), libc6 (>=2.3.6), libxrender1 (>=0.9.1-3), libxdmcp6 (>=1.0.1-2), libexpat1 (>=1.95.8-3.4), libx11-6 (>=1.0.3-7), libsm6 (>=1.0.1-3), libice6 (>=1.0.1-2), libxpm4 (>=3.5.5-2), libnetcdf4 (>=3.6.1-1), libxft2 (>=, libxau6 (>=1.0.1-2), libfontconfig1 (>=2.4.2-1.2), zlib1g (>=1.2.3-13)
Maintainer: Toni Castillo Girona <toni.castillo@fa.upc.edu>
Description: The xmgr original version compiled in order to run on 32bit Debian distros. All files will be
placed at /usr/local/xmgr/. This xmgr version has been compiled using netCDF version 4, so you
must have installed libnetcdf4, accordingly.
More information can be gathered from http://disbauxes.upc.es

All we need to do just before installing the package and its related libraries is to assure that any previous version is completely deleted. To accomplish this, we create a trivial preinst file, shown below:

# Simply it removes soft link from /usr/local/bin/xmgr
test -r /usr/local/bin/xmgr &amp;&amp; rm -rf /usr/local/bin/xmgr

To conclude, we wrote a postinst file in order to associate the installed libraries on the system with the library versions the xmgr binary looks for, to avoid missing libraries behaviour:

#	Trivial tasks in order to run xmgr rightly.
#	2008 by Toni Castillo Girona
# First of all, create a symbolic link for xmgr binary:
ln -s /usr/local/xmgr/bin/xmgr /usr/local/bin/xmgr
# Now, get a list of not found libraries:
MISSING_LIBRARIES=`ldd /usr/local/xmgr/bin/xmgr|grep "not found"|cut -d"=" -f1|tr -d '\t'|tr -s '\n' ' '`
if ! [ -z "$MISSING_LIBRARIES" ]; then
	for lib in $MISSING_LIBRARIES; do
		echo -ne "Linking: $lib ... " &gt;&gt; $LOG_LINKED_LIBRARIES
		# Make the base name without version: libNAME.so:
		BNAME="`echo $lib|cut -d"." -f1`.so"
		# Locate the library - if exists - and make the symbolic link:
		FOUNDAT=`/sbin/ldconfig -p|grep $BNAME|cut -d"&gt;" -f2|tr -d ' '`
		if ! [ -z "$FOUNDAT" ]; then
			echo -ne "[$FOUNDAT &lt;-&gt; /usr/lib/$lib]\n" &gt;&gt; $LOG_LINKED_LIBRARIES
			ln -s $FOUNDAT /usr/lib/$lib
			echo -ne "[$BNAME not found]\n"  &gt;&gt; $LOG_LINKED_LIBRARIES
# That's fine, all libraries needed by xmgr have been located or linked.

All files will be stored on /usr/local/xmgr, to skip conflicts between any previous xmgr version. It is feasible to install xmgrace and this home-made xmgr package on the same Linux box and at the same time with no problems at all.

The Xmgr “home-made” packages set

There are four different Xmgr binary packages. Take a quick look at the next table so as to figure out how they must be used and on what Debian GNU/Linux distributions can be installed.

Package name Debian version
xmgr-netcdf3-4.1.2-amd64 Debian Etch EM64T
xmgr-netcdf3-4.1.2-i386-etch Debian Etch 32 bit
xmgr-netcdf4-4.1.2-amd64 Debian Lenny EM64T
xmgr-netcdf4-4.1.2-i386-lenny Debian Lenny 32 bit

All dependencies must be solved before installing any of these packages. Obviously, you’ll be warned if some important ones are missing. In this particular case, all you need to do is to install the previous packages as told using apt-get , aptitude or synaptics package managers as usual.

Two of the main libraries which have to be installed on the system are libnetcdf[34] and lesstiff2.

Installing the package

dpkg -i package_name.deb

Below, a screen-shot showing the xmgr-netcdf4-4.1.2-amd64 package installation:

taltos:/home/tonicas/dev/xmgr/deb-package-netcdf4# dpkg -i xmgr-netcdf4-4.1.2-amd64.deb
Selecting previously deselected package xmgr-netcdf.
(Reading database … 357608 files and directories currently installed.)
Unpacking xmgr-netcdf (from xmgr-netcdf4-4.1.2-amd64.deb) …
Setting up xmgr-netcdf (4.1.2-64bit) …

taltos:/home/tonicas/dev/xmgr/deb-package-netcdf4# dpkg -l xmgr-netcdf
ii  xmgr-netcdf                            4.1.2-64bit                            The xmgr original version compiled in order to run on 64bit archs X86_64. All files will be