File libquvi-scripts.spec of Package libquvi-scripts

#
# spec file for package libquvi-scripts
#
# Copyright (c) 2014 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/
#


Name:           libquvi-scripts
Version:        0.9.20131130
Release:        0
Summary:        Lua scripts used by libquvi
License:        LGPL-2.1+
Group:          Productivity/Multimedia/Other
Url:            http://quvi.sourceforge.net/
Source:         http://downloads.sourceforge.net/project/quvi/0.9/libquvi-scripts/libquvi-scripts-%{version}.tar.xz
%if 0%{?suse_version} > 1210
# libquvi is not yet compatible with lua 5.2, see http://sourceforge.net/apps/trac/quvi/ticket/89
BuildRequires:  lua51-devel
%else
BuildRequires:  lua-devel >= 5.1
%endif
# For pkgconfig() Provides
BuildRequires:  pkg-config
Requires:       luasocket
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
libquvi-scripts contains the embedded lua scripts that libquvi uses for
parsing the media details. Some additional utility scripts are also
included.

%package devel
Summary:        Lua scripts used by libquvi -- Development Files
Group:          Development/Libraries/Other
Requires:       %{name} = %{version}

%description devel
libquvi-scripts contains the embedded lua scripts that libquvi uses for
parsing the media details. Some additional utility scripts are also
included.

%package nsfw
Summary:        Not Safe For Work Lua scripts used by libquvi
Group:          Productivity/Multimedia/Other
Requires:       %{name} = %{version}

%description nsfw
Website fetching scripts used by %{name} that are marked as "NSFW"
(Not Safe For Work).

%prep
%setup -q

%build
%configure \
    --with-nsfw

make %{?_smp_mflags}

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

EXCL="$PWD/exclude.lst"
NSFW="$PWD/nsfw.lst"
echo -n >"$EXCL"
echo -n >"$NSFW"
perl -n -e 'print $1,"\n" if /^if WITH_NSFW/ .. /endif/ and m,\b(lua/website/.+\.lua),' share/Makefile.am | while read f; do
    echo "%exclude %{_datadir}/libquvi-scripts/$f" >>"$EXCL"
    echo "%{_datadir}/libquvi-scripts/$f" >>"$NSFW"
done

%files -f exclude.lst
%defattr(-,root,root)
%doc AUTHORS ChangeLog COPYING NEWS README
%{_datadir}/libquvi-scripts/
%{_mandir}/man7/libquvi-scripts.7%{?ext_man}
%{_mandir}/man7/quvi-modules-3rdparty.7%{?ext_man}
%{_mandir}/man7/quvi-modules.7%{?ext_man}

%files nsfw -f nsfw.lst
%defattr(-,root,root)
%dir %{_datadir}/libquvi-scripts/

%files devel
%defattr(-,root,root)
%{_libdir}/pkgconfig/libquvi-scripts-0.9.pc

%changelog