# Wether or not to include the X11 version of xaumix
%define with_xaumix             1
# Wether or not to install desktop menu files so it is in GNOME/KDE menus
%define with_desktop_files      0

# Do not build on s390/s390x because there is no audio hardware
ExcludeArch: s390 s390x

Summary: An ncurses-based audio mixer.
Name: aumix
Version: 2.7
Release: 16
License: GPL
URL: http://jpj.net/~trevor/aumix.html
Group: Applications/Multimedia
Source0: http://www.jpj.net/~trevor/aumix/%{name}-%{version}.tar.gz
Source1: aumix.desktop
Patch0: aumix-2.7-save_load.patch
Patch1: aumix-2.7-autoconf.patch
Requires: initscripts >= 4.42
BuildRequires: ncurses-devel, autoconf, automake
Buildroot: %{_tmppath}/%{name}-%{version}-root

%description
Aumix is a tty-based, interactive method of controlling a sound card
mixer. It lets you adjust the input levels from the CD, microphone,
and board synthesizers, as well as the output volume. Aumix can
adjust audio mixers from the command line, from a script, or
interactively at the console or terminal with an
ncurses-based interface.

Install aumix if you need to control an audio mixer.  If you want to use
Aumix's GUI, you'll need to install ncurses and gpm for mouse support.

%if %{with_xaumix}
%package X11
Group: Applications/Multimedia
Summary: An X11-based audio mixer
Requires: aumix = %{version}

%description X11
Aumix-X11 is a gtk-based, interactive method of controlling a sound card
mixer. It lets you adjust the input levels from the CD, microphone,
and board synthesizers, as well as the output volume. Aumix can
adjust audio mixers from the command line, from a script, or
interactively at the console or terminal with an
ncurses-based interface.

Install aumix if you need to control an audio mixer from X11.
%endif

%prep
%setup -q
%patch0 -p1 -b .save_load
%patch1 -p1 -b .autoconf
aclocal
automake -a
autoheader
autoconf

%build
%configure --prefix=/ --without-alsa --without-ncurses --without-gtk
make
mv src/aumix ./aumix-minimal
make distclean
%configure --without-alsa
make
mv src/aumix ./aumix-X11
make distclean
%configure --without-alsa \
        --without-gtk
make

%install
rm -rf %{buildroot}
%makeinstall
make prefix=%{buildroot}/usr install -C po
mkdir -p %{buildroot}/bin
install -c -m755 aumix-minimal %{buildroot}/bin
mkdir -p %{buildroot}/usr/X11R6/bin
install -c -m755 aumix-X11 %{buildroot}/usr/X11R6/bin
strip -R .comment %{buildroot}/usr/bin/aumix %{buildroot}/bin/aumix-minimal \
        %{buildroot}/usr/X11R6/bin/aumix-X11

mkdir -p %{buildroot}/etc/X11/applnk/Multimedia

%if %{with_xaumix}
%{!?with_desktop_files:install -m 644 %SOURCE1 $RPM_BUILD_ROOT/etc/X11/applnk/Multimedia/aumix.desktop}
%else
rm -f $RPM_BUILD_ROOT/%{_bindir}/xaumix
%endif

%find_lang %name

%clean
rm -rf %{buildroot}

%files -f %{name}.lang
%defattr(-,root,root)
%doc README TODO NEWS ChangeLog
/bin/aumix-minimal
%{_bindir}/aumix
%{_mandir}/man1/aumix.*
%{_datadir}/aumix

%if %{with_xaumix}
%files X11
%defattr(-,root,root)
/usr/X11R6/bin/aumix-X11
%{_bindir}/xaumix
%{_mandir}/man1/xaumix.*
%{!?with_desktop_files:/etc/X11/applnk/Multimedia/aumix.desktop}
%endif

%changelog
* Wed Jan 22 2003 Tim Powers <timp@redhat.com>
- rebuilt

* Wed Nov 20 2002 Florian La Roche <Florian.LaRoche@redhat.de>
- do not build on mainframe

* Sun Nov 12 2002 Mike A. Harris <mharris@redhat.com> 2.7-14
- Made aumix-X11 subpackage build time conditional using with_xaumix
- Made installation of desktop menu files conditional using with_desktop_files
- Added missing xaumix manpage

* Sun Oct  6 2002 Mike A. Harris <mharris@redhat.com> 2.7-13
- All-arch rebuild

* Sun Aug  4 2002 Mike A. Harris <mharris@redhat.com> 2.7-12
- Disabled aumix desktop file so it doesn't show up in GNOME/KDE menus (#69374)

* Fri Jun 21 2002 Tim Powers <timp@redhat.com> 2.7-11
- automated rebuild

* Sun May 26 2002 Tim Powers <timp@redhat.com> 2.7-10
- automated rebuild

* Tue May 21 2002 Mike A. Harris <mharris@redhat.com 2.7-9
- Rebuilt in new build environment

