1. ROOT for DebianScience

1.1. Port status (8/9/2007): 2 more architectures, mips and hppa

With the kind help of Dirk Van Hertem <[mailto:dirk.vanhertem@ieee.org dirk dot vanhertem at ieee dot org]> and Boris (?) <[mailto:boris@mogwitz.eu boris at mogwitz dot eu]> we have managed to build the ROOT packages on [http://www.debian.org/ports/hppa/ hppa] and [http://www.debian.org/ports/mips/ mips]. Thiemo Seufer <[mailto:ths@networkno.de ths at networkno dot de]> helped on porting to [http://www.debian.org/ports/mips/ mipsel].

That brings the list of supported and confirmed architectures up to

[http://en.wikipedia.org/wiki/Little_endian byte order]/[http://en.wikipedia.org/wiki/Word_size word size]

little-endian

big-endian

32-bit

[http://www.debian.org/port/i386 i386], [http://wwww.debian.org/ports/mips mipsel]

[http://www.debian.org/ports/powerpc powerpc], [http://www.debian.org/ports/mips mips], [http://www.debian.org/ports/hppa hppa]

64-bit

[http://www/debian.org/ports/amd64 amd64]

The list of unconfirmed architectures is now

[http://en.wikipedia.org/wiki/Little_endian byte order]/[http://en.wikipedia.org/wiki/Word_size word size]

little-endian

big-endian

32-bit

[:ArmPort:arm]

[:ArmEabiPort:armeb[*]], [:?DebianM68kPorting:m68k], [:PortsSparc:sparc], [http://www.debian.org/ports/s390 s390]

64 bit

[http://www.debian.org/ports/ia64 ia64], [http://www.debian.org/ports/alpha alpha]

[http://debian-ppc64.alioth.debian.org/ ppc64[*]], s390x[*], sparc64[*]

[*] Experimental or not fully supported ports.

Apart from that, there's a number of non-linux ports, like

[http://en.wikipedia.org/wiki/Little_endian byte order]/[http://en.wikipedia.org/wiki/Word_size word size]

little-endian

big-endian

32-bit

[:TheHurd:hurd-i386], [http://www.debian.org/ports/netbsd/ netbsd-i386], [:Debian GNU/kFreeBSD:kfreebsd-gnu]

64-bit

[http://www.debian.org/ports/netbsd/ netbsd-alpha]

which have not been tested. In principle it should work on HURD but I haven't tried it in a very long time.

1.2. Porting notes

When porting to a non i386 platform not already supported for Linux, the following points should be considered.

  1. Enable auto-detection in configure. This normally involves figuring out what platform uname -m returns, and then add something like

          linux:<arch>*:*)      arch=linux ;;
  2. If the generic linux arch does not fit the machine (e.g., 64bit word-size, or big-endian, unsupported compiler options, or the like), we need to define a new platform.

    1. Look for a similar architecture, and copy that architectures config/Makefile.linuxother to config/Makefilefoo.

    2. Set the definition in configure to

            linux:<arch>*:*)      arch=linux<foo> ;;

      where <foo> is the Debian system name.

    3. Add an entry for the architecture to config/ARCHS

      linuxfoo             for FOO Linux gcc and glibc
    4. In config/root-config.in add an appropriate entry for the new architecture

      linuxfoo)
         # Linux with gcc >= 3.x
         auxcflags="-m32"   # replace with -m64 for 64bit machines
         auxldflags="-m32"  # replace with -m64 for 64bit machines
         auxlibs="-lm -ldl -rdynamic"
         ;;
    5. In test/Makefile.arch add appropriate lines for the new architecture.

      ifeq ($(ARCH),linux)
      # Linux with egcs, gcc 2.9x, gcc 3.x
      CXX           = g++
      CXXFLAGS      = $(OPT2) -Wall -fPIC
      LD            = g++
      LDFLAGS       = $(OPT2)
      SOFLAGS       = -shared
      endif
    6. Check that the platform is properly identified by the XRootd in the xrootd/src/xrootd/configure.classic script

             linux:foo*:*)    arch=foo_linux      ; platform=linux; ccflv=gcc;;
    7. Also add an entry to xrootd/src/xrootd/ARCHS

      foo_linux       gcc       all    for GNU/Linux on FOO
  3. Check that the system is properly recognized in base/inc/RConfig.h. Run

     touch dummy_file.c; gcc -E -dM dummy_file.c

    to see a list of GCC predefined pre-processor symbols. Look for an chip definition (e.g., __i386__, __powerpc__). If no valid entry exists in base/inc/RConfig.h, then add something like

       1 #if defined(linux) && defined(<cpp_arch>)
       2 #   define R__LINUX
       3 #   define R__UNIX
       4 #   define NEED_SIGJMP
       5 #   if defined(_ABI64) // For 64-bit word size
       6 #      define R__B64
       7 #   endif
       8 #   if defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN
       9 #      define R__BYTESWAP // For little endian machines
      10 #   endif
      11 #endif
      12 
    
  4. Check that the chip/os combo is properly detected in clib/src/Getline.c. The generic entries may be OK - that is the pre-processor conditional

       1 #if defined(TIOCGETP) && !defined(__sgi) && !defined(R__PPCLINUX) && \
       2     !defined(R__ALPHALINUX)  && !defined(R__MIPSLINUX) /* use BSD interface if possible */
       3 #include <sgtty.h>
       4 struct sgttyb   new_tty, old_tty;
       5 struct tchars   tch;
       6 struct ltchars  ltch;
       7 #else
       8 #ifdef SIGTSTP          /* need POSIX interface to handle SUSP */
       9 #include <termios.h>
      10 #if defined(__sun) || defined(__sgi) || defined(R__PPCLINUX) || \
      11     defined(R__ALPHALINUX) || defined(R__MIPSLINUX)
      12 #undef TIOCGETP         /* Solaris and SGI define TIOCGETP in <termios.h> */
      13 #undef TIOCSETP
      14 #endif
      15 
    

    the second POSIX branch will be chosen (termios.h is included). If not, add detection code as for for example R__MIPSLINUX and include that define in the BSD excluded list above.

  5. In cint/inc/G__ci.h check that CINT knows how to deal with variadic arguments to functions. Check if there's some entry that corresponds more or less to the the OS/CPU combo, and make a new switch. For example

       1 #elif (defined(__foo__)&&defined(__linux__))
       2 /**********************************************
       3  * FOO, Linux
       4  **********************************************/
       5 #if defined(_ABI64) /* For 64-bit word size */
       6 # define G__VAARG_INC_COPY_N 8
       7 #else
       8 # define G__VAARG_INC_COPY_N 4
       9 #endif
      10 #define G__VAARG_PASS_BY_REFERENCE 8
      11 #else
      12 /**********************************************
      13  * Other platforms,
      14  *  Try copying object as value.
      15  **********************************************/
      16 #define G__VAARG_NOSUPPORT
      17 #define G__VAARG_INC_COPY_N 4
      18 /* #define G__VAARG_PASS_BY_REFERENCE 8 */
      19 #endif
      20 
    
    If this does not work, you will get the error message
    Limitation: Variable argument is not supported for this platform
    when executing interpreted code like
       1 Form("Hello, World from %s", "me")
    

    In this case, we will need input from the [http://root.cern.ch/Cint.html CINT] developers. Send a message to cint@root.cern.ch describing the problem and the architecture (OS, chip, kernel version, compiler, etc.).

Non-Linux platforms may need more work. The basic thing is to assume that the OS is like Linux, except of course, if there's a closer alternative, like BSD or Cygwin.

1.3. Breaking news (17/05/2007): ROOT accepted for experimental

See end of bug [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=325306 325306].

You will be able to use your favorite "experimental" mirror to download and install the packages. Just put

deb ftp://ftp.NN.debian.org/debian/ ../project/experimental main contrib

where NN is your mirror country code, into your /etc/apt/sources.list or /etc/apt/sources.list.d/experimental.list.

Note: the name of the metapackage and source package, at the request of FTP masters, has been changed to root-system. If you only want a minimal ROOT environment you may instead try installing root-system-bin.

1.4. Future plans

1.5. History

        deb ftp://ftp.NN.debian.org/debian/ ../project/experimental main

1.6. The current unofficial repository

1.7. Technical issues for packaging

The approach is that the ROOT source tree contains [http://root.cern.ch/viewcvs/build/package/lib/ scripts] and [http://root.cern.ch/viewcvs/build/package/common templates] to deal with packaging in general (that is for Debian and RPM), as well as some [http://root.cern.ch/viewcvs/build/package/debian Debian] and [http://root.cern.ch/viewcvs/build/package/redhat RPM] specific templates.

The debian packaging directory is then build by running the script [http://root.cern.ch/viewcvs/build/package/lib/makedebdir.sh makedebdir.sh], followed by fakeroot debian/rules debian/control. The packaging scripts will try to build as many packages as possible on the build host. Note, that that sometimes means that you can get packages that wouldn't be possible on a pristine build system.

Note, that this scheme does not change the way the packages are built. It merely changes how the debian directory is prepared. After the debian directory is made, the developer can still tweak it to fit the system. Of course, such tweaks should eventually be propegated back to the packaging scripts in ROOT itself, to assure consistency.

In the eventual "official" Debian packages to come, the package maintainer would presumably run these two commands himself before dpkg-buildpackage, and the results of the commands (for instance the debian/ directory) would therefore enter into the diff.gz of the source package. Thus the source package uploaded to Debian would always be buildable with the normal steps of dpkg-buildpackage -rfakeroot.

If an end-user does apt-get source root and then re-runs the makedebdir script, it will overwrite the existing debian directory with information about the dependencies installed on the end-user's system. Hence an end-user may recompile Debian packages of ROOT building with support for unofficial (non-DFSG-free) libraries.

It is important that the maintainer ensure that he has all the needed "official" build-depends installed on his system when running the makedebdir.sh script, and none of the "unofficial" non-DFSG-free libraries (e.g. Pythia) installed, perhaps by building on a pristine machine or in a pristine chroot. That is, use pbuilder :-). In any case, official packages are not allowed to munge debian/control in such a way that their Build-Depends change during the dpkg-buildpackage step!

1.8. Licensing

1.9. Thanks