File dx.spec of Package dx

#
# spec file for package dx
#
# Copyright (c) 2013 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.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           dx
%define         samplesversion 4.4.0
BuildRequires:  ImageMagick-devel
BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  freeglut-devel
BuildRequires:  freetype2-devel
BuildRequires:  gcc-c++
BuildRequires:  libexpat0
BuildRequires:  libpng-devel
BuildRequires:  libtiff-devel
BuildRequires:  libtool
BuildRequires:  openmotif
BuildRequires:  openmotif-devel
BuildRequires:  tcsh
BuildRequires:  update-desktop-files
%if %suse_version > 1000
BuildRequires:  libdrm-devel
%endif
BuildRequires:  fdupes
Version:        4.4.4
Release:        0
Summary:        IBM Open Visualization Data Explorer
License:        IPL-1.0
Group:          Productivity/Graphics/Visualization/Other
Requires:       jre
Requires:       tcsh
Url:            http://opendx.org/
Source0:        dx-%{version}.tar.bz2
Source1:        dxsamples-%{samplesversion}.tar.bz2
Source2:        dx.desktop
Patch0:         dx-%{version}-string.patch
Patch1:         dx-%{version}-rights.patch
Patch2:         dx-%{version}-xkiso.patch
Patch3:         dx-%{version}-uninitialized_var.patch
Patch4:         dx-%{version}-implicit_decl.patch
Patch5:         dx-%{version}-return_value.patch
Patch6:         dx-%{version}-increment.patch
Patch7:         dx-%{version}-undefined_code.patch
Patch8:         dx-%{version}-manpage.patch
Patch9:         dx-%{version}-linux-sys.patch
Patch10:        dx-%{version}-array-overflow.patch
Patch11:        %{name}-%{version}-gcc_43.patch
Patch12:        %{name}-%{version}-open.patch
Patch13:        %{name}-%{version}-ac.patch
# PATCH-FIX-UPSTREAM errno-init.patch fix errno init (bnc#479845)
Patch14:        %{name}-%{version}-errno-init.patch
# PATCH-FIX-UPSTREAM missing-sentinel.patch fix missing sentinel (rpmlint check error)
Patch15:        %{name}-%{version}-missing-sentinel.patch
# PATCH-FIX-UPSTREAM link against ImageMagick libraries (bnc#525987)
Patch16:        %{name}-%{version}-imagemagick.patch
# PATCH-FIX-UPSTREAM fix mem leak (bnc#538399)
Patch17:        %{name}-%{version}-leak-fix.patch
Patch20:        dxsamples-%{samplesversion}-java.patch
Patch21:        dxsamples-%{samplesversion}-DESTDIR.patch
Patch22:        dxsamples-%{samplesversion}-rights.patch
# PATCH-FIX-UPSTREAM dx-4.4.4-mem-leak-fix.patch (bnc#546115)
#Patch23:        %{name}-%{version}-mem-leak-fix.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Recommends:     dx-data=%{version}, dx-doc=%{version}, dx-devel=%{version}

%description
The Open Visualization Data Explorer is a visualization framework that
gives users the ability to apply advanced visualization and analysis
techniques to their data. These techniques can be applied to help users
gain new insights into data from applications in a wide variety of
fields including science, engineering, medicine, and business.

%package doc
Summary:        Additional Package Documentation for dx
Group:          Productivity/Graphics/Visualization/Other
Provides:       dxdoc
Requires:       %{name} = %{version}
Obsoletes:      dxdoc
%if 0%{?suse_version} >= 1120
BuildArch:      noarch
%endif

%description doc
This package contains the documentation for the IBM Open Visualization
Data Explorer in HTML format.

%package data
Summary:        Sample data for the IBM Open Visualization Data Explorer
Group:          Productivity/Graphics/Visualization/Other
Provides:       dxdata
Requires:       %{name} = %{version}
Obsoletes:      dxdata
%if 0%{?suse_version} >= 1120
BuildArch:      noarch
%endif

%description data
This package contains some sample data for the IBM Open Visualization
Data Explorer.

