File libt3widget.spec of Package libt3widget

#
# spec file for package libt3widget
#
# Copyright (c) 2010 SUSE LINUX Products 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/
#
%define debug_package %{nil}

# norootforbuild
%define    _use_internal_dependency_generator 0
# Use global to ensure that the expansion is done now, and not lazily which
# would result in a recursive definition.
%global    my_find_requires %__find_requires
%define    __find_requires sh -c "egrep -v '\\.mod$' | %{my_find_requires}"

Name:           libt3widget
Version:        1.0.6
Release:        1
Summary:        A C++ terminal dialog toolkit
Group:          Development/Libraries/C and C++
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

License:        GPLv3
URL:            http://os.ghalkes.nl/t3/libt3widget.html
Source0:        http://os.ghalkes.nl/dist/libt3widget-1.0.6.tar.bz2

BuildRequires:  gcc-c++, libtool, gettext, libtranscript-devel >= 0.2.2
BuildRequires:  libunistring-devel, libt3key-devel >= 0.2.0, libt3window-devel >= 0.3.1
%if 0%{?sles_version}
BuildRequires:  gpm
%else
BuildRequires:  gpm-devel
%endif
%if 0%{?suse_version}
%if %{?suse_version} >= 1320
BuildRequires:  pkg-config, pcre2-devel
%else
BuildRequires:  pkg-config, pcre-devel
%endif
BuildRequires: xorg-x11-libX11-devel
%endif
%if 0%{?mdkversion}
BuildRequires:  pkgconfig, libpcre2-devel, libx11-devel
%endif
%if 0%{?fedora}%{?rhel_version}%{?centos_version}%{?rhel}
BuildRequires:  pkgconfig, pcre2-devel, libX11-devel
%endif

# Avoid including libX11 or libxcb in the dependencies. They are not necessary
# for the correct operation of the library, but merely provide extra
# functionality when running under X11.

%description
The libt3widget library provides a C++ dialog toolkit. It provides objects for
dialogs and widgets like buttons, text fields, check boxes etc., to facilitate
easy construction of dialog based programs for Un*x terminals.

%package -n %{name}2
Summary:        A C++ terminal dialog toolkit
Group:          Development/Libraries/C and C++

%description -n %{name}2
The libt3widget library provides a C++ dialog toolkit. It provides objects for
dialogs and widgets like buttons, text fields, check boxes etc., to facilitate
easy construction of dialog based programs for Un*x terminals.


%package        devel
Group:          Development/Libraries/C and C++
Summary:        Development files for %{name}
Requires:       %{name}2 = %{version}-%{release}, libt3window-devel >= 0.3.1
Requires:       libtranscript-devel >= 0.2.2, libunistring-devel, libt3key-devel >= 0.2.0, libt3window-devel >= 0.3.1
%if 0%{?suse_version}
%if %{?suse_version} >= 1320
Requires:       pcre2-devel
%else
Requires:       pcre-devel
%endif
%endif
%if 0%{?mdkversion}
Requires:       libpcre2-devel
%endif
%if 0%{?fedora}%{?rhel_version}%{?centos_version}%{?rhel}
Requires:       pcre2-devel
%endif


%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.


%prep
%setup -q


%build
%if 0%{?fedora} < 23
./configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{name}2 --dump-log
%else
CXXFLAGS='-O2 -std=c++11' ./configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{name}2 --dump-log
%endif

make %{?_smp_mflags}


%install
make install DESTDIR=%{buildroot}
find %{buildroot} '(' -name '*.la' -o -name '*.a' ')' -exec rm -f {} ';'
install -d %{buildroot}/%{_docdir}/%{name}-dev
cp %{buildroot}/%{_docdir}/%{name}2/COPYING %{buildroot}/%{_docdir}/%{name}-dev/
%if 0%{?fedora}%{?rhel_version}%{?centos_version}%{?rhel}
find %{buildroot}/%{_libdir} -type f -name '*.so.*' | xargs chmod +x
chmod +x %{buildroot}/%{_libdir}/libt3widget/libt3widget2-x11.mod
%endif

%clean
rm -rf %{buildroot}


%post -n %{name}2 -p /sbin/ldconfig

%postun -n %{name}2 -p /sbin/ldconfig


%files -n %{name}2
%defattr(-, root, root, -)
%{_libdir}/*.so.*
%{_libdir}/libt3widget
%{_libdir}/libt3widget/*.mod
%docdir %{_docdir}/%{name}2
%{_docdir}/%{name}2

%files devel
%defattr(-, root, root, -)
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/%{name}.pc
%docdir %{_docdir}/%{name}-dev
%{_docdir}/%{name}-dev