Blob Blame History Raw
Name:		qtiplot
Summary:	Data Analysis and Scientific Plotting Software
Version:	0.9.8.3
Release:	1%{?dist}
URL:		http://soft.proindependent.com/qtiplot.html
License:	GPLv2+
Group:		Applications/Engineering
Source0:	http://download.berlios.de/%{name}/%{name}-%{version}.tar.bz2
Source1:	http://soft.proindependent.com/misc/colormaps.tgz
Source2:	%{name}.desktop
Source3:	%{name}.xml
# Fix manual building
Patch0:		%{name}-0.9.8.3-manual.patch
# Disable choosing of help folder at runtime
Patch1:		%{name}-0.9.8-manualpath.patch
# Fix origin module building
Patch2:		%{name}-0.9.8.3-origin-build-failure.patch
BuildRequires:	qt4-devel
%if 0%{?fedora} >= 13
BuildRequires:	qt-assistant-adp-devel
%endif
BuildRequires:	gsl-devel
BuildRequires:	muParser-devel >= 1.32
BuildRequires:	libpng-devel
# Use local copy till upstream catches up
#BuildRequires:	qwt-devel
#BuildRequires:	qwtplot3d-qt4-devel
BuildRequires:	quazip-devel
BuildRequires:	liborigin2-devel >= 06042009-4.20100629svn
BuildRequires:	EmfEngine-devel
BuildRequires:	QTeXEngine-devel
BuildRequires:	PyQt4-devel
# sip-devel comes with PyQt4-devel
BuildRequires:	docbook-utils
BuildRequires:	docbook-style-xsl
BuildRequires:	desktop-file-utils
Requires:	muParser%{?_isa} >= 1.32
Requires:	liborigin2%{?_isa} >= 06042009-4.20100629svn
Requires:	hicolor-icon-theme
%{?_qt4_version:Requires: qt4%{?_isa} >= %{_qt4_version}}

%description
Scientists often need to use data analysis and plotting software. For Windows
systems there is a well known and widely used software called Origin, which is
not free, of course. The purpose of this project is to develop a free (open 
source), platform independent alternative to Origin. QtiPlot can already
successfully replace Origin in students computer classes and is being used in
universities and research institutes all over the world. QtiPlot is being
actively improved, all your suggestions to our "wish to" list and all your
contributions are most welcome!

%package doc
Summary:		Documentation for %{name}
Group:			Documentation
License:		GFDL
Requires:		%{name} = %{version}-%{release}
BuildArch:		noarch 

%description doc
The %{name}-doc package contains documentation for the %{name}.

%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1

# Fix default path for fitPlugins
sed -i 's\/usr/lib/%{name}/plugins\%{_libdir}/%{name}/plugins\g' \
	%{name}/src/core/ApplicationWindow.cpp

# Remove redundant variables
sed -i '/QTI_ROOT\/3rdparty/d' build.conf.example
sed -i '/manual.path = /d' %{name}/%{name}.pro
sed -i '/documentation.path = /d' %{name}/%{name}.pro
sed -i '/pythonconfig.path = /d' %{name}/%{name}.pro
sed -i '/\/libEMF/d' %{name}/%{name}.pro
sed -i '/3rdparty\/liborigin/d' %{name}/src/origin/origin.pri

# Fix docbook path to for fedora < 14
%if 0%{?fedora} > 13 
%else
sed -i "s/xml-dtd-4\.3/xml-dtd-4\.3-`rpm -q docbook-dtds|sed "s/^[^0-9]*//;s/\.noarch//;\
s/\./\\\./g"`/" manual/docbook-en/index.docbook
%endif