%package devel
Summary:        Headers, static libs and source code files for the IBM Open Visualization Data Explorer
Group:          Development/Tools/Other
Requires:       %{name} = %{version}
Requires:       Mesa-devel
Requires:       fontconfig-devel
Requires:       freetype2-devel
Requires:       glibc-devel
Requires:       libexpat-devel
Requires:       libjpeg-devel
Requires:       libpng-devel
Requires:       libtiff-devel
Requires:       openmotif-devel
Requires:       xorg-x11-devel
Requires:       xorg-x11-libICE-devel
Requires:       xorg-x11-libSM-devel
Requires:       xorg-x11-libX11-devel
Requires:       xorg-x11-libXau-devel
Requires:       xorg-x11-libXext-devel
Requires:       xorg-x11-libXmu-devel
Requires:       xorg-x11-libXp-devel
Requires:       xorg-x11-libXpm-devel
Requires:       xorg-x11-libXrender-devel
Requires:       xorg-x11-libXt-devel
Requires:       xorg-x11-libxcb-devel
Requires:       zlib-devel
%if  0%{?suse_version} > 1030
Requires:       ImageMagick-devel
Requires:       libbz2-devel
Requires:       liblcms-devel
%endif

%description devel
This package contains header C files, static libraries and source code
files for the IBM Open Visualization Data Explorer.

%prep
%setup -q -b 1
%patch0
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6
%patch7
%patch8
%patch9 -p1
%patch10
%patch11
%patch12
%patch13
%patch14
%patch15
%patch16
%patch17
# samples
cd ../dxsamples-%{samplesversion}
%patch20
%patch21
%patch22

%build
%{?suse_update_config:%{suse_update_config -f}}
autoreconf -fi
%if "%(pkg-config --variable=prefix xft)" == "/usr"
CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fsigned-char" \
CXXFLAGS="$RPM_OPT_FLAGS -fno-exceptions -fno-strict-aliasing -fsigned-char" \
./configure --prefix=/opt --mandir=%{_mandir} --x-includes=/usr/include  --x-libraries=%{_libdir} 
%else
CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fsigned-char" \
CXXFLAGS="$RPM_OPT_FLAGS -fno-exceptions -fno-strict-aliasing -fsigned-char" \
./configure --prefix=/opt --mandir=%{_mandir}
%endif
# parallel build fails
make -j1
#
# dx-samples
cd ../dxsamples-%{samplesversion}
autoreconf -fi
CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" \
./configure --prefix=/opt 
# parallel build fails
make -j1

%install
make DESTDIR=$RPM_BUILD_ROOT \
     prefix=/opt \
     install 
#
# dx samples
cd $RPM_BUILD_DIR/dxsamples-%{samplesversion}
make DESTDIR=$RPM_BUILD_ROOT \
     prefix=/opt \
     install 
#
install -d $RPM_BUILD_ROOT/usr/bin
ln -sf /opt/dx/bin/dx $RPM_BUILD_ROOT/usr/bin/dx
rm -f $RPM_BUILD_ROOT/opt/bin/dx
%suse_update_desktop_file -i dx Education Science Math
%fdupes -s $RPM_BUILD_ROOT

%files
%defattr(-,root,root,755)
%doc AUTHORS COPYING ChangeLog LICENSE NEWS README*
%doc /usr/share/man/man1/dx.1.gz
/usr/bin/dx
/usr/share/applications/dx.desktop
/opt/dx/bin/
/opt/dx/bin_linux/
/opt/dx/fonts/
/opt/dx/help/
/opt/dx/java/
/opt/dx/lib/
/opt/dx/lib_linux/
# .la files go into devel
%exclude /opt/dx/lib_linux/*.la
# header files goes into devel
%exclude /opt/dx/include
# .la files go into devel
%exclude /opt/dx/lib_linux
# source code goes into devel
%exclude /opt/dx/lib/outboard.c
/opt/dx/man/
/opt/dx/ui/
%dir /opt/dx/

%files doc
%defattr(-,root,root,755)
/opt/dx/doc/
/opt/dx/html/

%files data
%defattr(-,root,root,755)
/opt/dx/samples/
# Removing these precompiled executables which will cause a requirement on historic libc.so.1
# so they will not work anyway
%exclude /opt/dx/samples/data/externalfilter_*
%exclude /opt/dx/samples/data/externalfilter
# source code files goes into devel
%exclude /opt/dx/samples/*/*.c
%exclude /opt/dx/samples/*/*/*.c
%exclude /opt/dx/samples/*/*/*.h
%exclude /opt/dx/samples/*/*/*/*.c
# useless file
%exclude /opt/dx/samples/user/Makefile_os2
%exclude /opt/dx/samples/outboard/Makefile_os2

%files devel
%defattr(-,root,root,755)
/opt/dx/include
/opt/dx/lib_linux
/opt/dx/lib/outboard.c
/opt/dx/samples/*/*.c
/opt/dx/samples/*/*/*.c
/opt/dx/samples/*/*/*.h
/opt/dx/samples/*/*/*/*.c

%changelog
openSUSE Build Service is sponsored by