openSUSE:Java RPM Macros
RPM macros
Those macros are mostly defined in the following packages:
jpackage-utils
(<= openSUSE 12.3)javapackages-tools
(>= openSUSE Leap 42.1)
Don't forget add it to BuildRequires tag!
%_jvmdir
Root directory where all Java VMs/SDK/JREs are installed.
%_jvmdir %{_libdir}/jvm
%_jvmjardir
Root directory where all Java VMs/SDK/JREs expose their jars
%_jvmjardir %{_libdir}/jvm-exports
%_jvmprivdir
Root directory for all Java VM/SDK/JRE's private things.
%_jvmprivdir %{_libdir}/jvm-private
%_jvmlibdir
Root directory for all architecture dependent parts of Java VM/SDK/JRE's
%_jvmlibdir %{_prefix}/lib/jvm
%_jvmdatadir
Root directory for all architecture independent parts of Java VM/SDK/JRE's
%_jvmdatadir %{_datadir}/jvm
%_jvmsysconfdir
Root directory for all configurations parts of Java VM/SDK/JRE's
%_jvmsysconfdir %{_sysconfdir}/jvm
%_jvmcommonlibdir
Root directory for all common architecture dependent parts of Java VM/SDK/JRE's
%_jvmcommonlibdir %{_prefix}/lib/jvm-commmon
%_jvmcommondatadir
Root directory for all common architecture independent parts of Java VM/SDK/JRE's
%_jvmcommondatadir %{_datadir}/jvm-commmon
%_jvmcommonsysconfdir
Root directory for all common configurations parts of Java VM/SDK/JRE's
%_jvmcommonsysconfdir %{_sysconfdir}/jvm-commmon
%_javadir
Directory where arch and version independent jars are installed. This has already been integrated in RH macros following our request.
By extension:
%{_javadir}-ext
: - version dependent jars%{_javadir}-x.y.z
: - jars for Java standard x.y.z (usually symlinks to %{_javadir}-ext)%{_javadir}-utils
: - Java-related scripts
To simplify things only %{_javadir}
is defined.
%_javadir %{_datadir}/java
%_jnidir
Directory where arch-specific (JNI) version-independent jars are installed.
By extension:
%{_jnidir}-ext
: - version dependent jars%{_jnidir}-x.y.z
:- jars for Java standard x.y.z (usually symlinks to%{_jnidir}-ext
)
To simplify things only %{_jnidir}
is defined.
%_jnidir %{_libdir}/java
%_javadocdir
Root directory where all javadoc is installed. Also already in RH macros.
%_javadocdir %{_datadir}/javadoc
%java_home
Current default JVM home.
%java_home %(. %{_javadir}-utils/java-functions; set_jvm; echo $JAVA_HOME)
default Java commands
%ant JAVA_HOME=%{java_home} ant %jar %{java_home}/bin/jar %java %(. %{_javadir}-utils/java-functions; set_javacmd; echo $JAVACMD) %javac %{java_home}/bin/javac %javadoc %{java_home}/bin/javadoc
%add_jvm_extension
add_jvm_extension
should be used in %install by extension packages to declare
what extension jars they provide.
For example a package that provides foo.jar which is the bar extension under java 1.2 and 1.3 should do a:
%install ... # create foo.jar in %{javadir}-ext %add_jvm_extension foo bar 1.2 1.3
%files %{javadir}-ext/foo.jar %{javadir}-*/bar.jar
%add_jvm_extension JAVA_LIBDIR=%{buildroot}/%{_javadir} %{_bindir}/jvmjar -l
%_mavendepmapdir
Directory for maven depmaps
%_mavendepmapdir /etc/maven %_mavendepmapfragdir /etc/maven/fragments
%add_to_maven_depmap()
add_to_depmap adds an entry to the depmap. The arguments are:
- %1 the original groupid
- %2 the original artifact id
- %3 the version
- %4 the new groupid
- %5 the new artifactid
%add_to_maven_depmap() \ install -dm 755 $RPM_BUILD_ROOT/%{_mavendepmapfragdir}\ cat >>$RPM_BUILD_ROOT/%{_mavendepmapfragdir}/%{name}<< EOF\ <dependency>\ <maven>\ <groupId>%1</groupId>\ <artifactId>%2</artifactId>\ <version>%3</version>\ </maven>\ <jpp>\ <groupId>%4</groupId>\ <artifactId>%5</artifactId>\ <version>%3</version>\ </jpp>\ </dependency>\ \ EOF\ %{nil}
%update_maven_depmap()
update_maven_depmap updates the main maven depmap
%update_maven_depmap() \ echo -e "<dependencies>\\n" > %{_mavendepmapdir}/maven2-depmap.xml\ if [ -d %{_mavendepmapfragdir} ] && [ -n "`find %{_mavendepmapfragdir} -type f`" ]; then\ cat %{_mavendepmapfragdir}/* >> %{_mavendepmapdir}/maven2-depmap.xml\ fi\ echo -e "</dependencies>\\n" >> %{_mavendepmapdir}/maven2-depmap.xml\ %{nil}