File alsa.spec of Package alsa.3768

# spec file for package alsa
# Copyright (c) 2016 SUSE LINUX 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

Name:           alsa
BuildRequires:  doxygen
BuildRequires:  libtool
%if %suse_version > 1200
BuildRequires:  libudev-devel
BuildRequires:  pkg-config
BuildRequires:  udev
%define package_version
Requires:       alsa-utils
Recommends:     alsa-plugins alsa-oss
PreReq:         %insserv_prereq %fillup_prereq
# bug437293
%ifarch ppc64
Obsoletes:      alsa-64bit
Summary:        Advanced Linux Sound Architecture
License:        LGPL-2.1+
Group:          System/Libraries
Release:        0
Source2:        baselibs.conf
Source8:        40-alsa.rules
Source9:        42-hd-audio-pm.rules
Source11:       alsasound
Source12:       sysconfig.sound
Source13:       joystick
Source14:       sysconfig.joystick
Source16:       set_default_volume
Source17:       test.wav
Source21:       README.testwav
Source30:       all_notes_off
Source31:       all_notes_off.bin
Source32:       all_notes_off.mid
Source40:       50-alsa.conf
Source41:       install-snd-module
Source51:       cherrytrailcraudio.conf
Source52:       HiFi.conf
# Patch:          alsa-lib-git-fixes.diff
# upstream fixes
Patch1:         0001-local.h-use-__kernel_off_t-from-linux-types.h.patch
Patch2:         0002-conf-cards-add-Audio-Advantage-Micro-II.patch
Patch3:         0003-pcm-Fix-a-wrong-value-shown-in-the-error-message-in-.patch
Patch4:         0004-UCM-Document-some-standard-values.patch
Patch5:         0005-hdspm.h-Update-LTC-ioctl-to-use-struct-hdspm_ltc.patch
Patch6:         0006-Update-iatomic.h-functions-definitions-for-mips.patch
Patch7:         0007-Fix-access-of-freed-memory-in-namehints.patch
Patch8:         0008-HDA-Intel-present-up-to-8-HDMI-DP-outputs-via-hdmi-d.patch
Patch9:         0009-snd_tlv_convert_from_dB-fix-decreasing-gain-across-e.patch
Patch10:        0010-remove-unnecessary-obsolete-compat-hsearch_r.c.patch
Patch11:        0011-local.h-include-sys-types.h-to-fix-issues-with-pcm.h.patch
Patch12:        0012-test-chmap-Add-missing-usage-text-for-s-option.patch
Patch13:        0013-include-global.h-don-t-define-timeval-and-timespec-s.patch
Patch14:        0014-conf.c-use-portable-way-to-initialize-recursive-mute.patch
Patch15:        0015-pcm_file-fix-SEGFAULT-if-file-option-is-missing-whil.patch
Patch16:        0016-pcm_file-fixed-memory-leak.patch
Patch17:        0017-pcm_file-don-t-touch-infile-on-playback-and-output-f.patch
Patch18:        0018-pcm_file-document-new-argument-to-snd_pcm_file_open.patch
Patch19:        0019-dmix-Don-t-use-assert-and-abort.patch
# rest suse patches
Patch99:        alsa-lib-doxygen-avoid-crash-for-11.3.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if %suse_version > 1200
%define _udevdir %(pkg-config --variable=udevdir udev)
%define _udevdir /lib/udev

ALSA stands for Advanced Linux Sound Architecture.  It supports many
PCI, ISA PnP  and USB sound cards.

This package contains the ALSA init scripts to start the sound system
on your Linux box.  To set it up, run yast2 or alsaconf.

%package devel
Summary:        Include Files and Libraries mandatory for Development
License:        LGPL-2.1+
Group:          Development/Libraries/C and C++
Requires:       glibc-devel
Requires:       libasound2 = %{version}
Obsoletes:      alsadev
Provides:       alsa-lib-devel
Provides:       alsadev

%description devel
This package contains all necessary include files and libraries needed
to develop applications that require these.

%package docs
Summary:        Additional Package Documentation
License:        GPL-2.0+
Group:          Documentation/Other
%if %suse_version > 1110
BuildArch:      noarch

%description docs
This package contains optional documentation provided in addition to
this package's base documentation.

%package -n libasound2
Summary:        Advanced Linux Sound Architecture Library
License:        LGPL-2.1+
Group:          System/Libraries
Provides:       alsa-lib

%description -n libasound2
This package contains the library for ALSA, Advanced Linux Sound

%setup -q -n alsa-lib-%{package_version}
# %patch -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%if %suse_version == 1130
%patch99 -p1
# hack to fix build on older distros
%if %suse_version < 1100
%ifarch %ix86
test -f $RPM_SOURCE_DIR/baselibs.conf && \
sed -i -e'/recommends.*alsa-oss/d' $RPM_SOURCE_DIR/baselibs.conf

export AUTOMAKE_JOBS="%{?_smp_mflags}"
# build alsa-lib
autoreconf -fi
%configure \
  --disable-static \
  --enable-symbolic-functions \
  --disable-aload \
  --disable-alisp \
make V=1 %{?_smp_mflags}
# run doxygen
make -C doc doc

