# git clone git://git.ardour.org/ardour/ardour.git
# tar cvjf ardour-3.1-g66ee2c8.tar.bz2 ardour
# git describe = 3.1-18-g66ee2c8

%define git g66ee2c8

Summary:       Multichannel Digital Audio Workstation
Name:          ardour3
Version:       3.1
Release:       0.1%{?git:.%{?git}}%{?dist}
# No more direct links. Download from
# http://ardour.org/download
Source:        ardour-%{version}%{?git:-%{git}}.tar.bz2
URL:           http://ardour.org
License:       GPLv2+
Group:         Applications/Multimedia

BuildRequires: jack-audio-connection-kit-devel
BuildRequires: libxml2-devel libxslt-devel libart_lgpl-devel
BuildRequires: libsndfile-devel libsamplerate-devel
BuildRequires: raptor-devel liblrdf-devel
BuildRequires: gtk+-devel
BuildRequires: libgnomecanvas-devel
BuildRequires: libgnomecanvasmm26-devel
BuildRequires: liblo-devel
BuildRequires: boost-devel
BuildRequires: fftw-devel
BuildRequires: aubio-devel
BuildRequires: lilv-devel suil-devel
BuildRequires: cppunit-devel
BuildRequires: alsa-lib-devel
BuildRequires: gtkmm24-devel glibmm24-devel
BuildRequires: curl-devel
BuildRequires: libuuid-devel
BuildRequires: libogg-devel flac-devel
BuildRequires: desktop-file-utils
BuildRequires: ImageMagick

Requires: hicolor-icon-theme

# do not provide or require internal shared libraries
%{?filter_setup:
%filter_provides_in %{_libdir}/ardour3
%filter_requires_in %{_libdir}/ardour3
%filter_setup
}

%description
Ardour is a multichannel hard disk recorder (HDR) and digital audio workstation
(DAW). It is capable of simultaneous recording 24 or more channels of 32 bit
audio at 48kHz. Ardour is intended to function as a "professional" HDR system,
replacing dedicated hardware solutions such as the Mackie HDR, the Tascam 2424
and more traditional tape systems like the Alesis ADAT series. It is also
intended to provide the same or better functionality as software systems such
as ProTools, Samplitude, Logic Audio, Nuendo and Cubase VST (we acknowledge
these and all other names as trademarks of their respective owners). It
supports MIDI Machine Control, and so can be controlled from any MMC
controller, such as the Mackie Digital 8 Bus mixer and many other modern
digital mixers.

%prep
%setup -q -n ardour

%build
echo "GenericName=Digital Audio Workstation" >> gtk2_ardour/ardour3.desktop.in

%ifarch x86_64
%define ARCH x86_64
%else
%define ARCH i686
%endif

# change "Ardour" to "Ardour 3" in desktop file
perl -p -i -e "s|Ardour|Ardour 3|g" gtk2_ardour/ardour3.desktop.in

./waf configure --prefix=%{_prefix} --libdir=%{_libdir} --configdir=%{_sysconfdir} --arch=%{ARCH} </dev/null
./waf

%install
./waf configure --prefix=%{_prefix} --libdir=%{_libdir} --configdir=%{_sysconfdir} --destdir=$RPM_BUILD_ROOT --arch=%{ARCH} install </dev/null

# copy icons to freedesktop locations
for s in 16 22 32 48 256; do
    mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/${s}x${s}/apps
    cp -p $RPM_BUILD_ROOT%{_datadir}/ardour3/icons/ardour_icon_${s}px.png \
       $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/${s}x${s}/apps/ardour3.png
done

# add a "3" to the icons
convert -pointsize 120 -fill rosybrown3 -stroke grey30 -draw 'text 132,140 "3"' \
	$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/256x256/apps/ardour3.png \
	$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/256x256/apps/ardour3_3.png
mv -f	$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/256x256/apps/ardour3_3.png \
	$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/256x256/apps/ardour3.png
convert -pointsize 36 -fill firebrick4 -stroke black -draw 'text 26,30 "3"' \
	$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps/ardour3.png \
	$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps/ardour3_3.png
mv -f	$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps/ardour3_3.png \
	$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps/ardour3.png
