$Id: README 94569 2011-10-05 09:36:54Z johnnyw $

Building RPM from source tarball
================================================================

It is possible to build directly from a source tarball if it contains
a valid spec file.

Before you can run rpmbuild, you need to setup a directory tree and a
.rpmmacros file.

Setup directory tree
----------------------------------------------------------------

You may already have one in /usr/src/RPM, but as rebuilding packages
as root is evil, we recommend that you create one in a place where
your normal user account allows you to write, such as your home
directory. This build tree should have the following structure:

    rpm
    |-- BUILD
    |-- RPMS
    |-- SOURCES
    |-- SPECS
    |-- SRPMS
    `-- tmp

The following command should build what you need:

    mkdir -p ${HOME}/rpm/{BUILD,RPMS,SOURCES,SPECS,SRPMS,tmp}

Setup rpmbuild configuration file
----------------------------------------------------------------

Now you need to do some rpm configuration. A simple ~/.rpmmacros with
the following contents should be enough:

    cat > ~/.rpmmacros <<EOF
    %_topdir        %(echo ${HOME}/rpm)
    %_tmppath       %{_topdir}/tmp

    %packager       Firstname Lastname <your.address@here>

    # Have built RPMs land in RPMS/ instead of RPMS/<arch>/
    %_rpmfilename  %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
    EOF

Make sure to replace the %packager fields with your actual name and email address.

Important Details
----------------------------------------------------------------

There are some important details:

* The tarball name must have the ACE version in the name, for example:

    ACE+TAO+CIAO-src-5.6.6.tar.bz2

* The spec file inside the tarball
 (ACE_wrappers/rpmbuild/ace-tao.spec) must have the correct version
  numbers for ACE, TAO and CIAO at the top:

    %define ACEVER  5.6.6
    %define TAOVER  1.6.6
    %define CIAOVER 0.6.6

* The following files in the source distribution must have the correct
  version numbers:

    ACE_wrappers/ace/Version.h
    ACE_wrappers/TAO/tao/Version.h
    ACE_wrappers/TAO/CIAO/ciao/Version.h


Building the RPM
----------------------------------------------------------------

You can kick off the rpmbuild anywhere; the tarball will be unpacked
and built in your rpmbuild directory described in the previous
section.

    rpmbuild -tb your-tarball.tar.bz2

Some packages take quite a while to build.


Harvesting the Binary RPM
----------------------------------------------------------------

When the build completes, the binary rpms are deposited in rpm/RPMS.

    ls -lart ${HOME}/rpm/RPMS

Please let me know if there are questions/problems.

-- Ken Sedgwick (ken@bonsai.com)