# install shared library
# clean up unneeded files
rm -f $RPM_BUILD_ROOT%{_libdir}/*.*a
rm -f $RPM_BUILD_ROOT%{_libdir}/alsa-lib/smixer/*.*a
rm -f $RPM_BUILD_ROOT%{_bindir}/aserver
# install helper scripts
mkdir -p $RPM_BUILD_ROOT%{_bindir}
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
install -c -m 0755 %{SOURCE16} $RPM_BUILD_ROOT%{_bindir}
install -c -m 0755 %{SOURCE34} $RPM_BUILD_ROOT%{_sbindir}/alsa-init
%if %suse_version < 1140
sed -i -e 's@/var/lib/alsa/asound.state@/etc/asound.state@g' $RPM_BUILD_ROOT%{_bindir}/set_default_volume
sed -i -e 's@/var/lib/alsa/asound.state@/etc/asound.state@g' $RPM_BUILD_ROOT%{_sbindir}/alsa-init
# install test wave file
mkdir -p $RPM_BUILD_ROOT%{_datadir}/sounds/alsa
install -c -m 0644 %{SOURCE17} $RPM_BUILD_ROOT%{_datadir}/sounds/alsa/test.wav
# install all_notes_off stuff
install -c -m 0755 %{SOURCE30} $RPM_BUILD_ROOT%{_bindir}
mkdir -p $RPM_BUILD_ROOT/usr/lib
install -c -m 0644 %{SOURCE31} $RPM_BUILD_ROOT/usr/lib
install -c -m 0644 %{SOURCE32} $RPM_BUILD_ROOT/usr/lib
%if %suse_version <= 1310
# install init scripts
mkdir -p $RPM_BUILD_ROOT/etc/init.d
install -c -m 0755 %{SOURCE11} $RPM_BUILD_ROOT/etc/init.d
install -c -m 0755 %{SOURCE13} $RPM_BUILD_ROOT/etc/init.d
%if %suse_version < 1140
sed -i -e 's@/var/lib/alsa/asound.state@/etc/asound.state@g' $RPM_BUILD_ROOT/etc/init.d/alsasound
rm -f $RPM_BUILD_ROOT%{_sbindir}/rcalsasound
ln -s ../../etc/init.d/alsasound $RPM_BUILD_ROOT%{_sbindir}/rcalsasound
rm -f $RPM_BUILD_ROOT%{_sbindir}/rcjoystick
ln -s ../../etc/init.d/joystick $RPM_BUILD_ROOT%{_sbindir}/rcjoystick
# udev rules (only for non-systemd)
mkdir -p $RPM_BUILD_ROOT%{_udevdir}/rules.d
%if %suse_version < 1140
install -c -m 0644 %{S:8} $RPM_BUILD_ROOT%{_udevdir}/rules.d
install -c -m 0644 %{S:9} $RPM_BUILD_ROOT%{_udevdir}/rules.d
# modprobe config and the module install script for loading OSS-emulation
# and sequencer modules automatically
%if %suse_version > 1220
mkdir -p $RPM_BUILD_ROOT/etc/modprobe.d
install -c -m 0644 %{S:40} $RPM_BUILD_ROOT/etc/modprobe.d
mkdir -p $RPM_BUILD_ROOT/sbin
install -c -m 0755 %{S:41} $RPM_BUILD_ROOT/sbin
# install template to update rc.config and sysconfig files:
# (updating the actual files is done in the %post-script)
mkdir -p -m 755 $RPM_BUILD_ROOT/var/adm/fillup-templates
mkdir -p -m 755 $RPM_BUILD_ROOT/etc/sysconfig
install -m 644 $RPM_SOURCE_DIR/sysconfig.sound $RPM_BUILD_ROOT/var/adm/fillup-templates
%if %suse_version <= 1310
install -m 644 $RPM_SOURCE_DIR/sysconfig.joystick $RPM_BUILD_ROOT/var/adm/fillup-templates
# documents
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}
cp $RPM_SOURCE_DIR/README* $RPM_BUILD_ROOT%{_docdir}/%{name}
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}/alsa-lib
cp COPYING ChangeLog INSTALL TODO MEMORY-LEAK $RPM_BUILD_ROOT%{_docdir}/%{name}/alsa-lib
cp doc/asoundrc.txt $RPM_BUILD_ROOT%{_docdir}/%{name}/alsa-lib
# install to sbindir
install -c -m 0755 %{SOURCE33} $RPM_BUILD_ROOT%{_sbindir}
# extra UCM profiles
mkdir -p $RPM_BUILD_ROOT%{_datadir}/alsa/ucm/cherrytrailcraudio
install -c -m 0644 %{SOURCE51} $RPM_BUILD_ROOT%{_datadir}/alsa/ucm/cherrytrailcraudio
install -c -m 0644 %{SOURCE52} $RPM_BUILD_ROOT%{_datadir}/alsa/ucm/cherrytrailcraudio

%if %suse_version > 1310
%{fillup_only -n sound}
%{fillup_and_insserv -ny sound alsasound}
%{fillup_and_insserv -n joystick joystick}
exit 0

%if %suse_version <= 1310
%stop_on_removal alsasound joystick
exit 0

%restart_on_update alsasound joystick
exit 0

%post -n libasound2 -p /sbin/ldconfig

%postun -n libasound2 -p /sbin/ldconfig

%defattr(-, root, root)
%doc %{_docdir}/%{name}
%if %suse_version <= 1310
%if %suse_version > 1220

%files devel
%defattr(-, root, root)

%files docs
%defattr(-, root, root)
%doc doc/doxygen/html/*

%files -n libasound2
%defattr(-, root, root)

openSUSE Build Service is sponsored by