convert -pointsize 18 -fill firebrick -stroke black -draw 'text 11,15 "3"' \
	$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/ardour3.png \
	$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/ardour3_3.png
mv -f	$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/ardour3_3.png \
	$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/ardour3.png
convert -pointsize 16 -fill firebrick -stroke black -draw 'text 11,13 "3"' \
	$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/22x22/apps/ardour3.png \
	$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/22x22/apps/ardour3_3.png
mv -f	$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/22x22/apps/ardour3_3.png \
	$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/22x22/apps/ardour3.png
convert -pointsize 14 -fill firebrick -stroke black -draw 'text 8,12 "3"' \
	$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/ardour3.png \
	$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/ardour3_3.png
mv -f	$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/ardour3_3.png \
	$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/ardour3.png

# install the desktop entry
mv gtk2_ardour/ardour3.desktop{.in,}
# make the desktop entry valid
perl -p -i -e "s|AudioEditing|X-AudioEditing|g" gtk2_ardour/ardour3.desktop
mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
desktop-file-install --dir ${RPM_BUILD_ROOT}%{_datadir}/applications \
  gtk2_ardour/ardour3.desktop

# install mime entry
# mkdir -p $RPM_BUILD_ROOT%{_datadir}/mime/packages/
# install -p -m 0644 gtk2_ardour/ardour3.xml $RPM_BUILD_ROOT%{_datadir}/mime/packages/

# install the man pages
install -dm 755 $RPM_BUILD_ROOT%{_mandir}/man1/
install -p -m 0644 ardour.1 $RPM_BUILD_ROOT%{_mandir}/man1/ardour3.1
for lang in es fr ru ; do
  install -dm 755 $RPM_BUILD_ROOT%{_mandir}/${lang}/man1/
  install -p -m 0644 ardour.1.${lang} $RPM_BUILD_ROOT%{_mandir}/${lang}/man1/ardour3.1${lang}
done

# %find_lang gtk2_ardour
# cat gtk2_ardour.lang > ardour.lang
# %find_lang libardour2
# cat libardour2.lang >> ardour.lang
# %find_lang libgtkmm2ext
# cat libgtkmm2ext.lang >> ardour.lang

%post
touch --no-create %{_datadir}/icons/hicolor &>/dev/null
update-desktop-database &> /dev/null
update-mime-database %{_datadir}/mime &> /dev/null || :

%postun
if [ $1 -eq 0 ] ; then
    touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null
fi
update-desktop-database &> /dev/null
update-mime-database %{_datadir}/mime &> /dev/null || :

%posttrans
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :


# %files -f ardour.lang

%files
%doc README COPYING
%{_bindir}/ardour3
%{_datadir}/ardour3
%{_libdir}/ardour3
%config(noreplace) %{_sysconfdir}/ardour3
%{_mandir}/man1/ardour*
%{_mandir}/*/man1/ardour*

%{_datadir}/icons/hicolor/*/apps/ardour3.png
%{_datadir}/applications/ardour3.desktop
# %{_datadir}/mime/packages/ardour2.xml

%changelog
* Thu Mar 14 2013 Fernando Lopez-Lezcano <nando@ccrma.stanford.edu> 3.1-0.1.g66ee2c8
- update to latest git after the release of 3.1.10

* Thu Mar 14 2013 Fernando Lopez-Lezcano <nando@ccrma.stanford.edu> 3.0-0.2.g333279c
- update to git 3.0-34-g333279c (after official 3.0 release)
- install icons and menu entry

* Fri Dec 21 2012 Fernando Lopez-Lezcano <nando@ccrma.stanford.edu> 3.0-0.1.svn13709
- update to svn 13709

* Fri Oct 26 2012 Fernando Lopez-Lezcano <nando@ccrma.stanford.edu> 3.0-0.1.svn13352
- updated to current svn, 13352

* Wed Oct  3 2012 Fernando Lopez-Lezcano <nando@ccrma.stanford.edu> 3.0-0.1.svn13201
- updated to current svn, 13201, does not build

* Mon Jul 23 2012 Fernando Lopez-Lezcano <nando@ccrma.stanford.edu> 3.0-0.1.svn13072
- updated to latest svn after the release of beta5

