# Version %global major 7 %global minor 0 %global patchlevel 0 # Revision %global revnum 0 # set to 1 for hg snapshots, 0 for release %global usesnapshot 1 # SNAPSHOT version %global hgrevhash 9aa7085f938b %global hgrevdate 20181122 # Install jmc in _libdir because it is arch-specific %global _jmcdir %{_libdir}/%{name} %global debug_package %{nil} %if %{usesnapshot} %global releasestr %{revnum}.%{hgrevdate}hg%{hgrevhash} %else %global releasestr %{revnum} %endif Name: jmc Version: %{major}.%{minor}.%{patchlevel} Release: %{releasestr}%{?dist} Summary: Java Mission Control is a profiling and diagnostics tool License: UPL URL: http://openjdk.java.net/projects/jmc/ # bash generate_jmc_tarball.sh Source0: %{name}-%{version}.tar.gz Source1: %{name}.desktop Source2: %{name}.1 Source3: generate_jmc_tarball.sh Source4: replace_plugins_with_symlinks.sh # Remove optional twitter related functionality # Patch0: 0_remove_twitter.patch # Update javamail dependency names to match what is found in Fedora # Patch1: 1_javamail.patch # Update javax dependency names to match what is found in Fedora # Patch2: 2_javax.patch # Remove localization files that currently cannot be supported # due to a packaging issue for Eclipse language packs # eclipse-nls-ja and eclipse-nls-zh # They currently provide multiple archs within the same package # and the local build system cannot fulfill dependencies from them # Patch3: 3_remove_localization.patch # Remove optional openjfx related functionality # Patch4: 4_remove_jfx.patch # Remove unused module org.openjdk.jmc.ide.jdt # Patch5: 5_remove_ide_jdt.patch # Add dependency on org. hamcrest-core to provide class used in unit tests # Patch6: 6_add_hamcrest.patch BuildRequires: desktop-file-utils BuildRequires: maven-local BuildRequires: mvn(org.apache.maven.plugins:maven-deploy-plugin:pom:) BuildRequires: mvn(org.apache.maven.plugins:maven-enforcer-plugin:pom:) BuildRequires: mvn(org.apache.maven.plugins:maven-install-plugin:pom:) BuildRequires: mvn(org.apache.maven.plugins:maven-site-plugin:pom:) BuildRequires: mvn(org.codehaus.mojo:buildnumber-maven-plugin) BuildRequires: mvn(org.commonjava.maven.plugins:directory-maven-plugin) BuildRequires: mvn(name.abuchen:fix-info-plist-maven-plugin) BuildRequires: osgi(com.sun.activation.jakarta.activation) BuildRequires: osgi(com.sun.mail.javax.mail) BuildRequires: osgi(org.eclipse.equinox.p2.core) BuildRequires: osgi(org.eclipse.pde.ui) BuildRequires: osgi(org.eclipse.swt) BuildRequires: osgi(org.fedoraproject.p2) BuildRequires: osgi(org.openjdk.jmc.common) BuildRequires: osgi(javax.annotation-api) %description Java Mission Control is a powerful profiler for HotSpot JVMs and has an advanced set of tools that enables efficient and detailed analysis of the extensive data collected by Java Flight Recorder. The tool chain enables developers and administrators to collect and analyze data from Java applications running locally or deployed in production environments. %prep %setup -q # % patch0 -p1 # % patch1 -p1 # % patch2 -p1 # % patch3 -p1 # % patch4 -p1 # % patch5 -p1 # % patch6 -p1 # Remove optional twitter related functionality %pom_disable_module org.openjdk.jmc.console.twitter application %pom_disable_module org.openjdk.jmc.feature.twitter application sed -i '/org.openjdk.jmc.console.twitter/d' application/org.openjdk.jmc.rjmx/META-INF/MANIFEST.MF sed -i '370,$d' license/THIRDPARTYREADME.txt # remove Twitter4J license text (will cause rpmlint error: incorrect-fsf-address) # Update javamail dependency names to match what is found in Fedora sed -i 's/javax.annotation;bundle-version="1.0.0";/javax.annotation-api;bundle-version="1.2.0";/' application/org.openjdk.jmc.console.ui/META-INF/MANIFEST.MF sed -i 's/javax.annotation;version="1.0.0",/javax.annotation;version="1.2.0",/' application/org.openjdk.jmc.console.ui/META-INF/MANIFEST.MF sed -i '169,197d' application/org.openjdk.jmc.feature.core/feature.xml sed -i 's/javax.mail.api/com.sun.mail.javax.mail/' application/org.openjdk.jmc.feature.core/feature.xml # Update javax dependency names to match what is found in Fedora sed -i 's/javax.el/javax.el-api/' application/org.openjdk.jmc.feature.rcp/feature.xml sed -i '87 a ' application/org.openjdk.jmc.feature.rcp/feature.xml # Remove localization files that currently cannot be supported due to a # packaging issue for Eclipse language packs eclipse-nls-ja and eclipse-nls-zh # They currently provide multiple archs within the same package and the local # build system cannot fulfill dependencies from them sed -i '/org.openjdk.jmc.feature.rcp.ja/,+3d' application/org.openjdk.jmc.feature.rcp/feature.xml sed -i '/org.openjdk.jmc.feature.rcp.zh_CN/,+3d' application/org.openjdk.jmc.feature.rcp/feature.xml sed -i '/org.openjdk.jmc.rcp.application.ja/,+8d' application/org.openjdk.jmc.feature.rcp/feature.xml sed -i '/org.openjdk.jmc.rcp.application.zh_CN/,+8d' application/org.openjdk.jmc.feature.rcp/feature.xml %pom_disable_module l10n application # Remove optional openjfx related functionality sed -i '/org.openjdk.jmc.javafx.osgi,/d' application/org.openjdk.jmc.flightrecorder.ui/META-INF/MANIFEST.MF sed -i '/org.openjdk.jmc.joverflow.ui,/d' application/org.openjdk.jmc.rjmx/META-INF/MANIFEST.MF sed -i '/org.openjdk.jmc.javafx.osgi/,+6d' application/org.openjdk.jmc.feature.flightrecorder/feature.xml %pom_disable_module org.openjdk.jmc.feature.flightrecorder.ext.jfx application %pom_disable_module org.openjdk.jmc.feature.joverflow application %pom_disable_module org.openjdk.jmc.flightrecorder.ext.jfx application %pom_disable_module org.openjdk.jmc.javafx.osgi application %pom_disable_module org.openjdk.jmc.joverflow application %pom_disable_module org.openjdk.jmc.joverflow.ui application %pom_disable_module org.openjdk.jmc.joverflow.test 'application/tests' # Remove unused module org.openjdk.jmc.ide.jdt sed -i '68,74d' application/org.openjdk.jmc.feature.ide/feature.xml %pom_disable_module org.openjdk.jmc.ide.jdt application # Add dependency on org. hamcrest-core to provide class used in unit tests sed -i '/Require-Bundle: org.junit,/a \\ org.hamcrest.core,' application/tests/org.openjdk.jmc.rjmx.services.jfr.test/META-INF/MANIFEST.MF sed -i 's/Import-Package: org.openjdk.jmc.flightrecorder.jdk/Import-Package: org.openjdk.jmc.flightrecorder.jdk,\n\ org.hamcrest.core/' application/tests/org.openjdk.jmc.rjmx.services.jfr.test/META-INF/MANIFEST.MF # Remove buchen repo %pom_xpath_remove "pom:pluginRepositories" "application/org.openjdk.jmc.rcp.product/pom.xml" # Remove Maven build profiles %pom_xpath_remove "pom:profiles" %pom_disable_module releng %pom_disable_module org.openjdk.jmc.updatesite.ide application %pom_disable_module org.openjdk.jmc.updatesite.rcp application %pom_remove_plugin com.github.spotbugs:spotbugs-maven-plugin %build %mvn_build -j -- -Dspotbugs.skip=true %install # change jmc.ini to use system java (remove -vm option line) sed -i '/^-vm$/d' %{_builddir}/%{name}-%{version}/target/products/org.openjdk.jmc/%{_os}/gtk/%{_arch}/%{name}.ini sed -i '/^..\/..\/bin\/$/d' %{_builddir}/%{name}-%{version}/target/products/org.openjdk.jmc/%{_os}/gtk/%{_arch}/%{name}.ini # add IgnoreUnrecognizedVMOptions flag to allow running on OpenJDK 8 without 'Unrecognized VM option' error sed -i '/^-vmargs$/a -XX:+IgnoreUnrecognizedVMOptions' %{_builddir}/%{name}-%{version}/target/products/org.openjdk.jmc/%{_os}/gtk/%{_arch}/%{name}.ini # delete unnecessary files rm -r %{_builddir}/%{name}-%{version}/target/products/org.openjdk.jmc/%{_os}/gtk/%{_arch}/p2/ # use symbolic links to system jars xmvn-subst -L true -R %{buildroot} . bash %{SOURCE4} %{_builddir}/%{name}-%{version}/target/products/org.openjdk.jmc/%{_os}/gtk/%{_arch}/ %{_javadir} # move contents of target/products/org.openjdk.jmc/linux/gtk/x86_64/ to /usr/lib/jmc/ install -d -m 755 %{buildroot}%{_jmcdir}/ cp -p -r %{_builddir}/%{name}-%{version}/target/products/org.openjdk.jmc/%{_os}/gtk/%{_arch}/* %{buildroot}%{_jmcdir}/ # create symlink to jmc in /usr/bin/ install -d -m 755 %{buildroot}%{_bindir} ln -s %{_jmcdir}/%{name} %{buildroot}%{_bindir}/%{name} # create application launcher in desktop menu install -d -m 755 %{buildroot}%{_datadir}/pixmaps mv %{buildroot}%{_jmcdir}/icon.xpm %{buildroot}%{_datadir}/pixmaps/%{name}.xpm chmod 644 %{buildroot}%{_datadir}/pixmaps/%{name}.xpm desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE1} # install pom file install -d -m 755 %{buildroot}%{_datadir}/maven-poms/%{name} install -p -m 644 %{_builddir}/%{name}-%{version}/pom.xml \ %{buildroot}%{_datadir}/maven-poms/%{name}/%{name}.pom # install manpage install -d -m 755 %{buildroot}%{_mandir}/man1 install -p -m 644 %{SOURCE2} %{buildroot}%{_mandir}/man1/%{name}.1 %files %license license/LICENSE.txt %license license/THIRDPARTYREADME.txt %doc README.md %{_jmcdir} %{_mandir}/man1/%{name}.1* %{_bindir}/%{name} %{_datadir}/maven-poms/%{name} %{_datadir}/pixmaps/%{name}.xpm %{_datadir}/applications/%{name}.desktop %changelog * Fri Nov 23 2018 Salman Siddiqui - 7.0.0-0.20181122hg9aa7085f938b - Update to latest snapshot version * Fri Sep 14 2018 Salman Siddiqui - 7.0.0-0 - Initial packaging