* Mon Feb 25 2002 Mike A. Harris <mharris@redhat.com 2.7-8
- Rebuilt in new build environment
- Added project homepage URL

* Thu Jan 31 2002 Nalin Dahyabhai <nalin@redhat.com> 2.7-6
- rebuild

* Mon Jun 25 2001 Crutcher Dunnavant <crutcher@redhat.com>
- added ncurses-devel build req

* Mon Jun 25 2001 Crutcher Dunnavant <crutcher@redhat.com>
- fixed option parsing bug, where aumix handled load and store
- before scanning for a file name

* Sun Jun 24 2001 Elliot Lee <sopwith@redhat.com>
- Bump release + rebuild.

* Fri Feb 23 2001 Trond Eivind Glomsrød <teg@redhat.com>
- langify
- don't create the .desktop file from within the spec file

* Thu Dec  7 2000 Crutcher Dunnavant <crutcher@redhat.com>
- Upgrade to 2.7

* Wed Jul 12 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Tue Jun 27 2000 Preston Brown <pbrown@redhat.com>
- make desktop entry a config file
- 2.6.1
- the nogtk patch has been rolled into the main distro, removed.

* Thu Jun  8 2000 Bill Nottingham <notting@redhat.com>
- FHS stuff

* Mon May 22 2000 Bill Nottingham <notting@redhat.com>
- make desktop link point to correct binary (#11413)

* Wed Apr 13 2000 Bill Nottingham <notting@redhat.com>
- 2.6

* Wed Mar 29 2000 Bill Nottingham <notting@redhat.com>
- 2.5

* Wed Mar 22 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 2.3
- rebuild with current libncurses
- fix up and re-enable aumix-X11, and move it to a separate package
- add a .desktop file for aumix-X11

* Mon Mar 13 2000 Bill Nottingham <notting@redhat.com>
- update to 2.2

* Thu Feb  3 2000 Bill Nottingham <notting@redhat.com>
- handle compressed man pages

* Mon Dec 20 1999 Bill Nottingham <notting@redhat.com>
- update to 1.30.1

* Mon Nov 29 1999 Bill Nottingham <notting@redhat.com>
- update to 1.28

* Thu Nov  4 1999 Bill Nottingham <notting@redhat.com>
- update to 1.26

* Mon Oct 18 1999 Bill Nottingham <notting@redhat.com>
- update to 1.23.1

* Mon Oct  4 1999 Bill Nottingham <notting@redhat.com>
- update to 1.23

* Mon Sep 20 1999 Bill Nottingham <notting@redhat.com>
- oops, fix regular aumix

* Fri Sep 17 1999 Bill Nottingham <notting@redhat.com>
- add stripped down version in /bin
- kill sound.init (in initscripts now)

* Fri Sep 10 1999 Bill Nottingham <notting@redhat.com>
- chkconfig --del in %preun, not %postun

* Mon Aug 16 1999 Bill Nottingham <notting@redhat.com>
- initscript munging

* Wed Jun 23 1999 Bill Nottingham <notting@redhat.com>
- move initscript from rhsound to here. Woohoo - we got rid of a package! ;)

* Tue Jun 22 1999 Bill Nottingham <notting@redhat.com>
- 1.22.1

* Mon Jun 14 1999 Bill Nottingham <notting@redhat.com>
- 1.22

* Sat May 21 1999 Bill Nottingham <notting@redhat.com>
- 1.18.4

* Thu May 06 1999 Bill Nottingham <notting@redhat.com>
- update to 1.18.3

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com>
- auto rebuild in the new build environment (release 2)

* Wed Feb 24 1999 Bill Nottingham <notting@redhat.com>
- update to 1.18.2

* Mon Feb 22 1999 Bill Nottingham <notting@redhat.com>
- update to 1.18.1

* Mon Feb  8 1999 Bill Nottingham <notting@redhat.com>
- update to 1.17

* Mon Feb  1 1999 Bill Nottingham <notting@redhat.com>
- update to 1.15

* Fri Dec 18 1998 Bill Nottingham <notting@redhat.com>
- update to 1.14

* Sat Oct 10 1998 Cristian Gafton <gafton@redhat.com>
- strip binary

* Fri Oct  2 1998 Bill Nottingham <notting@redhat.com>
- updated to 1.13

* Fri Aug 28 1998 Bill Nottingham <notting@redhat.com>
- updated to 1.12

* Mon Aug 17 1998 Bill Nottingham <notting@redhat.com>
- updated to 1.11

* Tue May 05 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr

* Thu Apr 09 1998 Cristian Gafton <gafton@redhat.com>
- updated to 1.8

* Tue Oct 21 1997 Otto Hammersmith <otto@redhat.com>
- fixed source url
- updated version

* Thu Jul 10 1997 Erik Troan <ewt@redhat.com>
- built with glibc

* Thu Mar 20 1997 Michael Fulbright <msf@redhat.com>
- Updated to v. 1.6.1.