File libght.spec of Package libght

#
# spec file for package libght
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2014 Friedmann Bruno, Ioda-Net Sàrl, Charmoille, Switzerland.
#
# 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 soname 0_1
%define sovers 0.1
%define sofull_version 0.1.1
%define _shlibname	libght%{soname}
Name:           libght
Version:        0.1.0
Release:        0
Summary:        GeoHashTree for Point Cloud Data
License:        BSD-3-Clause
Group:          Productivity/Graphics/CAD
Url:            https://github.com/pramsey/libght
#Source:        https://codeload.github.com/pramsey/%%{name}/tar.gz/v%%{version}
Source:         %{name}-%{version}.tar.gz
# Upstream Patches since last version
Patch1:         0001-Allow-install-dir-over-ride.patch
Patch2:         0002-Clean-build-on-OSX-Mountain-Lion.patch
Patch3:         0003-Up-patch-version.patch
Patch4:         0004-Small-fixes.patch
Patch5:         0005-Recomment-test-noise.patch
Patch6:         0006-Move-some-private-functions-to-public.patch
Patch7:         0007-Fix-build-error.patch
#upstream issue#7
Patch8:         0008-so-version_build-cmake-install.patch
#upstream issue#4
Patch9:         0009-return_random_data_function-non-void.patch
Patch10:        0010-Exclude-eclipse-stuff.patch
#Patch11:        0011-Exclude-eclipse-stuff.patch
Patch12:        0012-Initialize-GhtHash-before-passing-it-for-read-to-ght.patch
Patch13:        0013-Do-not-write-more-bytes-than-allowed-in-ght_node_to_.patch
Patch14:        0014-Initialize-GhtHash-before-passing-it-for-read-to-ght.patch
Patch15:        0015-Ensure-hash-is-null-terminated-in-ght_node_to_nodeli.patch
Patch16:        0016-Enable-travis-build-closes-15.patch

BuildRequires:  boost-devel
BuildRequires:  cmake >= 2.8
BuildRequires:  cunit-devel
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  libproj-devel
BuildRequires:  libxml2-devel
BuildRequires:  pkg-config
BuildRequires:  zlib-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
A file format and library for storing and rapidly accessing point cloud data,
in particular LIDAR data.

%package devel
Summary:        Development files and tools for GeoHashTree for Point Cloud Data applications
Group:          Development/Libraries/C and C++
Requires:       %{_shlibname} = %{version}

%description devel
This package provides the headers files and tools you may need to
develop applications using %{name}.
the GeoHashTree for Point Cloud Data library.

%package -n %{_shlibname}
Summary:        GeoHashTree for Point Cloud Data library
Group:          Productivity/Graphics/CAD

%description -n %{_shlibname}
This package provides the GeoHashTree for Point Cloud Data library

A file format and library for storing and rapidly accessing point cloud data,
in particular LIDAR data.

GeoHashTree organizes points into a tree structure for fast spatial access.
The tree structure itself encodes the significant bits of at each node, so
child nodes can omit them. The result is a smaller file than if all the
points were stored with full precision. Each node includes statistical
information about the children below (e.g. average/median Z value) permitting
fast overview generation. Additional attributes are attached to the tree at
parent nodes, below which all children share the attribute value. This reduces
duplicate data storage further.

The advantage of a GeoHashTree file over a LAS file is fast access and filtering,
since the tree encodes useful information at each node to speed searches over
the full set of points in the file. LASZ zipped files can be smaller, but will
be less efficient at overviews, searching and sub-setting. GHT is a good working
format for applications that will be filtering and querying large sets of LIDAR data.

# TODO: Expose again when las2ght compiles without libLAS.
%if 0
%package -n ght-tools
Summary:        GeoHashTree for Point Cloud Data library tools
Group:          Productivity/Graphics/CAD
Requires:       %{_shlibname} = %{version}

%description -n ght-tools
This package provides the GeoHashTree for Point Cloud Data associated tools
%endif

%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
#%%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1

%build
%cmake \
    -DCMAKE_C_FLAGS_RELEASE="%{optflags} -fno-strict-aliasing -g -DNDEBUG" \
    -DCMAKE_CXX_FLAGS_RELEASE="%{optflags} -fno-strict-aliasing -g -DNDEBUG" \
    -DCMAKE_SKIP_INSTALL_RPATH=ON \
    ..

%make_jobs

%check
# This segfault for the moment on obs
#pushd build
#make VERBOSE=1 test
#popd

%install
%cmake_install

#Cleanup No .a in package
find %{buildroot} -iname libght*.a -exec rm -fv {} \;


%if 0%{?suse_version}
%fdupes %{buildroot}%{_datadir}
%endif

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

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

%files -n %{_shlibname}
%defattr(-,root,root,-)
%doc COPYRIGHT README.rst
# Nope empty file doc/ght_structure.rst
# Due to patch from master
%{_libdir}/%{name}.so.%{sofull_version}
%{_libdir}/%{name}.so.%{sovers}

%files devel
%defattr(-,root,root,-)
%doc CODE.rst
%{_includedir}/ght.h
%{_includedir}/ght_core.h
%{_libdir}/%{name}.so

%if 0
%files -n ght-tools
%defattr(-,root,root,-)
%doc COPYRIGHT
%{_bindir}/las2ght
%endif

%changelog
openSUSE Build Service is sponsored by