# Remove DOS line endings
sed -i 's/\r//' gpl_licence.txt
sed -i 's/\r//' %{name}/*.txt
sed -i 's/\r//' %{name}/*.py
sed -i 's/\r//' manual/html/%{name}.*

# Remove exec permission
find -type f -exec chmod 0644 {} ";"

%build
cp -p build.conf.example build.conf
export PATH=%{_qt4_bindir}:$PATH
%{_qt4_qmake} MUPARSER_LIBS=-lmuparser \
	GSL_INCLUDEPATH=%{_includedir}/gsl GSL_LIBS="-lgsl -lgslcblas" \
	QWT_INCLUDEPATH=../3rdparty/qwt/src QWT_LIBS=../3rdparty/qwt/lib/libqwt.a \
	QWT3D_INCLUDEPATH=../3rdparty/qwtplot3d/include QWT3D_LIBS=../3rdparty/qwtplot3d/lib/libqwtplot3d.a \
	BOOST_LIBS="-lz -lorigin2" \
	LIBORIGIN_INCLUDEPATH=%{_includedir}/liborigin2 LIBORIGIN_LIBS=-lorigin2 \
	QUAZIP_INCLUDEPATH="%{_includedir}/minizip %{_includedir}/quazip" QUAZIP_LIBS=-lquazip \
	LIBPNG_LIBS=-lpng \
	EMF_ENGINE_INCLUDEPATH=%{_includedir}/libEMF EMF_ENGINE_LIBS=-lEmfEngine \
	TEX_ENGINE_LIBS=-lQTeXEngine \
	CONFIG+=CustomInstall \
	DEFINES+=QTIPLOT_PRO \
	%if %{_lib}==lib64	
	libsuff=64 \
	%endif
	manual.path=%{_docdir}/%{name}-%{version}/manual documentation.path=%{_docdir}/%{name}-%{version} \
	pythonconfig.path=%{_datadir}/%{name}

pushd %{name}
lupdate-qt4 -verbose %{name}.pro
lrelease-qt4 -verbose %{name}.pro
popd
make %{?_smp_mflags}

%install
make install INSTALL="install -p" INSTALL_ROOT=%{buildroot}

# Remove local copy qwt/qwtplot3d
rm -r %{buildroot}%{_prefix}/local
rm -r %{buildroot}%{_builddir}

# Remove symlinks
find %{buildroot}%{_libdir}/%{name} -type l -exec rm {} ";"

# Fix wrong manual path(important!!!)
mv %{buildroot}%{_docdir}/%{name}-%{version}/manual/html/* \
	%{buildroot}%{_docdir}/%{name}-%{version}/manual
rmdir %{buildroot}%{_docdir}/%{name}-%{version}/manual/html

mkdir -p %{buildroot}%{_datadir}/%{name}
tar -xf %{SOURCE1} -C %{buildroot}%{_datadir}/%{name}
desktop-file-install \
	--dir=%{buildroot}%{_datadir}/applications %{SOURCE2}

# Add icon
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/128x128/apps
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/128x128/mimetypes
install -cpm 0644 %{name}_logo.png \
	%{buildroot}%{_datadir}/icons/hicolor/128x128/apps/%{name}.png
install -cpm 0644 %{name}_logo.png \
	%{buildroot}%{_datadir}/icons/hicolor/128x128/mimetypes/application-x-%{name}-project.png

# Add mimeinfo
mkdir -p %{buildroot}%{_datadir}/mime/packages
install -cpm 0644 %{SOURCE3} %{buildroot}%{_datadir}/mime/packages/%{name}.xml

%find_lang %{name} --with-qt --without-mo

%post
update-mime-database %{_datadir}/mime &> /dev/null || :
update-desktop-database &> /dev/null ||:
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :

%postun
update-mime-database %{_datadir}/mime &> /dev/null || :
update-desktop-database &> /dev/null ||:
if [ $1 -eq 0 ] ; then
    touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi

%posttrans
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :

%clean
rm -rf %{buildroot}

%files -f %{name}.lang
%defattr(-,root,root,-)
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/translations
%dir %{_docdir}/%{name}-%{version}
%{_bindir}/%{name}
%{_libdir}/%{name}
%{_datadir}/%{name}/colormaps
%{_datadir}/%{name}/qti*
%{_datadir}/applications/*
%{_datadir}/icons/hicolor/*/apps/*
%{_datadir}/icons/hicolor/*/mimetypes/*
%{_datadir}/mime/packages/*
%{_docdir}/%{name}-%{version}/README.html
%{_docdir}/%{name}-%{version}/gpl_licence.txt
%{_mandir}/man1/%{name}.1*

%files doc
%defattr(-,root,root,-)
%{_docdir}/%{name}-%{version}/manual

%changelog
* Wed Oct 13 2010 Chen Lei <supercyper@163.com> - 0.9.8.3-1
- upstream to 0.9.8.3

* Fri Sep 03 2010 Chen Lei <supercyper@163.com> - 0.9.8.2-1
- upstream to 0.9.8.2

* Fri Aug 27 2010 Chen Lei <supercyper@163.com> - 0.9.8.1-1
- upstream to 0.9.8.1

* Tue Jul 27 2010 Rex Dieter <rdieter@fedoraproject.org> - 0.9.8-3
- rebuild (python27)

* Wed Jun 30 2010 Chen Lei <supercyper@163.com> - 0.9.8-2
- add missing translation files

* Wed Jun 30 2010 Chen Lei <supercyper@163.com> - 0.9.8-1
- upstream to 0.9.8
- remove some patches