File ola.spec of Package ola

#
# spec file for package ola
#
# Copyright (c) 2022 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/
#


%bcond_without python
%bcond_without tcmalloc
%bcond_with java
Name:           ola
Version:        0.10.9
Release:        0
Summary:        Open Lighting Architecture (OLA)
License:        GPL-2.0-only
Group:          Productivity/Other
URL:            https://www.openlighting.org/ola/
Source0:        https://github.com/OpenLightingProject/ola/releases/download/%{version}/ola-%{version}.tar.gz
Source1:        baselibs.conf
Patch1:         ola-remove_defines.patch
Patch2:         ola-Fix-protoc-version-checking-since-v20-x.patch
BuildRequires:  automake >= 1.11.2
BuildRequires:  bison
BuildRequires:  fdupes
BuildRequires:  flex
BuildRequires:  gcc-c++
BuildRequires:  libtool
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(avahi-core)
BuildRequires:  pkgconfig(cppunit)
BuildRequires:  pkgconfig(dbus-1)
BuildRequires:  pkgconfig(libftdi1)
BuildRequires:  pkgconfig(libmicrohttpd)
BuildRequires:  pkgconfig(libusb)
BuildRequires:  pkgconfig(ncurses)
BuildRequires:  pkgconfig(protobuf)
BuildRequires:  pkgconfig(uuid)
%if 0%{?suse_version} > 1600
BuildRequires:  protobuf21-devel
%else
BuildRequires:  protobuf-devel
%endif
%if %{with java}
BuildRequires:  java-devel
BuildRequires:  maven
BuildRequires:  protobuf-java
%endif
%if %{with python}
BuildRequires:  python3-devel
BuildRequires:  python3-protobuf
%endif
%if %{with tcmalloc}
BuildRequires:  pkgconfig(libtcmalloc)
%endif

%description
The Open Lighting Architecture (OLA) consists of two parts, the daemon olad and the library, libola.

%package -n libola0
Summary:        More Open Lighting Architecture (OLA) shared libraries
License:        LGPL-2.1-only
Group:          Productivity/Other

%description -n libola0
Additional OLA libraries, required for third-party applications

%package -n libola1
Summary:        Open Lighting Architecture (OLA) shared libraries
License:        LGPL-2.1-only
Group:          Productivity/Other

%description -n libola1
The OLA libraries, required for third-party applications

%package -n libola-devel
Summary:        Open Lighting Architecture (OLA) development headers
License:        LGPL-2.1-only
Group:          Development/Libraries/Other
Requires:       libmicrohttpd-devel
Requires:       libola1 = %{version}
Requires:       libuuid-devel
Requires:       protobuf21-devel
Requires:       zlib-devel

%description -n libola-devel
The OLA library headers, required to use the OLA library
in third-party applications

%if %{with python}
%package -n python3-ola
Summary:        Python bindings for Open Lighting Architecture (OLA)
License:        LGPL-2.1-only
Group:          Development/Languages/Python
Requires:       python3-protobuf
BuildArch:      noarch

%description -n python3-ola
Python bindings for Open Lighting Architecture (OLA).
Used in third-party applications written in  python.
%endif

%prep
%setup -q
%autopatch -p1

%build
autoreconf -i
%configure --disable-static \
%if %{with python}
    --enable-python-libs \
%endif
%if %{with java}
    --enable-java-libs \
%endif
%if %{with tcmalloc}
    --enable-tcmalloc \
%endif
    --disable-examples
%make_build

%install
%make_install
find %{buildroot} -type f -name "*.la" -delete -print
%fdupes %{buildroot}

%post -n libola0 -p /sbin/ldconfig
%postun -n libola0 -p /sbin/ldconfig

%post -n libola1 -p /sbin/ldconfig
%postun -n libola1 -p /sbin/ldconfig

%files
%license COPYING
%doc AUTHORS ChangeLog README NEWS TODO
%{_bindir}/olad
%{_bindir}/ola_*
%{_bindir}/rdmpro_sniffer
%{_bindir}/usbpro_firmware
%{_datadir}/ola/
%{_datadir}/olad/
%{_mandir}/man1/*

%files -n libola0
%{_libdir}/libola*.so.0*

%files -n libola1
%{_libdir}/libola.so.1*

%files -n libola-devel
%{_includedir}/ola/
%{_includedir}/olad/
%{_libdir}/libola*.so
%{_libdir}/pkgconfig/libola*.pc

%if %{with python}
%files -n python3-ola
%{python3_sitelib}/*
%endif

%changelog
openSUSE Build Service is sponsored by