# # RPM macros for Java applications. # # JPackage Project # David Walluck # Ville Skyttä # Nicolas Mailhot # #============================================================================== # ---- default Java directories # # Root directory where all Java VMs/SDK/JREs are installed. # %_jvmdir %{_prefix}/lib/jvm # # Root directory where all Java VMs/SDK/JREs expose their jars # %_jvmjardir %{_prefix}/lib/jvm-exports # # Root directory for all Java VM/SDK/JRE's private things. # %_jvmprivdir %{_prefix}/lib/jvm-private # # Root directory for all architecture dependent parts of Java VM/SDK/JRE's # %_jvmlibdir %{_prefix}/lib/jvm # # Root directory for all architecture independent parts of Java VM/SDK/JRE's # %_jvmdatadir %{_datadir}/jvm # # Root directory for all configurations parts of Java VM/SDK/JRE's # %_jvmsysconfdir %{_sysconfdir}/jvm # # Root directory for all common architecture dependent parts of Java VM/SDK/JRE's # %_jvmcommonlibdir %{_prefix}/lib/jvm-commmon # # Root directory for all common architecture independent parts of Java VM/SDK/JRE's # %_jvmcommondatadir %{_datadir}/jvm-commmon # # Root directory for all common configurations parts of Java VM/SDK/JRE's # %_jvmcommonsysconfdir %{_sysconfdir}/jvm-commmon # # 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 # # 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 %{_prefix}/lib/java # # Root directory where all javadoc is installed. Also already in RH macros. # %_javadocdir %{_datadir}/javadoc # # Directory for maven depmaps # %_mavendepmapdir /etc/maven %_mavendepmapfragdir /etc/maven/fragments # # 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 #============================================================================== # ---- Java extension handling macros # # 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 #============================================================================== # # 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\ \ \ %1\ %2\ %3\ \ \ %4\ %5\ %3\ \ \ \ EOF\ %{nil} #============================================================================== # # update_maven_depmap updates the main maven depmap # %update_maven_depmap() \ echo -e "\\n" > %{_mavendepmapdir}/maven2-depmap.xml\ if [ -d %{_mavendepmapfragdir} ] && [ -n "`find %{_mavendepmapfragdir} -type f`" ]; then\ cat %{_mavendepmapfragdir}/* >> %{_mavendepmapdir}/maven2-depmap.xml\ fi\ echo -e "\\n" >> %{_mavendepmapdir}/maven2-depmap.xml #============================================================================== # ---- GCJ support %_gcj_support 1 #============================================================================== # ---- default icons directories as per the icon theme freedesktop spec %_iconstheme hicolor %_iconsbasedir %{_datadir}/icons/%{_iconstheme} # # The following is a bit heavy and will be removed # %_icons16dir %{_iconsbasedir}/16x16/apps %_icons22dir %{_iconsbasedir}/22x22/apps %_icons48dir %{_iconsbasedir}/48x48/apps %_icons64dir %{_iconsbasedir}/64x64/apps %_icons96dir %{_iconsbasedir}/96x96/apps %_icons192dir %{_iconsbasedir}/192x192/apps %_iconsscaldir %{_iconsbasedir}/scalable/apps # # Mandriva macros for non-Mandriva systems. # %_miconsdir %{_datadir}/icons/mini %_iconsdir %{_datadir}/icons %_liconsdir %{_datadir}/icons/large # # Mandriva icons # # %1 the name of the icon (typically the name of the package). Mandriva # requires 3 icons sizes (48, 32, 16), all should be present. # %mdkicons() \ install -D -m 644 %1-48.png $RPM_BUILD_ROOT%{_liconsdir}/%1.png\ install -D -m 644 %1-32.png $RPM_BUILD_ROOT%{_iconsdir}/%1.png\ install -D -m 644 %1-16.png $RPM_BUILD_ROOT%{_miconsdir}/%1.png # # Red Hat icons # # %1 the name of the icon (typically the name of the package). RedHat # requires 3 icons sizes (48, 32, 16), all should be present. %rhicons() \ install -D -m 644 %1-48.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps/%{name}.png\ install -D -m 644 %1-32.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/%{name}.png\ install -D -m 644 %1-16.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/%{name}.png #============================================================================== # ---- default .desktop directories per the desktop-entry freedesktop.org spec %_desktopdir %{_datadir}/applications # # Mandriva menu dir # %_menudir %{_prefix}/lib/menu # # Mandriva menu # # %1 the name of the menu (ex: %{name}) # %2 the command to run (ex: %{_bindir}/%{name}) # %3 needs (ex: X11) # %4 menu section (ex: Applications/Editors) # %5 mime types (ex: text/html;text/plain) # %6 menu title (ex: %{name}) # %7 comment or summary (ex: %{Summary}) # %8 icon (ex: %{name}.png) # %9 unused # %mdkmenu() \ install -d -m 755 $RPM_BUILD_ROOT%{_menudir}\ cat >$RPM_BUILD_ROOT%{_menudir}/%1 <$RPM_BUILD_ROOT%{_sysconfdir}/X11/applnk/%4/%1.desktop < $RPM_BUILD_ROOT%{_bindir}/%5 << EOF \ #!/bin/sh\ #\ # %{name} script\ # JPackage Project \ \ # Source functions library\ . %{_javadir}-utils/java-functions\ \ # Source system prefs\ if [ -f %{_sysconfdir}/java/%{name}.conf ] ; then\ . %{_sysconfdir}/java/%{name}.conf\ fi\ \ # Source user prefs\ if [ -f \\$HOME/.%{name}rc ] ; then\ . \\$HOME/.%{name}rc\ fi\ \ # Configuration\ MAIN_CLASS=%1\ BASE_FLAGS=%2\ BASE_OPTIONS=%3\ BASE_JARS="%(echo %4 | sed -e 's,:, ,g')"\ \ # Set parameters\ set_jvm\ set_classpath \\$BASE_JARS\ set_flags \\$BASE_FLAGS\ set_options \\$BASE_OPTIONS\ \ # Let's start\ run "\\$@"\ EOF