building RPM's for petsc-2.3.3

Lisandro Dalcin dalcinl at gmail.com
Wed Jun 20 11:55:18 CDT 2007


I've been working in building RPM's for petsc-2.3.3, using the now old
bmake system. You have attached a petsc.spec file and a small patch.
Please note the petsc.spec file is written in a naive way, I should
have to use rpm macros to eliminate code duplication in many places.

I want to report you my first experiences, mainly because I tried to
support a multi-version, multi-arch installation, and I still think
the new build system should also support this approach. It should be
up to packagers if the what to simplify things.

In previous mails, Barry was worried about how users are going to
write your own makefiles, being able to use them to build your own
software against the petsc 'source' directory or a 'installed' petsc.
The approach described below solves this (at least in my linux FC6 box
with GNU make).

All what was really needed was to generate a really small patch for
files in bmake/common. This patch mainly modifies 'variables'
(splitting the definition of PETSC_LIB_DIR and PETSC_INCLUDE in a
completelly backward-fashion) and add a 'siteconf' file, by default
empty, with is included by 'base' at the end (so I believe this is
also backward).

In the spec file for generating the RPM, the tarball is unpacked and
patched (%prep step), next I configure and build petsc (%build step)
for two variants, PETSC_ARCH=default-seq (no mpi) and
PETSC_ARCH=default-mpi (with my mpich2 install, wich is not rpm based,
so I have to 'force' rpm to install it because of dependencies, but
anyway it works at the end). Finally, I install petsc and monkey copy
needed files to my buildroot (%install step). Additionally (this is
the tricky part) I put things in 'siteconf' file in order to override
the paths for includes and libraries.

The final layout of my build root (this really arbitrary, I did this
just to show a rather deep structure, and some symlinks are not really
needed) is the following (just mentally replace 'petsc-2.3.3-1-root'
by '/' and your have the same layout after installing the RPM)

$ tree -d petsc-2.3.3-1-root
petsc-2.3.3-1-root
`-- usr
    |-- include
    |   `-- petsc
    |       `-- 2.3.3
    |           |-- finclude
    |           `-- include
    |               |-- adic
    |               |-- finclude -> ../finclude
    |               |-- mpiuni
    |               `-- private
    `-- lib
        `-- petsc
            `-- 2.3.3
                |-- bin
                |   |-- common -> .
                |   |-- default-mpi
                |   `-- default-seq
                |-- bmake -> config
                |-- config
                |   |-- common -> .
                |   |-- default-mpi
                |   `-- default-seq
                `-- lib
                    |-- common -> .
                    |-- default-mpi
                    `-- default-seq


Now the question is ... Do all this work?  Is it backward and
trasparent for third party code? How to use this PETSc installation?
Let's see...

After installing the rpm ...

$ sudo rpm -ivh --nodeps RPMS/i386/petsc-2.3.3-1.i386.rpm

I go to /tmp and unpack and patch the original PETSc sources.

$ tar -zxf $HOME/rpm/SOURCES/petsc-2.3.3-p2.tar.gz
$ cd petsc-2.3.3-p2
$ patch -p1 < $HOME/rpm/SOURCES/petsc-2.3.3-p2.patch

Next I define PETSC_DIR and PETSC_ARCH as following

$ export PETSC_DIR=/usr/lib/petsc/2.3.3
$ export PETSC_ARCH=default-mpi

and finally do

$ make test
$ make testexamples
$ make testfortran

and all work as expected.





-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
-------------- next part --------------
A non-text attachment was scrubbed...
Name: petsc-2.3.3-p2.patch
Type: application/octet-stream
Size: 3271 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20070620/49fbc025/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: petsc.spec
Type: application/octet-stream
Size: 7803 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20070620/49fbc025/attachment-0001.obj>


More information about the petsc-dev mailing list