File pointcloud.spec of Package pointcloud

#
# spec file for package pointcloud
#
# Copyright (c) 2021 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#

%define         pgname @BUILD_FLAVOR@
%define         sname pointcloud
%define         pg_bindir %(pg_config --bindir)
%define         pg_libdir %(pg_config --pkglibdir)
%define         pg_share %(pg_config --sharedir)
%if 0%{?is_opensuse} && 0%{?suse_version} >= 1500 && ("%{pgname}" == "postgresql11" || "%{pgname}" == "postgresql12" || "%{pgname}" == "postgresql13")
%bcond_without  llvm
%else
%bcond_with     llvm
%endif
# double \ as they are escaped in %%() call
%define pg_version %(pg_config --version | sed -e 's/.*[[:space:]]//' -e 's/\\.[0-9]*$//' -e 's/\\.//')
%if "%{pgname}" == "" || "%{pgname}" == "postgresql"
Name:           %{sname}
ExclusiveArch:  do_not_build
%else
Name:           %{pgname}-%{sname}
%endif
# Build for Leap 15.2 but not for postgresql13
%if (0%{?is_opensuse} && 0%{?sle_version} == 150200) && ("%{pgname}" == "postgresql13")
ExclusiveArch:  do_not_build
%endif
# Build for Leap 15.2 but not for 15.1
%if (0%{?is_opensuse} && 0%{?sle_version} == 150100) && ("%{pgname}" == "postgresql11" || "%{pgname}" == "postgresql12" || "%{pgname}" == "postgresql13")
ExclusiveArch:  do_not_build
%endif
%if 0%{?suse_version} < 1315
ExclusiveArch:  do_not_build
%endif
Version:        1.2.1
Release:        0
Summary:        A PostgreSQL extension for storing point cloud (LIDAR) data
License:        BSD-2-Clause
Group:          Productivity/Databases/Servers
URL:            https://github.com/pgpointcloud/pointcloud/
Source:         https://github.com/pgpointcloud/pointcloud/archive/v%{version}.tar.gz
# UPSTREAM Patches
# CXXFLAGS
Patch0:         https://github.com/pgpointcloud/pointcloud/commit/e71401a28.patch
# PG ignore minor on pg>=10
Patch1:         https://github.com/pgpointcloud/pointcloud/commit/7cca13ce1.patch
# GCC 10.1
Patch2:         https://github.com/pgpointcloud/pointcloud/commit/270f3e112.patch
BuildRequires:  %{pgname}-devel
%if "%{pgname}" == "postgresql11" || "%{pgname}" == "postgresql12" || "%{pgname}" == "postgresql13"
BuildRequires:  %{pgname}-server-devel
%endif
%if %{with llvm}
BuildRequires:  clang-devel
BuildRequires:  llvm-devel
BuildRequires:  %{pgname}-llvmjit
%endif
BuildRequires:  %{pgname}-server
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  cunit-devel
BuildRequires:  fdupes
BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  laszip-devel
BuildRequires:  libght-devel
BuildRequires:  libxml2-devel
BuildRequires:  pkgconfig
%requires_eq    %{pgname}-server
Provides:       %{sname}

%description
pointcloud is an extension for storing point cloud data (LIDAR) into postgresql
Activate the pointcloud extension: CREATE EXTENSION pointcloud

The pointcloud_postgis extension adds functions that allow you to use PostgreSQL
Pointcloud with PostGIS, converting PcPoint and PcPatch to Geometry and doing
spatial filtering on point cloud data. The pointcloud_postgis extension depends
on both the postgis and pointcloud extensions, so they must be installed first:

  CREATE EXTENSION postgis;
  CREATE EXTENSION pointcloud;
  CREATE EXTENSION pointcloud_postgis;

See https://github.com/pgpointcloud/pointcloud for example and howtos.

%if %{with llvm}
%package llvmjit
Summary:        Just-in-time compilation support for PostgreSQL %{sname} extension
Group:          Productivity/Databases/Servers
Requires:       %{pgname}-%{sname} = %{version}-%{release}
Requires:       %{pgname}-llvmjit
Requires:       %{pgname}-server
Supplements:    packageand(%{pgname}-llvmjit:%{name})

%description llvmjit
This package contains support for just-in-time compiling parts of
PostgreSQL queries. Using LLVM it compiles e.g. expressions and tuple
deforming into native code, with the goal of accelerating analytics
queries.
%endif

%prep
%setup -q -n %{sname}-%{version}
%autopatch -p1

%build
autoreconf -fiv
%configure --without-lazperf
echo "Configure done ... building"
make VERBOSE=1 %{?_smp_mflags}

%install
%make_install

%fdupes -s %{pg_share}/extension
%fdupes -s %{pg_share}/contrib

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%license COPYRIGHT
%doc NEWS README.md
%{pg_libdir}/*
%exclude %{pg_libdir}/bitcode/*
%{pg_share}/extension/pointcloud*

%if %{with llvm}
%files llvmjit
%{pg_libdir}/bitcode/*
%endif

%changelog
openSUSE Build Service is sponsored by