A new user interface for you! Read more...

File sfcgal.spec of Package sfcgal

#
# spec file for package sfcgal
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2017 Ioda-Net Sàrl, Charmoille, Switzerland. Bruno Friedmann (tigerfoot)
#
# 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/
#


%define source_name SFCGAL
%define _libname    libSFCGAL1
%define _soversion  1
Name:           sfcgal
# /SECTION on October 2017 this is forced by upstream
# 1.3.1 build correctly with cgal 4.7 on Leap but not with cgal 4.11 on TW
# Upstream have made patches and release 1.3.2 for cgal > 4.11
# upstream issue#147
%if 0%{?suse_version} > 1325
Version:        1.3.2
%else
Version:        1.3.1
%endif
Release:        0
Summary:        C++ wrapper library around CGAL
License:        GPL-2.0+
Group:          Productivity/Graphics/CAD
Url:            http://www.sfcgal.org/
Source0:        https://github.com/Oslandia/SFCGAL/archive/v%{version}.tar.gz
Source1:        %{name}-rpmlintrc
#Upstream [PATCH] Fix build when CGAL is compiled with GMPXX
Patch0:         https://github.com/Oslandia/SFCGAL/commit/5c495ce.patch
%if 0%{?suse_version} > 1325
BuildRequires:  Mesa-libGL-devel
BuildRequires:  libboost_atomic-devel
BuildRequires:  libboost_chrono-devel
BuildRequires:  libboost_date_time-devel
BuildRequires:  libboost_filesystem-devel
BuildRequires:  libboost_headers-devel
BuildRequires:  libboost_program_options-devel
BuildRequires:  libboost_regex-devel
BuildRequires:  libboost_serialization-devel
BuildRequires:  libboost_system-devel
BuildRequires:  libboost_timer-devel
BuildRequires:  libboost_thread-devel
%else
BuildRequires:  boost-devel
%endif
BuildRequires:  cmake
BuildRequires:  cunit-devel
BuildRequires:  doxygen
BuildRequires:  fdupes
#BuildRequires:  gcc-c++
#On upstream proposal and tests using clang minimize the memory %% usage
BuildRequires:  llvm-clang
BuildRequires:  libstdc++-devel
BuildRequires:  gmp-devel
BuildRequires:  lapack-devel
%ifarch i586 x86_64
BuildRequires:  libOpenSceneGraph-devel
%define withosgd 1
%else
# openscenegraph not available for
# s390x ppc64le ppc64 aarch64 armv7l
#dummy 
%define withosgd 0
%endif
BuildRequires:  libcgal-devel
BuildRequires:  mpfr-devel
BuildRequires:  pkg-config
BuildRequires:  postgresql-devel >= 9.1
BuildRequires:  xz
BuildRequires:  zlib-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build


%description
This package contains tools & sample data to test %{_libname}.

%package -n %{_libname}
Summary:        Libraries SFCGAL applications
Group:          Development/Libraries/C and C++
Provides:       libsfcgal%{_soversion}

%description -n %{_libname}
This library  support ISO 19107:2013, OGC Simple Features Access 1.2 for 3D operations.
It provides standard compliant geometry types and operations, that can
be accessed from its C or C++ APIs. PostGIS uses the C API, to expose some
SFCGAL's functions in spatial databases (cf. PostGIS manual).

Geometry coordinates have an exact rational number representation and can
be either 2D or 3D. Among supported geometry types are :

 Points
 LineStrings
 Polygons
 TriangulatedSurfaces
 PolyhedralSurfaces
 GeometryCollections
 Solids

Supported operations include :

 WKT reading and writing with exact rational number representation for coordinates
 Intersection operations and predicates
 Convex hull computation
 Tessellation
 Extrusion
 Area and distance computation
 Minkovski sums
 Contour offsets
 Straight skeleton generations

%package devel
Summary:        Development files and tools for SFCGAL applications
Group:          Development/Libraries/C and C++
Requires:       %{_libname} = %{version}

%description devel
Content headers & files to envelopment files for %{_libname}

%prep
%setup -q -n %{source_name}-%{version}
%patch0 -p1

%build
#clang
export CC=clang
export CXX=clang++
# bypass bug 927268 for PowerPC if clang is used above in place of gcc
tmpflags="%{optflags}"
%ifarch ppc64 ppc64le
tmpflags=${tmpflags/-fstack-protector}
tmpflags=${tmpflags/-strong}
%endif
#Remove -fstack-clash-protection added on 42.3 for unknown reason
tmpflags=${tmpflags/-fstack-clash-protection}

%cmake \
  -DCMAKE_USER_MAKE_RULES_OVERRIDE=OFF \
  -DCMAKE_C_FLAGS="${tmpflags} -Doverride=" \
  -DCMAKE_CXX_FLAGS="${tmpflags} -Doverride=" \
  -DCMAKE_CXX_FLAGS_RELEASE="${tmpflags} -Doverride=" \
  -DCMAKE_CXX_COMPILER="%{_bindir}/clang++" \
  -DCMAKE_C_COMPILER="%{_bindir}/clang" \
  -DCMAKE_NO_BUILTIN_CHRPATH=ON \
  -DCMAKE_BUILD_TYPE="Release" \
  -DCMAKE_GMP_ENABLE_CXX=ON \
  -DSFCGAL_CHECK_VALIDITY=TRUE \
%if %{withosgd}
  -DSFCGAL_WITH_OSG=ON \
%else
  -DSFCGAL_WITH_OSG=OFF \
%endif
  -DSFCGAL_BUILD_VIEWER=OFF \
  -DPOSTGRESQL_INCLUDE_DIR=`%{_bindir}/pg_config --includedir` \
  -DPOSTGRESQL_LIBRARIES=`%{_bindir}/pg_config --libdir` \
  -DSFCGAL_BUILD_EXAMPLES=ON

make %{?_smp_mflags}

%install
%cmake_install
#No .la lib
find %{buildroot} -type f -name "*.la" -delete -print
%fdupes %{buildroot}%{_datadir}

%post -n %{_libname} -p /sbin/ldconfig

%postun -n %{_libname} -p /sbin/ldconfig

%files -n %{_libname}
%defattr(-,root,root)
%doc README.md LICENSE AUTHORS NEWS
%{_libdir}/libSFCGAL.so.%{version}
%{_libdir}/libSFCGAL.so.%{_soversion}
%if %{withosgd}
%{_libdir}/libSFCGAL-osg.so.%{version}
%{_libdir}/libSFCGAL-osg.so.%{_soversion}
%endif

%files
%defattr(-,root,root)
%doc README.md LICENSE AUTHORS NEWS
# We removed deprecated viewer
# We suspend build of example since libboost is bugged on TW
# See https://svn.boost.org/trac/boost/ticket/11880
#%%{_bindir}/viewer-SFCGAL
%{_bindir}/example-CGAL-*
%{_bindir}/example-SFCGAL-*

%files devel
%defattr(-,root,root,-)
%doc README.md LICENSE AUTHORS NEWS
%{_libdir}/libSFCGAL.so
%if %{withosgd} 
%{_libdir}/libSFCGAL-osg.so
%endif

%{_includedir}/SFCGAL
%{_bindir}/sfcgal-config

%changelog