File occt.spec of Package occt

#
# spec file for package occt
#
# Copyright (c) 2017 SUSE LINUX 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:           occt
Version:        7.2.0
%define soname 7
Release:        0
Summary:        OpenCASCADE Official Edition
License:        LGPL-2.1 WITH OCCT-exception-1.0
Group:          Productivity/Graphics/CAD
Url:            http://www.opencascade.org/
# Password protected URL, factory validation will fail
# https://www.opencascade.com/sites/default/files/private/occt/OCC_%{version}_release/opencascade-%{version}.tgz
Source0:        opencascade-%{version}.tgz
Patch1:         fix_build.patch
Provides:       OpenCASCADE = %{version}
BuildRequires:  bison
BuildRequires:  cmake
BuildRequires:  doxygen
BuildRequires:  fdupes
BuildRequires:  flex
BuildRequires:  gcc-c++
BuildRequires:  tcl-devel
BuildRequires:  tk-devel
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(glu)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xext)
BuildRequires:  pkgconfig(xi)
BuildRequires:  pkgconfig(xmu)
BuildRequires:  pkgconfig(xt)
#Requires:       tcsh

%description
OpenCASCADE is a suite for 3D surface and solid modeling, visualization, data
exchange and rapid application development. It is an excellent platform for
development of numerical simulation software including CAD/CAM/CAE, AEC and
GIS, as well as PDM applications.

%package devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Provides:       OpenCASCADE-devel = %{version}
Requires:       %{name} = %{version}
Requires:       %{name}-DRAWEXE = %{version}
Requires:       libopencascade%{soname} = %{version}
Requires:       freetype2-devel
Requires:       tcl-devel
Requires:       tk-devel
Requires:       pkgconfig(gl)
Requires:       pkgconfig(glu)
Requires:       pkgconfig(x11)
Requires:       pkgconfig(xext)
Requires:       pkgconfig(xmu)
Requires:       pkgconfig(xt)
Conflicts:      oce-devel

%description devel
This package contains the files needed for development with OpenCASCADE.

%package -n libopencascade%{soname}
Summary:        OpenCASCADE libraries
Group:          Development/Libraries/C and C++

%description -n libopencascade%{soname}
This package contain the needed libraries for OpenCASCADE

%package DRAWEXE
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Conflicts:      oce-DRAWEXE

%description DRAWEXE
This package contains the DRAWEXE executable of OpenCASCADE.

%prep
%setup -q -n opencascade-%{version}
%patch1 -p0

%build
mkdir build && cd build
cmake -DCMAKE_C_FLAGS:"STRING=$RPM_OPT_FLAGS" \
  -DCMAKE_CXX_FLAGS:"STRING=$RPM_OPT_FLAGS" \
  -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_SKIP_RPATH=ON \
  -DCMAKE_INSTALL_PREFIX=%{_prefix} \
%if "%{_libdir}" == "/usr/lib64"
  -DLIB_SUFFIX=64 \
%endif
  ..
make %{?_smp_mflags}

cd ..
./gendoc -refman
# fix permission bits
find doc README.txt LICENSE_LGPL_21.txt OCCT_LGPL_EXCEPTION.txt -type f | xargs chmod 0644

%install
cd build
make install DESTDIR=%buildroot

chmod 0755 %buildroot/usr/bin/*

if [ "%_libdir" == "/usr/lib64" ] ;then
  mkdir -p %buildroot/usr/lib64
  mv %buildroot/usr/lib/lib* %buildroot/usr/lib64/
fi

rm -rf %buildroot/usr/share/doc

%fdupes -s %{buildroot}

%post -n libopencascade%{soname} -p /sbin/ldconfig

%postun -n libopencascade%{soname} -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc LICENSE_LGPL_21.txt README.txt OCCT_LGPL_EXCEPTION.txt

%files -n libopencascade%{soname}
%defattr(-,root,root,-)
%_libdir/lib*.so.%{soname}*

%files DRAWEXE
%defattr(-,root,root,-)
/usr/bin/DRAWEXE*

%files devel
%defattr(-,root,root,-)
%doc doc/refman/html
/usr/bin/custom*
/usr/bin/draw.sh
/usr/bin/env.sh
/usr/include/opencascade
/usr/share/opencascade
/usr/lib/cmake
%_libdir/lib*.so

%changelog
openSUSE Build Service is sponsored by