File mingw64-oce.spec of Package mingw64-oce

#
# spec file for package mingw64-oce
#
# Copyright (c) 2018 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/
#


# Whether clang should be used instead of gcc
%bcond_with scanbuild
%if %{with scanbuild}
%bcond_without clang
%else
%bcond_with clang
%endif

# Whether DRAWEXE should be built
%bcond_with build_draw

%define _with_java 0

# disable vtk atm, oce code needs some older version
%if 0%{?suse_version} > 91310
%bcond_without build_vtk
%else
%bcond_with build_vtk
%endif

# Define openCASCADE version
%define ocversion 6.9.1

%define _name   oce
Name:           mingw64-%{_name}
Version:        0.18.3
Release:        0
Summary:        OpenCASCADE Community Edition
License:        LGPL-2.1-only WITH OCCT-exception-1.0
Group:          Productivity/Graphics/CAD

Url:            https://github.com/tpaviot/oce
Source0:        oce-%{version}.tar.xz

BuildRequires:  mingw64-cross-cmake
BuildRequires:  mingw64-filesystem
%if %{with clang}
BuildRequires:  mingw64-libstdc++-devel
BuildRequires:  mingw64-llvm-clang
%else
BuildRequires:  mingw64-cross-gcc-c++
%endif
BuildRequires:  mingw64-cross-pkg-config
BuildRequires:  mingw64-freetype-devel
BuildRequires:  mingw64-freeglut-devel
BuildRequires:  mingw64-gl2ps-devel
BuildRequires:  mingw64-python
%if %{with build_draw}
BuildRequires:  mingw64-tcl-devel
BuildRequires:  mingw64-tk-devel
%endif
BuildRequires:  xz
%if %{with build_vtk}
BuildRequires:  mingw64-vtk-devel
%ifarch x86_64

%else
%if 0%{?_with_java}
%if 0%{?suse_version} > 1310
BuildRequires:  -libjawt.so
%else
BuildRequires:  -libjawt.so()
%endif
BuildRequires:  -libjawt.so(SUNWprivate_1.1)
%endif
%endif
BuildRequires:  mingw64-java-devel
%endif
Provides:       mingw64-OCE = %{version}
Provides:       mingw64-OpenCASCADE = %{ocversion}
Obsoletes:      mingw64-OCE < %{version}
Obsoletes:      mingw64-OpenCASCADE < %{ocversion}
Conflicts:      mingw64-otherproviders(OpenCASCADE)
%_mingw64_package_header_debug
BuildArch:      noarch

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

%package vtk
Summary:        VTK libraries
Group:          System/Libraries

%description vtk
This package includes OpenCASCADE VTK libraries.

%package DRAWEXE
Summary:        Scripting interface to the OpenCASCADE libraries
Group:          Productivity/Graphics/Visualization/Other

%description DRAWEXE
This program provides a kind of scripting interface to the OpenCASCADE
libraries. You can perform a simple test by starting it and entering at the
command line: "pload ALL" then "source /usr/share/oce/src/DrawResources/VisualizationDemo.tcl".

%package devel
Summary:        Development files for openCASCADE
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}
%if %{with build_vtk}
Requires:       %{name}-vtk = %{version}
%endif
Provides:       mingw64-OCE-devel = %{version}
Provides:       mingw64-OpenCASCADE-devel = %{ocversion}
Obsoletes:      mingw64-OCE-devel < %{version}
Obsoletes:      mingw64-OpenCASCADE-devel < %{ocversion}
Conflicts:      mingw64-otherproviders(OpenCASCADE-devel)

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

%_mingw64_debug_package

%prep
%setup -q -n %{_name}-%{version}

%build
  CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" \
  CXXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" \
%if %{with clang}
%if %{with scanbuild}
  CC=/usr/share/clang/scan-build/ccc-analyzer CXX=/usr/share/clang/scan-build/c++-analyzer CCC_CXX=clang++ \
%else
  CC=clang CXX=clang++ \
%endif
%endif
  %_mingw64_cmake \
    -DOCE_USE_BUNDLE=OFF \
    -DOCE_USE_PCH=OFF \
    -DOCE_BUILD_SHARED_LIB=ON \
    -DOCE_DISABLE_X11=OFF \
    -DOCE_MODEL=ON \
    -DOCE_OCAF=ON \
    -DOCE_DATAEXCHANGE=ON \
%if %{with build_vtk}
    -DOCE_WITH_VTK=ON \
%else
    -DOCE_WITH_VTK=OFF \
%endif
%if %{with build_draw}
    -DOCE_DRAW=ON \
%else
    -DOCE_DRAW=OFF \
%endif
    -DOCE_VISUALISATION=ON -DOCE_DISABLE_TKSERVICE_FONT=OFF \
    -DOCE_WITH_GL2PS=ON \
    -DOCE_WITH_FREEIMAGE=OFF \
    -DOCE_EXTRA_WARNINGS=OFF \
    -DOCE_TESTING=OFF \
    -DOCE_ADD_HEADERS=OFF \
    -DOCE_RPATH_FILTER_SYSTEM_PATHS=ON \
    -DOCE_ENABLE_DEB_FLAG=ON \
    -DOCE_COVERAGE=OFF \
    -DOCE_MULTITHREAD_LIBRARY=OPENMP -DOCE_TBB_MALLOC_SUPPORT=OFF \
    -DOCE_INSTALL_PREFIX=%_mingw64_prefix \
    -DOCE_INSTALL_BIN_DIR=%_mingw64_bindir \
    -DOCE_INSTALL_LIB_DIR=%_mingw64_libdir \
    -DOCE_INSTALL_PACKAGE_LIB_DIR=%_mingw64_libdir \
    -DOCE_INSTALL_INCLUDE_DIR=%_mingw64_includedir/oce \
    -DOCE_INSTALL_DATA_DIR=%_mingw64_datadir/oce \
    -DOCE_INSTALL_CMAKE_DATA_DIR=%_mingw64_datadir/oce \

%if %{with scanbuild}
  /usr/share/clang/scan-build/scan-build --use-analyzer %_bindir/clang -analyze-headers \
%endif
  %_mingw64_cmake_build

%install
%_mingw64_cmake_install

rm %{buildroot}%{_mingw64_libdir}/env.bat
rm %{buildroot}%{_mingw64_libdir}/msvc.bat
# TODO do not let cmake install them
rm %{buildroot}%{_mingw64_libdir}/libfreetype.dll.a
if test -f %{buildroot}%{_mingw64_bindir}/libgl2ps.dll; then
  rm %{buildroot}%{_mingw64_bindir}/libgl2ps.dll
fi

%files
%defattr(-,root,root,-)
%_mingw64_bindir/libFW*.dll
%_mingw64_bindir/libPT*.dll
%_mingw64_bindir/libTK*.dll
%if %{with build_vtk}
%exclude %_mingw64_bindir/*Vtk*.dll
%endif
%_mingw64_datadir/oce
%exclude %_mingw64_datadir/oce/*.cmake
%if %{with build_draw}
%exclude %_mingw64_datadir/oce/src/DrawResources

%files DRAWEXE
%defattr(-,root,root,-)
%_mingw64_bindir/DRAWEXE.exe
%_mingw64_datadir/oce/src/DrawResources
%endif

%if %{with build_vtk}
%files vtk
%defattr(-,root,root,-)
%_mingw64_bindir/*Vtk*.dll
%endif

%files devel
%defattr(-,root,root,-)
%doc NEWS.md
%_mingw64_datadir/oce/*.cmake
%_mingw64_includedir/oce
%_mingw64_libdir/*.dll.a

%changelog
openSUSE Build Service is sponsored by