Blame SPECS/jmc.spec

9b2f7e
# Version
9b2f7e
%global major 7
9b2f7e
%global minor 0
9b2f7e
%global patchlevel 0
9b2f7e
9b2f7e
# Revision
9b2f7e
%global revnum 4
9b2f7e
9b2f7e
# set to 1 for hg snapshots, 0 for release
9b2f7e
%global usesnapshot 0
9b2f7e
9b2f7e
# SNAPSHOT version
9b2f7e
%global hgrevhash 9871e02a9e40
9b2f7e
%global hgrevdate 20190528
9b2f7e
9b2f7e
%global tarball_name jmc7-%{hgrevhash}
9b2f7e
9b2f7e
# Install jmc in /usr/lib/jmc (arch-specific and multilib exempt)
9b2f7e
%global _jmcdir %{_prefix}/lib/%{name}
9b2f7e
9b2f7e
%global debug_package %{nil}
9b2f7e
9b2f7e
%if %{usesnapshot}
9b2f7e
  %global releasestr %{revnum}.%{hgrevdate}hg%{hgrevhash}
9b2f7e
%else
9b2f7e
  %global releasestr %{revnum}
9b2f7e
%endif
9b2f7e
9b2f7e
%ifarch %{ix86}
9b2f7e
    %global eclipse_arch x86
9b2f7e
%endif
9b2f7e
%ifarch %{arm}
9b2f7e
    %global eclipse_arch arm
9b2f7e
%endif
9b2f7e
%ifarch s390x x86_64 aarch64 ppc64le
9b2f7e
    %global eclipse_arch %{_arch}
