File jack.spec of Package jack

#
# spec file for package jack
#
# Copyright (c) 2012 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/
#


%if 0%{?suse_version} > 1110
# Switch the --dbus on and off, on = 1
%define wdbus 1
BuildRequires:  libffado-devel >= 2.0.1.2040
%else
%define wdbus 0
%endif

Name:           jack
Version:        1.9.8
Release:        3
#to_be_filled_by_service
License:        LGPL-2.1+
Summary:        Jack-Audio Connection Kit
Url:            http://jackaudio.org/
Group:          System/Sound Daemons
# http://www.grame.fr/~letz/
Source0:        %{name}-%{version}.tar.bz2
Source1:        baselibs.conf
# Without this, there is a link error on SPARC
Patch2:         jack-sparcv9.diff
# Fix celt build
Patch3:         jack-celt-build-fix.diff
# Patch for uc-regs for power pc 64
Patch4:         jack-uc_regs.patch
# PATCH-FIX-UPSTREAM jack-segfault.patch dvaleev@suse.com -- fixes jack-connect segfault
Patch5:         jack-segfault.patch
# PATCH-FIX-OPENSUSE jack-ppc64-long.patch dvaleev@suse.com -- needed to build blender on ppc64
Patch6:         jack-ppc64-long.patch
BuildRequires:  alsa-devel
BuildRequires:  dos2unix
BuildRequires:  doxygen
BuildRequires:  flac-devel
BuildRequires:  gcc-c++
BuildRequires:  libFLAC8
BuildRequires:  libcelt-devel >= 0.7.0
BuildRequires:  libexpat-devel
BuildRequires:  libogg-devel
BuildRequires:  libsamplerate-devel
BuildRequires:  libsndfile-devel
BuildRequires:  libvorbis-devel
BuildRequires:  pkg-config
BuildRequires:  pkgconfig
BuildRequires:  python
BuildRequires:  readline-devel
BuildRequires:  pkgconfig(dbus-1)
BuildRequires:  pkgconfig(libxml-2.0)
Requires:       libjack0 = %{version}
Provides:       jack-audio-connection-kit
Provides:       jack2 = %{version}
Obsoletes:      jack2 < %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%define debug_package_requires %{name} = %{version}-%{release}

%description
JACK is system for handling real-time, low latency audio
(and MIDI). It runs on GNU/Linux, Solaris, FreeBSD, OS X and
Windows (and can be ported to other POSIX-conformant
platforms). It can connect a number of different
applications to an audio device, as well as allowing them to
share audio between themselves. Its clients can run in their
own processes (ie. as normal applications), or can they can
run within the JACK server (ie. as a "plugin"). JACK also
has support for distributing audio processing across a
network, both fast & reliable LANs as well as slower, less
reliable WANs.

%package -n libjack0
License:        LGPL-2.1+
Summary:        Jack Audio Connection Kit Library
Group:          System/Libraries
Provides:       libjack = %{version}
Obsoletes:      libjack < %{version}
Provides:       libjack2

%description -n libjack0
This package contains the library to access JACK
(Jack Audio ConnectionKit).

%package -n libjack-devel
License:        LGPL-2.1+
Summary:        Development package for jack
Group:          Development/Libraries/C and C++
Requires:       libjack0 = %{version}
Requires:       pkgconfig
Provides:       jack-audio-connection-kit-devel
Provides:       jack-devel
Provides:       libjack2-devel = %{version}
Obsoletes:      libjack2-devel < %{version}

%description -n libjack-devel
This package contains the files needed to compile programs that
communicate with jack clients/servers.

%prep
%setup -q
%patch2
%patch3
%patch4 -p1
%patch5 -p1
%patch6 -p1

%build

export CFLAGS="%{optflags} -ggdb -fPIC"
export CXXFLAGS="$CFLAGS"

./waf -v -j1 \
  --prefix=%{_prefix} \
  --libdir=/%{_lib} \
  --classic \
%if 0%{?wdbus} == 1
  --dbus \
%endif
%if 0%{?suse_version} > 1110
  --firewire \
%endif
  --alsa \
  --doxygen \
  --ports=1024 \
  --enable-pkg-config-dbus-service-dir \
  --mandir=/share/man/man1 \
  --doxygen \
  configure

# build is too heavy, so don't spawn more than one process or the build hangs
./waf -v -j1 build

%install
# This is a workaround because the doc build looks for build/default/html but there isn't one.
pushd build/default/
ln -s ../../html html
popd

./waf -j1 install --destdir=%{buildroot}
mkdir -p %{buildroot}%{_docdir}/%{name}
mv %{buildroot}%{_datadir}/jack-audio-connection-kit %{buildroot}%{_docdir}
dos2unix -k ChangeLog
dos2unix -k README
dos2unix -k TODO
cp ChangeLog README* TODO %{buildroot}%{_docdir}/%{name}/

# Fix wrong-file-end-of-line-encoding
dos2unix -k %{buildroot}%{_docdir}/%{name}/ChangeLog
dos2unix -k %{buildroot}%{_docdir}/%{name}/README
dos2unix -k %{buildroot}%{_docdir}/%{name}/TODO

%post -n libjack0 -p /sbin/ldconfig

%postun -n libjack0 -p /sbin/ldconfig

%clean
test %{buildroot} != "/" -a -d %{buildroot} && rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc %dir %{_docdir}/%{name}
%doc %{_docdir}/%{name}/ChangeLog
%doc %{_docdir}/%{name}/README*
%doc %{_docdir}/%{name}/TODO
%doc %{_mandir}/man1/*
%{_bindir}/*
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/inprocess.so
%{_libdir}/%{name}/%{name}_alsa.so
%{_libdir}/%{name}/%{name}_dummy.so
%{_libdir}/%{name}/%{name}_net.so
%{_libdir}/%{name}/netmanager.so*
%{_libdir}/%{name}/profiler.so*
%{_libdir}/%{name}/netadapter.so*
%{_libdir}/%{name}/audioadapter.so*
%{_libdir}/%{name}/%{name}_loopback.so*
%{_libdir}/%{name}/%{name}_netone.so*
%{_libdir}/%{name}/jack_alsarawmidi.so
%if 0%{?suse_version} > 1110
%{_libdir}/%{name}/%{name}_firewire.so
%endif
%if 0%{?wdbus} == 1
%{_datadir}/dbus-1/services/org.jackaudio.service
%endif

%files -n libjack0
%defattr(-, root, root)
%{_libdir}/lib*.so.*

%files -n libjack-devel
%defattr(-, root, root)
%doc %dir %{_docdir}/%{name}
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/*
%{_includedir}/%{name}
%dir %{_docdir}/jack-audio-connection-kit
%doc %{_docdir}/jack-audio-connection-kit/*

%changelog