File vgmstream.spec of Package vgmstream

# manually increase this whenever abi may have changed, since there is no upstream versioning
%define soversion 1

Name: vgmstream
Version: 0
Release: 0
License: ISC
Summary: Library for decoding various streamed audio formats used in video games
Url: http://sourceforge.net/projects/vgmstream
Group: Development/Libraries/C and C++
Source: %{name}-%{version}.tar.gz
BuildRequires: cmake >= 3.1.0
BuildRequires: gcc-c++
BuildRequires: libvorbis-devel libogg-devel zlib-devel
BuildRequires: pkgconfig
BuildRequires: pkgconfig(ao)
BuildRequires: mpg123-devel >= 1.30

%if 0%{?suse_version}
BuildRequires: pkgconfig(libavcodec)
BuildRequires: pkgconfig(libavformat)
%endif

BuildRoot: %{_tmppath}/%{name}-%{version}-build


%description
This is vgmstream, a library for playing streamed audio from video games.
It is very much under development. There are two end-user bits: a command
line decoder called "%{name}", and a Winamp plugin called "in_vgmstream".
There is also a plugin for an outdated version of audacious available.
This package only provides the command line decoder.

%package        devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       libvorbis-devel
Requires:       libogg-devel
Requires:       zlib-devel
Requires:       mpg123-devel

%description    devel
Development files for %{name}

%prep
%setup -q

echo "echo %{version}" > version-get.sh

# vgmstream uses bundled copies of includes of 3rd party libs of some arbitrary version
# to avoid api / abi breakes, get rid of them, as we have our own versioned includes
cd ext_includes
rm -rf ogg
rm -rf vorbis
rm -rf speex
rm -rf celt
rm -rf jansson
rm -rf ffmpeg
rm -rf libavutil
rm -rf libavcodec
rm -rf libavformat
rm -rf libswresample
rm -f fmt123.h g719.h g7221.h libatrac9.h maiatrac3plus.h mpg123.h


%build
export CFLAGS="-ffat-lto-objects"
export CXXFLAGS="-ffat-lto-objects"
%cmake -DUSE_G7221=0 -DUSE_G719=0 -DUSE_ATRAC9=0 -DUSE_CELT=0 -DUSE_SPEEX=0 -DBUILD_AUDACIOUS=0 -DBUILD_V123=0 -DCMAKE_C_STANDARD=99 -DBUILD_SHARED_LIBS=0 -DCMAKE_BUILD_TYPE=RelWithDebInfo
%cmake_build

%install
%if 0%{?suse_version}
%define __cmake_builddir build
%endif
ls -la
ls -la %__cmake_builddir
ls -la %__cmake_builddir/src
pushd %__cmake_builddir
install -m 0755 -D cli/vgmstream-cli %{buildroot}/%{_bindir}/%{name}
install -Dm 0644 src/libvgmstream.a %{buildroot}%{_libdir}/libvgmstream.a

popd

mkdir -p %{buildroot}%{_includedir}/vgmstream
install -m 0644 src/libvgmstream_streamfile.h \
    src/libvgmstream.h \
    %{buildroot}%{_includedir}/vgmstream/

%files
%defattr(-,root,root)
%doc README.md COPYING
%{_bindir}/%{name}

%files devel
%defattr(-,root,root)
%dir %{_includedir}/vgmstream
%{_includedir}/vgmstream/*.h
%{_libdir}/libvgmstream.a
openSUSE Build Service is sponsored by