9b2f7e
%endif
9b2f7e
9b2f7e
# Don't export Eclipse libraries
9b2f7e
%global __provides_exclude_from ^%{_jmcdir}/plugins/org.eclipse.*$
9b2f7e
%global __requires_exclude_from ^%{_jmcdir}/plugins/org.eclipse.*$
9b2f7e
9b2f7e
%global __requires_exclude ^osgi\\((javax|org\\.apache|org\\.eclipse|org\\.sat4j).*$
9b2f7e
%global __provides_exclude ^osgi\\((com|javax|org\\.apache|org\\.glassfish|org\\.kxml2|org\\.sat4j|org\\.tukaani|org\\.w3c|org\\.xmlpull).*$
9b2f7e
9b2f7e
Name:       jmc
9b2f7e
Version:    %{major}.%{minor}.%{patchlevel}
9b2f7e
Release:    %{releasestr}%{?dist}
9b2f7e
Summary:    JDK Mission Control is a profiling and diagnostics tool
9b2f7e
9b2f7e
License:    UPL
9b2f7e
URL:        http://openjdk.java.net/projects/jmc/
9b2f7e
9b2f7e
Source0:    https://hg.openjdk.java.net/jmc/jmc7/archive/9871e02a9e40.tar.gz
9b2f7e
Source1:    %{name}.desktop
9b2f7e
Source2:    %{name}.1
9b2f7e
Source3:    symlink_libs.sh
9b2f7e
9b2f7e
# Remove optional twitter related functionality
9b2f7e
Patch0:     remove-twitter.patch
9b2f7e
# Update javax dependency names to match what is found in Fedora
9b2f7e
Patch1:     javax.patch
9b2f7e
# Remove maven build profiles that won't be used in local build
9b2f7e
Patch2:     remove-profiles.patch
9b2f7e
# Remove localization files that currently cannot be supported
9b2f7e
# due to a packaging issue for Eclipse language packs
9b2f7e
# eclipse-nls-ja and eclipse-nls-zh
9b2f7e
# They currently provide multiple archs within the same package
9b2f7e
# and the local build system cannot fulfill dependencies from them
9b2f7e
Patch3:     remove-localization.patch
9b2f7e
# Remove optional openjfx related functionality
9b2f7e
Patch4:     remove-jfx.patch
9b2f7e
# Remove unused module org.openjdk.jmc.ide.jdt
9b2f7e
Patch5:     remove-ide-jdt.patch
9b2f7e
# Remove unused remote repository definition
9b2f7e
Patch6:     remove-buchen-repo.patch
9b2f7e
# Add dependency on org. hamcrest-core to provide class used in unit tests
9b2f7e
Patch7:     add-hamcrest.patch
9b2f7e
# Remove windows and mac arches
9b2f7e
Patch8:     remove-arch.patch
9b2f7e
# Updates message for Java versions that support JFR
9b2f7e
Patch9:     fix-jfr-message.patch
9b2f7e
# Fix javamail plugin listing
9b2f7e
Patch10:    fix-javamail.patch
9b2f7e
9b2f7e
ExclusiveArch: x86_64
9b2f7e
9b2f7e
BuildRequires:  desktop-file-utils
9b2f7e
BuildRequires:  maven-local
9b2f7e
BuildRequires:  osgi(javax.annotation-api)
9b2f7e
9b2f7e
BuildRequires:  eclipse-pde
9b2f7e
BuildRequires:  tycho
9b2f7e
9b2f7e
BuildRequires:  javamail
9b2f7e
BuildRequires:  mvn(org.commonjava.maven.plugins:directory-maven-plugin)
9b2f7e
BuildRequires:  mvn(com.sun.activation:jakarta.activation)
9b2f7e
BuildRequires:  mvn(org.openjdk.jmc:common)
9b2f7e
9b2f7e
Requires:  java-openjdk >= 1:1.8
9b2f7e
9b2f7e
Requires:  osgi(com.sun.activation.jakarta.activation)
9b2f7e
Requires:  osgi(org.openjdk.jmc.common)
9b2f7e
Requires:  osgi(org.openjdk.jmc.flightrecorder)
9b2f7e
Requires:  osgi(org.openjdk.jmc.flightrecorder.rules)
9b2f7e
Requires:  osgi(org.openjdk.jmc.flightrecorder.rules.jdk)
9b2f7e
Requires:  osgi(org.owasp.encoder)
9b2f7e
9b2f7e
Requires: gtk3
9b2f7e
Requires: webkitgtk4
9b2f7e
Requires: libGLU.so.1()(64bit)
9b2f7e
9b2f7e
%description
9b2f7e
JDK Mission Control is a powerful profiler for HotSpot JVMs and has an
9b2f7e
advanced set of tools that enables efficient and detailed analysis of the
9b2f7e
extensive data collected by JDK Flight Recorder. The tool chain enables
9b2f7e
developers and administrators to collect and analyze data from Java
9b2f7e
applications running locally or deployed in production environments.
9b2f7e
9b2f7e
%prep
9b2f7e
%setup -q -n %{tarball_name}
9b2f7e
9b2f7e
%patch0 -p1
9b2f7e
%patch1 -p1
9b2f7e
%patch2 -p1
9b2f7e
%patch3 -p1
9b2f7e
%patch4 -p1
9b2f7e
%patch5 -p1
9b2f7e
%patch6 -p1
9b2f7e
%patch7 -p1
9b2f7e
%patch8 -p1
9b2f7e
%patch9 -p1
9b2f7e
%patch10 -p1
9b2f7e
9b2f7e
%pom_disable_module releng
9b2f7e
%pom_disable_module l10n application
9b2f7e
%pom_disable_module org.openjdk.jmc.updatesite.ide application
9b2f7e
%pom_disable_module org.openjdk.jmc.updatesite.rcp application
9b2f7e
9b2f7e
%pom_remove_plugin com.github.spotbugs:spotbugs-maven-plugin
9b2f7e
%pom_remove_plugin :maven-enforcer-plugin
9b2f7e
9b2f7e
# Info.plist are mac files and we only build for Linux
9b2f7e
%pom_remove_plugin name.abuchen:fix-info-plist-maven-plugin application/org.openjdk.jmc.rcp.product
9b2f7e
9b2f7e
%pom_remove_plugin org.codehaus.mojo:buildnumber-maven-plugin
9b2f7e
%pom_remove_plugin org.apache.maven.plugins:maven-deploy-plugin
9b2f7e
9b2f7e
TYCHO_ENV="<environment><os>linux</os><ws>gtk</ws><arch>%{eclipse_arch}</arch></environment>"
9b2f7e
%pom_xpath_set "pom:configuration/pom:environments" "$TYCHO_ENV"
9b2f7e
9b2f7e
%build
9b2f7e
# some tests require large heap and fail with OOM
9b2f7e
# depending on the builder resources
9b2f7e
%mvn_build -j -- -Dmaven.test.failure.ignore=true
9b2f7e
9b2f7e
%install
9b2f7e
9b2f7e
# not using mvn_install macro because it installs JMC as an Eclipse plugin
9b2f7e
# we want to install JMC as an RCP application
9b2f7e
9b2f7e
# change jmc.ini to use system java (remove -vm option line)
9b2f7e
sed -i '/^-vm$/d' %{_builddir}/%{tarball_name}/target/products/org.openjdk.jmc/%{_os}/gtk/%{eclipse_arch}/%{name}.ini
9b2f7e
sed -i '/^..\/..\/bin\/$/d' %{_builddir}/%{tarball_name}/target/products/org.openjdk.jmc/%{_os}/gtk/%{eclipse_arch}/%{name}.ini
9b2f7e
9b2f7e
# add IgnoreUnrecognizedVMOptions flag to allow running on OpenJDK 8 without 'Unrecognized VM option' error
9b2f7e
sed -i '/^-vmargs$/a -XX:+IgnoreUnrecognizedVMOptions' %{_builddir}/%{tarball_name}/target/products/org.openjdk.jmc/%{_os}/gtk/%{eclipse_arch}/%{name}.ini
9b2f7e
9b2f7e
# move contents of target/products/org.openjdk.jmc/${_os}/gtk/%{eclipse_arch}/ to /usr/lib/jmc/
9b2f7e
install -d -m 755 %{buildroot}%{_jmcdir}
9b2f7e
cp -p -r %{_builddir}/%{tarball_name}/target/products/org.openjdk.jmc/%{_os}/gtk/%{eclipse_arch}/* %{buildroot}%{_jmcdir}/
9b2f7e
9b2f7e
# move jmc.ini to /etc/jmc.ini
9b2f7e
install -d -m 755 %{buildroot}%{_sysconfdir}
9b2f7e
mv %{buildroot}%{_jmcdir}/%{name}.ini %{buildroot}%{_sysconfdir}/%{name}.ini
9b2f7e
ln -s %{_sysconfdir}/%{name}.ini %{buildroot}%{_jmcdir}/%{name}.ini
9b2f7e
9b2f7e
# create symlink to jmc in /usr/bin/
9b2f7e
install -d -m 755 %{buildroot}%{_bindir}
9b2f7e
ln -s %{_jmcdir}/%{name} %{buildroot}%{_bindir}/%{name}
9b2f7e
9b2f7e
# replace jars with symlinks to installed libraries
9b2f7e
bash %{SOURCE3} %{buildroot}%{_jmcdir}/plugins %{_javadir} %{_jnidir} %{_javadir_maven} %{_jnidir_maven}
9b2f7e
9b2f7e
# create application launcher in desktop menu
9b2f7e
install -d -m 755 %{buildroot}%{_datadir}/pixmaps
9b2f7e
mv %{buildroot}%{_jmcdir}/icon.xpm %{buildroot}%{_datadir}/pixmaps/%{name}.xpm
9b2f7e
chmod 644 %{buildroot}%{_datadir}/pixmaps/%{name}.xpm
9b2f7e
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE1}
9b2f7e
9b2f7e
# install pom file
9b2f7e
install -d -m 755 %{buildroot}%{_datadir}/maven-poms/%{name}
9b2f7e
install -p -m 644 %{_builddir}/%{tarball_name}/pom.xml %{buildroot}%{_datadir}/maven-poms/%{name}/%{name}.pom
9b2f7e
9b2f7e
# install manpage and insert location of config file
9b2f7e
install -d -m 755 %{buildroot}%{_mandir}/man1
9b2f7e
install -p -m 644 %{SOURCE2} %{buildroot}%{_mandir}/man1/%{name}.1
9b2f7e
sed -i "/.SH FILES/a .I %{_sysconfdir}/%{name}.ini" %{buildroot}%{_mandir}/man1/%{name}.1
9b2f7e
9b2f7e
%files
9b2f7e
%license license/LICENSE.txt
9b2f7e
%license license/THIRDPARTYREADME.txt
9b2f7e
%doc README.md
9b2f7e
%config(noreplace) %{_sysconfdir}/%{name}.ini
9b2f7e
%{_jmcdir}
9b2f7e
%{_mandir}/man1/%{name}.1*
9b2f7e
%{_bindir}/%{name}
9b2f7e
%{_datadir}/maven-poms/%{name}
9b2f7e
%{_datadir}/pixmaps/%{name}.xpm
9b2f7e
%{_datadir}/applications/%{name}.desktop
9b2f7e
9b2f7e
%changelog
9b2f7e
* Thu Nov 14 2019 Jie Kang <jkang@redhat.com> - 7.0.0-4
9b2f7e
- Fix requires
9b2f7e
* Wed Nov 13 2019 Jie Kang <jkang@redhat.com> - 7.0.0-3
9b2f7e
- Fix exclusions
9b2f7e
* Wed Nov 13 2019 Jie Kang <jkang@redhat.com> - 7.0.0-2
9b2f7e
- Update require and provide exclusions
9b2f7e
* Tue Mar 12 2019 Jie Kang <jkang@redhat.com> - 7.0.0-1
9b2f7e
- Initial package