The packaging infrastructure design and packaging policy documentation is included in the jpackage-utils package. An online version is also available, as well as the old version which may contain some stuff that is not merged to the new one yet. There are also man pages for the scripts that are installed by that same package.

Someone tried to put together a SPEC file template sometime ago, but perhaps you are better off asking in the mailing list for the current "coolest" SPEC file and use that as a template. At least for the time being.

Tom Fitzsimmons created a script that adds the AOT compilation bits to a specfile, making possible to have it compiled by GCJ and thus it becomes possible to use this same spec file in Fedora Core. The script is spec-convert-gcj and for the instructions on how to use just invoke it with '--help'.

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) and for preparing new packages or updated packages for uploading.

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:

|-- RPMS
|   |-- i386
|   |-- i586
|   `-- noarch
`-- 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

# Uncomment for signing your packages with GPG
#%_gpg_name FirstName LastName <email address>
#%_gpg_path /path/to/keys

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.

Uploading packages

Information about uploading packages is at the end of the Build Process section.

More information

For more information about building packages: