# RPM binary package

This page decribes how to prepare binary package for RPM-based distributions (Fedora, RHELL), by the ordinary way. Building of package follows basic rules in How to create an RPM package.

It is supposed to run commands introduced by # as root

    # id
    uid=0(root) ..

and ones denoted by $ as an ordinary user:

    $ id
    uid=12345(user) ...

## Prerequisites

Following tools are required for the building:

- Fortran 95 and C++ compilers
- wxGTK development libraries (version >= 3.0.0)
- Mercurial, the version control system (optional)

Required tools could be installed by the command (valid for Fedora 21, modify to satisfy your needs):

    # yum install fedora-packager gcc-gfortran gcc-c++ libgfortran-static libstdc++-static cfitsio-devel ImageMagick autoconfig automake wxGTK3-devel

A lot of dependencies will be requested. Imagemagic is installed by default. The lib...-static are added because ones are not included in devel packages directly.

Prepare building environment (if need):

    $ rpmdev-setuptree

## Build Of Stable Version

Download latest Munipack: https://integral.physics.muni.cz/ftp/munipack/ and place it in `~/rpmbuild/SOURCES` directory.

Prepare package:

    $ cd ~/rpmbuild/SOURCES
    $ tar zxfO munipack-0.5.7.tar.gz munipack-0.5.7/munipack.spec > ~/rpmbuild/SPECS/munipack.spec
    $ cd ~/rpmbuild/SPECS
    $ rpmbuild -ba munipack.spec

When the build finished sucessfully, the packages in `~/rpmbuild/RPMS/<ARCH>/` are ready to install. Their installation is strightforward:

    $ cd ~/rpmbuild/RPMS/<ARCH>/
    $ su
    # rpm -i munipack-*.rpm

## Build Of Development Version

Install Mercurial additionaly:

    # yum install mercurial

Obtain latest source code from Mercurial and update their own version (set as `0.X.Y+my001`):

    $ export VER=0.X.Y+my001
    $ hg clone https://integral.physics.muni.cz/hg/munipack munipack-${VER}/
    $ cd munipack-${VER}/
    $ ./bootstrap
    $ cd ..
    $ tar zcf munipack-${VER}.tar.gz munipack-${VER}/ --exclude ".hg*"

and follow instructions in previous sections.