# Basic Information
%define pkgname minidlna
%define name    self-build-%{pkgname}
%define version 1.2.1
%define release 3%{?_dist_release}

%define sourceurl0 http://sourceforge.net/projects/%{pkgname}/files/%{pkgname}/%{version}/%{pkgname}-%{version}.tar.gz

Name:           %{name}
Version:        %{version}
Release:        %{release}
# COPYING  などを参照して License を修正してください。
License:        GPLv2+
# /usr/share/doc/rpm-4.11.1/GROUPS_for_vine.txt を参照して Group を修正してください。
Group:          Restricted Software
Source0:        %{pkgname}-vl.spec
BuildRoot:      %{_tmppath}/%{name}-%{version}-root
BuildArch:      noarch

Vendor:         Project Vine
Distribution:   Vine Linux
Packager:       Shirow HIGA, iwaim

Summary:        Package to automatically build %{pkgname} rpm package
Summary(ja):    %{pkgname} の rpm パッケージを自動作成するパッケージ

Obsoletes:      minidlna < %{version}
Obsoletes:      self-build-minidlna < %{version}

# Dependency
# 以下に依存関係を記述してください 。
Requires(post):	self-build-setup >= 0.9.9

Requires(post):	libuuid-devel
Requires(post):	sqlite3-devel
Requires(post):	libvorbis-devel
Requires(post):	flac-devel
Requires(post):	libid3tag-devel
Requires(post):	libjpeg-turbo-devel
Requires(post):	libexif-devel
Requires(post):	gettext-devel

Requires(post):	self-build-ffmpeg
Requires(post):	self-build-ffmpegthumbnailer

#追加のソースファイル
Source1:        minidlna.init.d.script
Source2:        minidlna.icons.c.custom
#Source3:	minidlna_configure_v113.patch
#Source4:	minidlna_make_v116.patch
Source5:	minidlna_video_thumbnail_v121.patch
#Source6:	minidlna_bravia_v116.patch

%description
MiniDLNA (aka ReadyDLNA) is server software with the aim of being fully
compliant with DLNA/UPnP-AV clients.

The minidlna daemon serves media files (music, pictures, and video) to
clients on your network.  Example clients include applications such as
Totem and XBMC, and devices such as portable media players, smartphones,
and televisions.

[Note]
This package requires many other packages to compile
targetsoftware. So it consume more disk space than usual.

Also installation takes logner time because of compilation.
(This will take a few minutes to quarter or half of an hour,
depends on building environment)

[About self-build package]
For some kind of software, distributing of binary package

may viorate the patent or law. Therefore we chose self-build
packge, create binary package on your machine, for such kind
of softwares instead of distributing binary package.

Please obey the national law when you use the created binary
packages. And if you want to use the softwares using patented
thechnology, it may be required to get a permission, make an
agreement or purchas a license. Please consider it with your
purpose or way of use and take appropriate action.

#%description -l ja
#ここに日本語で詳細を記述してください。

%prep
[ "%{version}-%{release}" != $(rpm -q --queryformat "%%{version}-%%{release}\n" --specfile %{SOURCE0} | tail -1) ] && exit 1

%install
%{__rm} -rf ${RPM_BUILD_ROOT}
%{__install} -d ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
%{__install} -m 644 %{SOURCE0} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
%{__install} -m 644 %{SOURCE1} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
%{__install} -m 644 %{SOURCE2} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
#%{__install} -m 644 %{SOURCE3} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
#%{__install} -m 644 %{SOURCE4} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
%{__install} -m 644 %{SOURCE5} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
#%{__install} -m 644 %{SOURCE6} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}

%clean
%{__rm} -rf ${RPM_BUILD_ROOT}

%posttrans
/usr/lib/rpm/self-build-rpm.sh %{name} %{pkgname}-vl.spec %{sourceurl0} 34000

/usr/lib/rpm/pre-allocate-rpm.sh %{pkgname}-%{version}-%{release}

%files
%defattr(-,root,root)
%{_datadir}/%{name}

%changelog
* Sat Jul 28 2018 IWAI, Masaharu <iwaim.sub@gmail.com> 1.2.1-3
- add Packager
- update Requires(post)
- update init.d script (Source1) 

* Tue Apr 24 2018 Shirow HIGA <shirowxxx@gmail.com> 1.2.1-2
- Rebuild with ffmpeg 4.0

* Fri Sep 15 2017 Shirow HIGA <shirowxxx@gmail.com> 1.2.1-1
- new upstream release 1.2.1
- Update Source5 (minidlna_video_thumbnail_v120.patch -> minidlna_video_thumbnail_v121.patch)

* Fri May 26 2017 Shirow HIGA <shirowxxx@gmail.com> 1.2.0-1
- new upstream release 1.2.0
- Update Source5 (minidlna_video_thumbnail_v116.patch -> minidlna_video_thumbnail_v120.patch)

* Sun Jan 22 2017 Shirow HIGA <shirowxxx@gmail.com> 1.1.6-3
- Remove Source3 (minidlna_configure_v113.patch)
- Remove Source4 (minidlna_make_v116.patch)
- Remove Source6 (minidlna_bravia_v116.patch)

* Mon Sep 19 2016 Shirow HIGA <shirowxxx@gmail.com> 1.1.6-2
- add new Source6 (minidlna_bravia_v116.patch)

* Mon Sep 12 2016 Shirow HIGA <shirowxxx@gmail.com> 1.1.6-1
- new upstream release 1.1.6

* Mon Sep 14 2015 Shirow HIGA <shirowxxx@gmail.com> 1.1.5-1
- new upstream release 1.1.5

* Thu Jan 15 2015 Shirow HIGA <shirowxxx@gmail.com> 1.1.4-1
- initial build for Vine Linux
