File lttng-trace-viewer.spec of Package lttng-trace-viewer
#
# spec file for package lttng-trace-viewer
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
Summary: LTTng graphical trace viewer
Name: lttng-trace-viewer
Version: 2.2.1
Release: 0
License: EPL-1.0
Group: Development/Tools/IDE
URL: http://www.eclipse.org/linuxtools/projectPages/lttng
Source0: http://ftp.osuosl.org/pub/eclipse//technology/epp/downloads/release/kepler/SR2/eclipse-standard-kepler-SR2-linux-gtk-x86_64.tar.gz
Source1: http://ftp.osuosl.org/pub/eclipse//eclipse/downloads/drops4/R-4.3.2-201402211700/eclipse-4.3.2-delta-pack.zip
Source2: http://ftp.osuosl.org/pub/eclipse/tm/downloads/drops/S-3.6M4-201312162110/org.eclipse.tm.repo-3.6-M4.zip
Source3: http://ftp.osuosl.org/pub/eclipse/tools/cdt/releases/kepler/sr2/cdt-master-8.3.0.zip
Source4: http://git.eclipse.org/c/linuxtools/org.eclipse.linuxtools.git/snapshot/org.eclipse.linuxtools-2.2.1.tar.bz2
Source5: http://download.eclipse.org/tools/orbit/downloads/drops/R20140114142710/repository/plugins/org.antlr.runtime_3.0.0.v200803061811.jar
Source6: http://download.eclipse.org/tools/orbit/downloads/drops/R20140114142710/repository/plugins/org.antlr.runtime_3.2.0.v201101311130.jar
Source7: http://www.antlr3.org/download/antlr-3.2.jar
Patch0: %{name}-move-lttng-plugins-from-features-to-plugins.patch
Patch1: %{name}-npe-when-exporting-product-containing-a-license-feature.patch
BuildRequires: java >= 1.6, unzip
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires: java >= 1.6
ExclusiveArch: x86_64
%define _basedir %{_builddir}/%{name}-%{version}
%define _eclipse %{_basedir}/eclipse
%define _linuxtools %{_basedir}/org.eclipse.linuxtools-2.2.1
%define _config %{_basedir}/config
%define _tmpbin %{_basedir}/bin
%define _equinox_launcher plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
%define _build_properties plugins/org.eclipse.pde.build_3.8.100.v20130514-1028/templates/headless-build/build.properties
%define _product_build plugins/org.eclipse.pde.build_3.8.100.v20130514-1028/scripts/productBuild/productBuild.xml
%description
This is the native (Eclipse RCP) application for graphically viewing LTTng traces.
%prep
%setup -q -T -a 0 -c
unzip -q -o -d %{_basedir} %{S:1}
java -jar %{_eclipse}/%{_equinox_launcher} \
-application org.eclipse.equinox.p2.director \
-repository jar:file:%{S:2}\!/ \
-installIU org.eclipse.rse.feature.group,org.eclipse.rse.local.feature.group \
-destination %{_eclipse}
java -jar %{_eclipse}/%{_equinox_launcher} \
-application org.eclipse.equinox.p2.director \
-repository jar:file:%{S:3}\!/ \
-installIU org.eclipse.cdt.feature.group \
-destination %{_eclipse}
%setup -q -D -T -a 4
cp %{S:5} %{S:6} %{_eclipse}/plugins
mkdir %{_config}
cp %{_eclipse}/%{_build_properties} %{_config}
mkdir plugins features
for i in %{_linuxtools}/lttng/org.eclipse.linuxtools*
do
d=plugins
if [ -f $i/feature.xml ]
then
d=features
fi
ln -s $i $d
done
ln -s %{_linuxtools}/releng/org.eclipse.linuxtools.license-feature features
# fix for '.../features/org.eclipse.linuxtools.tracing.rcp.branding.feature/../org.eclipse.linuxtools.license-feature' ENOENT error
ln -s %{_linuxtools}/releng/org.eclipse.linuxtools.license-feature %{_linuxtools}/lttng
mkdir %{_tmpbin}
cat << -EOF- > %{_tmpbin}/antlr3
#!/bin/bash
java -jar %{S:7} "\$@"
-EOF-
chmod +x %{_tmpbin}/antlr3
%patch0
%patch1
%build
PATH=$PATH:%{_tmpbin}
pushd %{_linuxtools}/lttng/org.eclipse.linuxtools.ctf.parser
sh generate-grammar.sh
popd
#fixme
#sed --in-place 's/Version: 0.0.1/Version: %{version}-%{release}/' %{_linuxtools}/lttng/org.eclipse.linuxtools.tracing.rcp.product/tracing.product
java -jar %{_eclipse}/%{_equinox_launcher} \
-application org.eclipse.ant.core.antRunner \
-buildfile %{_eclipse}/%{_product_build} \
-DflattenDependencies=true \
-Dbuilder=%{_config} \
-DbaseLocation=%{_eclipse} \
-DbuildDirectory=$PWD \
-Dproduct=org.eclipse.linuxtools.tracing.rcp.product/tracing.product \
-DjavacSource=1.6 -DjavacTarget=1.6 \
-Dbaseos=linux64 -Dbasews=gtk -Dbasearch=x86_64 \
-Dconfigs="linux, gtk, x86_64" \
-Dp2.gathering=true
%install
mkdir -p $RPM_BUILD_ROOT/%{_bindir}
unzip -d $RPM_BUILD_ROOT/%{_libdir} I.TestBuild/TestBuild-linux.gtk.x86_64.zip
mv $RPM_BUILD_ROOT/%{_libdir}/eclipse $RPM_BUILD_ROOT/%{_libdir}/%{name}
ln -s %{_libdir}/%{name}/traceViewer $RPM_BUILD_ROOT/%{_bindir}/%{name}
%files
%defattr(-, root, root)
%{_bindir}/%{name}
%attr(755,root,root) %dir %{_libdir}/%{name}
%attr(755,root,root) %dir %{_libdir}/%{name}/readme
%attr(755,root,root) %dir %{_libdir}/%{name}/p2
%attr(755,root,root) %dir %{_libdir}/%{name}/configuration
%attr(755,root,root) %dir %{_libdir}/%{name}/plugins
%attr(755,root,root) %dir %{_libdir}/%{name}/features
%doc %{_libdir}/%{name}/readme/readme_eclipse.html
%doc %{_libdir}/%{name}/about.html
%doc %{_libdir}/%{name}/notice.html
%doc %{_libdir}/%{name}/epl-v10.html
%{_libdir}/%{name}/p2/*
%{_libdir}/%{name}/configuration/*
%{_libdir}/%{name}/plugins/*
%{_libdir}/%{name}/features/*
%{_libdir}/%{name}/traceViewer
%{_libdir}/%{name}/traceViewer.ini
%{_libdir}/%{name}/.eclipseproduct
%{_libdir}/%{name}/artifacts.xml
%{_libdir}/%{name}/icon.xpm
%changelog