* Sun Jul  1 2012 Fernando Lopez-Lezcano <nando@ccrma.stanford.edu> 
- change man pages to ardour3* so they can be installed alongside
  ardour 2.x

* Thu Jun 27 2012 Fernando Lopez-Lezcano <nando@ccrma.stanford.edu> 
- add filter to filter out from the Requires: list ardour's shared libs

* Thu Jun 27 2012 Fernando Lopez-Lezcano <nando@ccrma.stanford.edu> 3.0-0.1.svn12952
- updated to current svn

* Thu May 24 2012 Fernando Lopez-Lezcano <nando@ccrma.stanford.edu> 
- rename package name to ardour3, enable a few more things in the spec file

* Mon May 21 2012 Fernando Lopez-Lezcano <nando@ccrma.stanford.edu> 3.0-0.1.svn12363
- first build of 3.0 based on the 2.x spec file
- redid all build dependencies, changed over to waf

* Thu May 03 2012 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 2.8.12-4
- gcc-4.7 FTBFS fix RHBZ#818364
- some specfile cleanup

* Tue Feb 28 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.8.12-3
- Rebuilt for c++ ABI breakage

* Tue Jan 10 2012 Nils Philippsen <nils@redhat.com> - 2.8.12-2
- rebuild for gcc 4.7

* Wed Sep 28 2011 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 2.8.12-1
- New upstream release 2.8.12.

* Sun Feb 13 2011 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 2.8.11-7
- Fix gcc-4.6 build failures.

* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.8.11-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Wed Sep 29 2010 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 2.8.11-5
- Parallel build fails. Disable

* Wed Sep 29 2010 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 2.8.11-4
- Fix CVE-2010-3349 RHBZ#638365

* Tue Jul 27 2010 Orcan Ogetbil <oget[DOT]fedora[AT]gmail[DOT]com> - 2.8.11-3
- Rebuild on F-14 against new boost

* Tue Jul 20 2010 Orcan Ogetbil <oget[DOT]fedora[AT]gmail[DOT]com> - 2.8.11-2
- Rebuild against new liblo-0.26

* Sat Jul 10 2010 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 2.8.11-1
- New upstream release 2.8.11.

* Wed Jun 16 2010 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 2.8.10-1
- New upstream release 2.8.10.

* Wed Jun 02 2010 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 2.8.9-1
- New upstream release 2.8.9.

* Tue Jun 01 2010 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 2.8.8-1
- New upstream release 2.8.8.

* Fri Feb 05 2010 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 2.8.7-1
- New upstream release 2.8.7.

* Sat Jan 30 2010 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 2.8.6-1
- New upstream release 2.8.6.

* Sat Nov 14 2009 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 2.8.4-1
- New upstream release 2.8.4.

* Thu Nov 12 2009 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 2.8.3-1
- New upstream release 2.8.3.

* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.8.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Tue Jul 21 2009 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 2.8.2-2
- Fix libdir once more

* Tue Jul 21 2009 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 2.8.2-1
- New upstream release 2.8.2.

* Thu Jul 09 2009 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 2.8.1-1
- New upstream release 2.8.1.

* Sun May 10 2009 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 2.8-2
- Rebuild against new boost

* Mon Mar 30 2009 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 2.8-1
- New upstream release 2.8.
- Update scriptlets according to the new guidelines
- Enable SLV2 support
- Include mime type
- Minor fixes in the SPEC file

* Mon Feb 23 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.7.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Sun Feb 22 2009 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 2.7.1-1
- New upstream release 2.7.1.
- Replace gcc43 patch with a gcc44 patch
- Add GenericName to the .desktop file
- Fix encodings of French and Russian manpages

* Fri Nov 21 2008 Anthony Green <green@redhat.com> 2.7-1
- New upstream release 2.7.

* Mon Oct 27 2008 Anthony Green <green@redhat.com> 2.6.1-1
- New upstream release 2.6.1.

* Sat Oct 25 2008 Anthony Green <green@redhat.com> 2.6-3
- BuildRequire libcurl-devel.

* Sat Oct 25 2008 Anthony Green <green@redhat.com> 2.6-2
- Upgrade gcc43 patch to apply with fuzz = 0.

* Sat Oct 25 2008 Anthony Green <green@redhat.com> 2.6-1
- New upstream release 2.6.
- Update SConstruct patch.

* Sun Sep 21 2008 Anthony Green <green@redhat.com> 2.5-2
- Add HOST_NOT_FOUND patch.

* Thu Jul 10 2008 Anthony Green <green@redhat.com> 2.5-1
- New upstream release 2.5.

* Thu Apr 10 2008 Hans de Goede <j.w.r.degoede@hhs.nl> 2.4.1-1
- New upstream release 2.4.1

* Mon Apr  7 2008 Hans de Goede <j.w.r.degoede@hhs.nl> 2.4-1
- New upstream release 2.4
- Fix building with gcc-4.3, patch by Christopher Aillon (bz 434119, 440933)
- Switch to using system libraries, as the included ones don't compile with
  gcc-4.3 (bz 339391)

* Mon Feb 18 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 2.2-4
- Autorebuild for GCC 4.3

* Wed Jan 23 2008 Anthony Green <green@redhat.com> 2.2-3
- Fix tagging glitch.

* Tue Jan 22 2008 Anthony Green <green@redhat.com> 2.2-2
- Fix wrapper script.

* Thu Jan 17 2008 Anthony Green <green@redhat.com> 2.2-1
- Upgrade to ardour 2.2.  Wrap executable in a script.

* Fri Dec 21 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 2.1-4
- Fix building of ardour on alpha machines (bz 425987)
- Fix building with glib-2.15.0

* Wed Oct 10 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 2.1-3
- Fix finding of translations (bz 238552)
- Convert some documentation files to UTF-8

* Tue Oct  9 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 2.1-2
- Upgrade to latest upstream 2.1 (bz 238552)
- Merge with CCRMA ardour2 package
- Begin with a release of 2 to be higher then CCRMA's last EVR

* Wed May 02 2007 Anthony Green <green@redhat.com> 2.0-1
- Upgrade sources.

* Sat Jan 06 2007 Anthony Green <green@redhat.com> 0.99.3-8
- Enable optimization (oops).
- Add ardour-no-sse.patch to disable use of build-system dependent 
  hardware features (SSE, MMX, etc).

* Thu Oct 05 2006 Christian Iseli <Christian.Iseli@licr.org> 0.99.3-7
 - rebuilt for unwind info generation, broken in gcc-4.1.1-21

* Tue Sep 19 2006 Anthony Green <green@redhat.com> 0.99.3-6
- Fix release tag.

* Mon Sep 18 2006 Anthony Green <green@redhat.com> 0.99.3-5.1
- Rebuild.

* Sat Sep  8 2006 Anthony Green <green@redhat.com> 0.99.3-5
- Install the templates.

* Sat Sep  2 2006 Anthony Green <green@redhat.com> 0.99.3-4
- Move .desktop file out of spec file to source dir.
- Add a couple of upstream patches (2 and 3)

* Sun Aug 13 2006 Anthony Green <green@redhat.com> 0.99.3-3
- Remove PlanetCCRMA changelogs (rpmlint was complaining)
- Escape macros in changelog.
- Remove useless rm in %%build section.
- Don't install useless README file.
- Clean up BuildRequires and %%files sections.

* Sat May 13 2006 Anthony Green <green@redhat.com> 0.99.3-2
- Conditionally apply ardour-lib64-ladspa.patch.

* Sat May 13 2006 Anthony Green <green@redhat.com> 0.99.3-1
- Update sources to 0.99.3.
- Add linudoc-tools dependency.
- Set USE_SSE_EVERYWHERE and BUILD_SSE_OPTIMIZATIONS at build time.
- Replace some macro command usage.

* Sat Apr 22 2006 Anthony Green <green@redhat.com> 0.99.2-3
- Use %%find_lang.

* Thu Apr 20 2006 Anthony Green <green@redhat.com> 0.99.2-2
- Fix ardour URL.  Add scons smp build flags.
- Own %%{_sysconfdir}/ardour.
- Standardize on $RPM_BUILD_ROOT usage.
- Remove gcc BuildRequires.

* Tue Apr 18 2006 Anthony Green <green@redhat.com> 0.99.2-1
- Update sources. Build for Fedora Extras. Derived from Fernando
  Lopez-Lezcano's PlanetCCRMA package.
