Original: http://www.jpackage.org/rebuilding.php
Copy taken: Sat Nov 29 2003 for archival purposes


JPackage Project


"I installed the RPM, dropped my .war file in the deploy directory, and it works ;)"

Number of (S)RPMs available: 675

Rebuilding packages

Here are some explanations for rebuilding packages from source, as it is mandatory for our non-free section (we can't distribute binary packages of them).

Initial setup

First, you need a build tree. You may already have one in /usr/src/RPM, but as rebuilding package as root is evil, we recommend that you create one to 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
|   |-- i386
|   |-- i586
|   `-- noarch
|-- SOURCES
|-- SPECS
|-- SRPMS
`-- tmp

Actually, under the default RPM configuration, you need one subdirectory per architecture you intend to build for in rpm/RPMS/. But as Java packages are mostly noarch, and proprietary JDK/J2SE's are already built for i386 or i586, this should be enough. There are ways to tweak this, see below.

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

%_topdir        %(echo ${HOME}/rpm)
%_tmppath       %{_topdir}/tmp

%packager       Firstname Lastname <your.address@here>

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

Of course, substitute your own name to the above. Note that all macros are only default values for tags not explicitly filled in spec files.

Building a package

Normal command for rebuilding a standard source package (.src.rpm) is:
rpmbuild --rebuild foo-x.y.z-wjpp.src.rpm If you are using an older (pre-4.0.2?) version of rpm, substitute rpmbuild with rpm in the command. Note that rpmbuild is usually part of the rpm-build package.

Further, packages from non-free section are actually .nosrc.rpm, meaning that they don't contain all sources due to legal issues (prohibited redistribution). So, you'll have to proceed in several steps here.

  1. Install the source package:
    rpm -i foo-x.y.z-wjpp.nosrc.rpm
  2. Get the missing sources from their original location. File names and base URLs can be found in the spec file, installed into rpm/SPECS/foo.spec by the above command.
  3. Put the sources you've downloaded to rpm/SOURCES.
  4. Build package from spec file:
    rpmbuild -ba rpm/SPECS/foo.spec
    (again, substituting rpmbuild with rpm if necessary)

Unless something fails in the process, you should obtain the source package in rpm/SRPMS and binary package in relevant subdirectory of rpm/RPMS.

More information

For more information about building packages:


SourceForge.net Logo Valid XHTML 1.0! Valid CSS!
Copyleft 2002-2003 JPackage Project [credits]
$Id: rebuilding.php,v 1.9 2003/11/27 16:09:02 guillomovitch Exp $