Packaging:GCJGuidelines

= GCJ Guidelines =

GCJ AOT bits SHOULD be built and included in packages. If GCJ-specific issues prevent you from building the package, it is permissible to simply omit GCJ support and build using OpenJDK. However, please file a bug against the  component in Red Hat bugzilla. Compilation into native code must be optional and enabled by default, if present.

In some rare cases Java packages might not contain any executable code whatsoever so AOT-compiling for gcj would not be required. An example of such a package would be one that contained only annotation definitions.

How to add GCJ AOT bits to a Java package
Like other Java runtimes, libgcj can load classes from bytecode class files. Unlike other Java runtimes, libgcj can also load classes that have been compiled to native machine code using GCJ.


 * For packages in which all JAR files are in the main package:

1. Add the following definition: %global with_gcj %{!?_without_gcj:1}%{?_without_gcj:0} 1. Conditionalize dependencies and be architecture dependent %if %{with_gcj} BuildRequires:   java-gcj-compat-devel >= 1.0.31 Requires(post):  java-gcj-compat >= 1.0.31 Requires(postun): java-gcj-compat >= 1.0.31 %else BuildArch:     noarch %endif 1. Add the following to the end of  section: %if %{with_gcj} %{_bindir}/aot-compile-rpm %endif 1. Add the following to the package's  and   sections, creating the sections if necessary: %if %{with_gcj} if [ -x %{_bindir}/rebuild-gcj-db ] then %{_bindir}/rebuild-gcj-db fi %endif 1. Add the following to the  section: %if %{with_gcj} %attr(-,root,root) %{_libdir}/gcj/%{name} %endif


 * For packages in which all JAR files are in one subpackage, the,  ,   and   lines should refer to that subpackage.

%if %{with_gcj} %attr(-,root,root) %{_libdir}/gcj/%{name}/foo-x.y.z.jar.* %endif Note that the path has been stripped and  has been appended.
 * For packages in which more than one subpackage (including the main package) contains JAR files, then each subpackage should have its own,   and   lines, and the   lists should be split such that the subpackage that contains   should have the following   line: