%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}

Name:           flac
Summary:        FLAC - Free Lossless Audio Codec
Summary(ja):    FLAC - フリーの可逆音声圧縮コーデック
Version:        1.3.3
Release:        1%{?_dist_release}
Group:          Applications/Multimedia
Vendor:         Project Vine
Distribution:   Vine Linux
BuildRoot:      %{_tmppath}/%{name}-%{version}-root

License:        BSD and GPLv2+
URL:            https://xiph.org/flac/
Source:         https://github.com/xiph/flac/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz

BuildRequires:  libogg-devel
BuildRequires:  automake autoconf libtool gettext-devel
%ifarch %ix86
# 2.0 supports symbol visibility
BuildRequires:  nasm >= 2.0
%endif

%description
FLAC stands for Free Lossless Audio Codec. Grossly oversimplified, FLAC is
similar to MP3, but lossless.

The FLAC project consists of:

  * the stream format
  * libFLAC  - reference encoders and decoders in library form
  * flac     - a command-line program to encode and decode FLAC files
  * metaflac - a command-line metadata editor for FLAC files

%description -l ja
FLAC (Free Lossless Audio Codec) はフリーの可逆音声圧縮コーデックです。
MP3 に似ていますが、音質が劣化しません。

FLAC プロジェクトは以下により構成されています。

  * ストリーム形式
  * libFLAC  - リファレンスエンコーダ/デコーダを実装するライブラリ
  * flac     - FLAC ファイルのエンコード/デコードに使用するコマンドライン版
               プログラム。
  * metaflac - FLAC ファイルのコマンドライン版メタデータエディタ

%package devel
Summary:	Development libraries and header files from FLAC
Summary(ja):	FLAC アプリケーション開発用ライブラリ及びヘッダファイル
Group:		Development/Libraries
Requires:	%{name} = %{version}
Requires:	pkgconfig

%description devel
This package contains all the files needed to develop applications that
will use the Free Lossless Audio Codec (FLAC).

%description -l ja devel
このパッケージには FLAC (Free Lossless Audio Codec) を扱うアプリケーションを
開発するために必要なライブラリ及びヘッダファイルが含まれています。

# compat32
%package -n compat32-%{name}
Summary: FLAC - Free Lossless Audio Codec
Summary(ja): FLAC - フリーの可逆音声圧縮コーデック
Group: System Environment/Libraries

%description -n compat32-%{name}
FLAC stands for Free Lossless Audio Codec. Grossly oversimplified, FLAC is
similar to MP3, but lossless.

The FLAC project consists of:

  * the stream format
  * libFLAC  - reference encoders and decoders in library form
  * flac     - a command-line program to encode and decode FLAC files
  * metaflac - a command-line metadata editor for FLAC files

%description -n compat32-%{name} -l ja
FLAC (Free Lossless Audio Codec) はフリーの可逆音声圧縮コーデックです。
MP3 に似ていますが、音質が劣化しません。

FLAC プロジェクトは以下により構成されています。

  * ストリーム形式
  * libFLAC  - リファレンスエンコーダ/デコーダを実装するライブラリ
  * flac     - FLAC ファイルのエンコード/デコードに使用するコマンドライン版
               プログラム。
  * metaflac - FLAC ファイルのコマンドライン版メタデータエディタ

%package -n compat32-%{name}-devel
Summary:	Development libraries and header files from FLAC
Summary(ja):	FLAC アプリケーション開発用ライブラリ及びヘッダファイル
Group:		Development/Libraries
Requires: 	%{name}-devel = %{version}-%{release}
Requires:	compat32-%{name} = %{version}-%{release}
Requires:	compat32-pkgconfig

%description -n compat32-%{name}-devel
This package contains all the files needed to develop applications that
will use the Free Lossless Audio Codec (FLAC).

%description -n compat32-%{name}-devel -l ja
このパッケージには FLAC (Free Lossless Audio Codec) を扱うアプリケーションを
開発するために必要なライブラリ及びヘッダファイルが含まれています。

%prep
%define srcver %{version}%{?extraver:-%extraver}

%setup -q -n %{name}-%{srcver}


%build
./autogen.sh -V

%configure \
    --disable-static \
    --disable-xmms-plugin \
%ifarch ppc
    --disable-asm-optimizations \
%endif
    --disable-thorough-tests

make %{?_smp_mflags}


%install
%__rm -rf %{buildroot}
make install DESTDIR=%{buildroot}

rm -rf ./htmldoc
mv -f %{buildroot}%{_docdir}/flac ./htmldoc

# remove unneeded files
%{_bindir}/find %{buildroot} -name "*.la" -exec %__rm -f "{}" \;


%check
make check

%clean
%__rm -rf %{buildroot}

%post -p %{_syssbindir}/ldconfig
%postun -p %{_syssbindir}/ldconfig

%post -n compat32-%{name} -p /sbin/ldconfig
%postun -n compat32-%{name} -p /sbin/ldconfig


%files
%defattr(-,root,root)
%license COPYING.*
%doc AUTHORS README
%{_bindir}/*
%{_libdir}/*.so.*
%{_mandir}/*/*

%files devel
%defattr(-,root,root)
%license COPYING.*
%doc doc/html
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%{_datadir}/aclocal/*.m4

# compat32
%if %{build_compat32}
%files -n compat32-%{name}
%defattr(-,root,root)
%license COPYING.*
%doc AUTHORS README
%{_libdir}/*.so.*

%files -n compat32-%{name}-devel
%defattr(-,root,root,-)
%{_libdir}/*.so
%endif


%changelog
* Sun Apr 12 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.3.3-1
- new upstream release.

* Thu Feb 22 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.3.2-1
- new upstream release.

* Fri Jul  1 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.3.1-3
- rebuilt with new toolchain.

* Sat May 16 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 1.3.1-2
- added compat32 subpackages

* Sun Dec 07 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.3.1-1
- new upstream release
- remove old patches

* Sat Jul 05 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.3.0-1
- new upstream release
- remove Patch1-6
- add Patch1,2 from Fedora

* Sun Sep 26 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.1-2
- rebuilt with rpm-4.8.1 for pkg-config
- added Patch1-6 from Fedora

* Mon Jul 21 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.1-1
- applied new versioning policy
- spec in UTF-8

* Sat Sep 22 2007 KAZUKI SHIMURA <ksh753@y5.dion.ne.jp> 1.2.1-0vl1
- new upstream release
- drop bmp-plugin.patch (patch1)
- disable xmms plugin

* Sat Aug 18 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.0-0vl1
- new upsteram release
- dropped Patch2 (merged into upstream)
- do not build beepmp plugin

* Sat May 12 2007 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.1.2-0vl7
- rebuilt with new toolchain

* Sun Oct 29 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.1.2-0vl6
- add '--disable-static' option to %%configure
- remove *.la

* Wed Jul 26 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.1.2-0vl5
- rebuild

* Mon Mar 27 2006 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.1.2-0vl4
- --disable-asm-optimizations on ppc

* Thu Feb 02 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.1.2-0vl3
- rebuild

* Wed Feb 09 2005 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.1.2-0vl2
- initialize flac_cfg.stream with NULL to avoid crashing (patch2)

* Sun Feb 06 2005 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.1.2-0vl1
- upstream release
- update bmp-plugin.patch

* Thu Feb 03 2005 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.1.2-0vl0.0beta
- upstream release
- update bmp-plugin.patch

* Fri Jan 14 2005 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.1.1-0vl5
- fix typo

* Sat Dec 18 2004 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.1.1-0vl4
- move html docs to devel package

* Wed Dec 01 2004 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.1.1-0vl3
- add input plugin for beepmp based on for xmms (patch1)
  - BuildRequires: beepmp-devel >= 0.9.7
- define build_*_plugin macros to build input plugin sub-packages
- update description

* Thu Nov 04 2004 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.1.1-0vl2
- drop BuildRequires: zlib-devel (was required to build with id3lib)

* Fri Oct 01 2004 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.1.1-0vl1
- upstream release
- drop (Build)Requires: id3lib(-devel)

* Sun Aug 01 2004 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.1.1-0vl0.1
- 1.1.1-beta1
- add BuildRequires: gtk+-devel, zlib-devel

* Mon May 03 2004 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.1.0-0vl3
- xmms-flac
  - enable to convert charset from/to EUC-JP-MS (Patch0)
  - Requires: glibc >= 2.3.3

* Tue Apr 20 2004 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.1.0-0vl2
- fix docs

* Thu Apr 08 2004 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.1.0-0vl1
- first build for Vine Linux

* Mon Mar 31 2003 Matthias Saou <matthias.saou@est.une.marmotte.net>
- Rebuilt for Red Hat Linux 9.
- Exclude .la files.
- Updated description.

* Tue Mar 11 2003 Matthias Saou <matthias.saou@est.une.marmotte.net>
- Fix nasm dep to be only for ix86.

* Mon Jan 27 2003 Matthias Saou <matthias.saou@est.une.marmotte.net>
- Update to 1.1.0.

* Sun Jan  5 2003 Matthias Saou <matthias.saou@est.une.marmotte.net>
- Rebuilt against the latest id3lib for the xmms plugin.

* Thu Oct 10 2002 Matthias Saou <matthias.saou@est.une.marmotte.net>
- Fixed location of include files, doh!

* Sat Sep 28 2002 Matthias Saou <matthias.saou@est.une.marmotte.net>
- Rebuilt for Red Hat Linux 8.0.

* Wed Sep 25 2002 Matthias Saou <matthias.saou@est.une.marmotte.net>
- Update to 1.0.4.
- Removed obsolete build patch, the xmms plugin builds cleanly at last!

* Thu Jul  4 2002 Matthias Saou <matthias.saou@est.une.marmotte.net>
- Update to 1.0.3.

* Tue Apr 23 2002 Daniel Resare <noa@resare.com>
- Fixed plugin build when flac is not already installed

* Mon Apr  8 2002 Matthias Saou <matthias.saou@est.une.marmotte.net>
- Replaced the hard-coded xmms input path with an expansion.
- Fixed spec (License tag and redundant Group for devel package).
- Fixed defattr for the xmms plugin.

* Sat Apr  6 2002 Daniel Resare <noa@resare.com>
- Update to 1.0.2.
- Splitted out xmms plugin to a separate subpackage.

* Tue Nov 20 2001 Matthias Saou <matthias.saou@est.une.marmotte.net>
- Update to 1.0.1.

* Sun Oct 21 2001 Matthias Saou <matthias.saou@est.une.marmotte.net>
- Rebuilt for Red Hat 7.2 and added xmms dependency.

* Thu Aug 16 2001 Matthias Saou <matthias.saou@est.une.marmotte.net>
- Initial RPM release.
- You cannot rebuild this SRPM easily if you want the xmms plugin.