#
# spec file for package ladspa (Version 1.13)
#
# Copyright (c) 2010 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/
#

# norootforbuild


Name:           ladspa
BuildRequires:  fdupes fftw3-devel flac-devel gcc-c++ ladspa-devel libsndfile-devel pkgconfig xorg-x11-util-devel
%define AMB_version 0.6.1
%define FIL_version 0.3.0
%define MCP_version 0.4.0
%define REV_version 0.3.1
%define VCO_version 0.3.0
%define alienwah_version 1.13
%define blepvco_version 0.1.0
%define blop_version 0.2.8
%define caps_version 0.4.4
%define pvoc_version 0.1.12
%define sooperlooper_version 0.93
%define swh_version 0.4.15
%define tap_version 0.7.1
%define vcf_version 0.0.5
%define vlevel_version 0.5
%define vocoder_version 0.3
Summary:        The Linux Audio Developer's Simple Plug-In API
Version:        1.13
Release:        3
License:        LGPLv2.1+
Group:          Productivity/Multimedia/Sound/Utilities
AutoReq:        on
Autoprov:       off
Provides:       ladspa > 1.12.code10.3.1
Provides:       ladspa-swh-plugins = %{swh_version} ladspa-AMB = %{AMB_version} ladspa-FIL = %{FIL_version}
Provides:       ladspa-REV = %{REV_version} ladspa-VCO = %{VCO_version} ladspa-alienwah = %{alienwah_version}
Provides:       ladspa-caps = %{caps_version} ladspa-pvoc = %{pvoc_version} ladspa-tap-plugins = %{tap_version}
Provides:       ladspa-vlevel = %{vlevel_version} ladspa-vocoder = %{vocoder_version} ladspa-blop = %{blop_version}
Provides:       ladspa-vcf = %{vcf_version} ladspa-MCP = %{MCP_version}
Obsoletes:      ladspa-swh-plugins < %{swh_version} ladspa-AMB < %{AMB_version} ladspa-FIL < %{FIL_version}
Obsoletes:      ladspa-REV < %{REV_version} ladspa-VCO < %{VCO_version} ladspa-alienwah < %{alienwah_version}
Obsoletes:      ladspa-caps < %{caps_version} ladspa-pvoc < %{pvoc_version} ladspa-tap-plugins < %{tap_version}
Obsoletes:      ladspa-vlevel < %{vlevel_version} ladspa-vocoder < %{vocoder_version} ladspa-blop < %{blop_version}
Obsoletes:      ladspa-vcf < %{vcf_version} ladspa-MCP < %{MCP_version}
Source1:        ladspa_sdk_1.13.tar.bz2
Source2:        cmt_src_1.15.tar.bz2
Source3:        swh-plugins-%{swh_version}.tar.bz2
Source4:        ladspa-swh.tex
Source5:        ladspa-swh.pdf
Source6:        vocoder-ladspa-%{vocoder_version}.tar.bz2
Source7:        alienwah-%{alienwah_version}.tar.bz2
Source8:        sooperlooper-%{sooperlooper_version}.tar.bz2
Source9:        blop-%{blop_version}.tar.bz2
Source10:       vcf-%{vcf_version}.tar.bz2
Source11:       unmatched.tar.bz2
Source12:       preamp-v2.tar.bz2
Source13:       MCP-plugins-%{MCP_version}.tar.bz2
Source14:       REV-plugins-%{REV_version}.tar.bz2
Source15:       vlevel-%{vlevel_version}.tar.bz2
Source16:       VCO-plugins-%{VCO_version}.tar.bz2
Source17:       matched.tar.bz2
Source18:       tap-plugins-%{tap_version}.tar.bz2
Source19:       super-60.tar.bz2
Source20:       caps_%{caps_version}.tar.bz2
Source21:       FIL-plugins-%{FIL_version}.tar.bz2
Source22:       pvoc_%{pvoc_version}.tar.bz2
Source23:       blepvco-%{blepvco_version}.tar.bz2
Source24:       AMB-plugins-%{AMB_version}.tar.bz2
Source30:       cmt.rdf
Source50:       README_VCF
Patch:          ladspa.dif
Patch1:         swh-uninit-variable.diff
Patch2:         cmt_src_1.15.diff
Patch3:         vocoder-0.1.dif
Patch4:         sooperlooper-0.9.dif
Patch5:         blop-automake-fix.dif
Patch6:         blop-shlib.diff
Patch7:         vcf-Makefile.dif
Patch8:         alienwah.dif
Patch9:         unmatched.dif
Patch10:        preamp.dif
Patch13:        tap-type-punning-fix.dif
Patch14:        super-60-fix.dif
Patch15:        swh-readonly.dif
Patch16:        pvoc-compile-fix.dif
Patch17:        swh-0.4.13-gcc4-fix.diff
Patch18:        sooperlooper-0.93-gcc4-fix.diff
Patch20:        swh-libblo.dif
# swh-configure.patch changes for >= autoconf-2.65 in openSUSE 11.3
%if 0%{?suse_version} <= 1120
Patch21:        swh-configure.patch
%else
Patch21:        swh-configure-2.65.patch
%endif
Patch22:        alienwah-compile-fix.diff
Patch23:        alienwah-float_complex.diff
Patch25:        pvoc-0.1.10-depend-copts-fix.diff
Patch26:        swh-nostatic-lib.diff
Patch27:        blop-ladspa_dir.diff
Patch28:        blop-wdautil-fix.diff
Url:            http://www.ladspa.org/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The Linux Audio Developer's Simple Plug-in API (LADSPA) provides the
ability to write simple plug-in audio processors in C/C++ and link them
dynamically.  The package contains the LADSPA SDK, the CMT plug-in
libraries (including Freeverb), and the swh plug-ins.



Authors:
--------
    Richard Furse <richard@muse.demon.co.uk>
    Jezar at Dreampoint <dreampoint.co.uk>
    Steve Harris <steve@plugin.org.uk>

%prep
#
# More URLs
#
# Blop: http://blop.sourceforge.net/
# MCP, REV, VCO, FIL, AMB-plugins:
#	http://users.skynet.be/solaris/linuxaudio/
# swh-plugins: http://plugin.org.uk/
# TAP-plugins URL: http://tap-plugins.sourceforge.net/
# vlevel: http://vlevel.sourceforge.net/about/
# sooperlooper: http://essej.net/sooperlooper/
# alienwah: http://plugin.org.uk/releases/alienwah/
# pvoc, caps, preamp, match, unmatched, super-60:
#	http://quitte.de/dsp/
# blepvco: http://home.jps.net/~musound/
#
%setup -q -c -n ladspa -T -a 1 -a 2 -a 3 -a 6 -a 7 -a 8 -a 9 -a 10 -a 11 -a 12 -a 13 -a 14 -a 15 -a 16 -a 17 -a 18 -a 19 -a 20 -a 21 -a 22 -a 23 -a 24
%patch
(cd swh-plugins-%{swh_version}
%patch1
%patch15
%patch17
%patch26 -p1
%patch20 -p1
touch config.rpath
./autogen.sh --prefix=%{_prefix}
%{?suse_update_config:%{suse_update_config -f}}
%patch21 -p 1
)
(cd cmt
%patch2
)
(cd vocoder-%{vocoder_version}
%patch3
)
(cd sooperlooper-%{sooperlooper_version}
%patch4
%patch18
)
(cd blop-%{blop_version}
%patch5
%patch6
%patch27
%patch28
%{?suse_update_config:%{suse_update_config -f}}
)
(cd vcf-%{vcf_version}
%patch7
)
(cd alienwah-%{alienwah_version}
%patch8
%patch22
%patch23
)
(cd unmatched
%patch9
)
(cd matched
# the same one with unmatched
%patch9
)
(cd preamp
%patch10
)
(cd tap-plugins-%{tap_version}
%patch13
)
(cd super-60
%patch14
)
(cd pvoc-%{pvoc_version}
%patch16
%patch25
)

%build
# This package failed when testing with -Wl,-as-needed being default.
# So we disable it here, if you want to retest, just delete this comment and the line below.
export SUSE_ASNEEDED=0
# LADSPA SDK
cd ladspa_sdk/src
make %{?jobs:-j%jobs} CFLAGS="$RPM_OPT_FLAGS -fPIC -ggdb" targets
cd ../..
# CMT
cd cmt/src
make %{?jobs:-j%jobs} CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fPIC -ggdb" targets
cd ../..
# SWH plugins
cd swh-plugins-%{swh_version}
#./autogen.sh --prefix=%{_prefix} --libdir=%{_libdir}
CFLAGS="$RPM_OPT_FLAGS -fPIC -ggdb -DPIC -fno-strict-aliasing" \
./configure --prefix=%{_prefix}
make %{?jobs:-j%jobs} CFLAGS="$RPM_OPT_FLAGS -fPIC -ggdb -DPIC -fno-strict-aliasing"
cd ..
# Vocoder
cd vocoder-%{vocoder_version}
make %{?jobs:-j%jobs} CFLAGS="$RPM_OPT_FLAGS -fPIC -ggdb"
cd ..
# Alien Wah
cd alienwah-%{alienwah_version}
make %{?jobs:-j%jobs} CFLAGS="$RPM_OPT_FLAGS -fPIC -ggdb"
cd ..
# Sooperlooper
cd sooperlooper-%{sooperlooper_version}
make %{?jobs:-j%jobs} CFLAGS="$RPM_OPT_FLAGS -fPIC -ggdb"
cd ..
# Blop
cd blop-%{blop_version}
autoreconf --install --force
./configure --prefix=%{_prefix} \
	    --with-ladspa-plugin-dir=%{_libdir}/ladspa
make %{?jobs:-j%jobs} CFLAGS="$RPM_OPT_FLAGS -DNO_DEBUG -DPIC -fPIC -ggdb"
cd ..
# VCF
cd vcf-%{vcf_version}
make %{?jobs:-j%jobs} CFLAGS="$RPM_OPT_FLAGS -fPIC -ggdb"
cd ..
# unmatched
cd unmatched
make %{?jobs:-j%jobs} CFLAGS="$RPM_OPT_FLAGS -fPIC -ggdb"
cd ..
# matched
cd matched
make %{?jobs:-j%jobs} CFLAGS="$RPM_OPT_FLAGS -fPIC -ggdb"
cd ..
# preamp
cd preamp
make %{?jobs:-j%jobs} CFLAGS="$RPM_OPT_FLAGS -fPIC -ggdb -fno-strict-aliasing" \
     CXXFLAGS="$RPM_OPT_FLAGS -fPIC -ggdb -fno-strict-aliasing"
cd ..
# MCP plugins
cd MCP-plugins-%{MCP_version}
make %{?jobs:-j%jobs} CXXFLAGS="$RPM_OPT_FLAGS -fPIC -ggdb"
cd ..
# REV plugins
cd REV-plugins-%{REV_version}
make %{?jobs:-j%jobs} CXXFLAGS="$RPM_OPT_FLAGS -fPIC -ggdb"
cd ..
# VCO plugins
cd VCO-plugins-%{VCO_version}
make %{?jobs:-j%jobs} CXXFLAGS="$RPM_OPT_FLAGS -fPIC -ggdb"
cd ..
# vlevel
cd vlevel-%{vlevel_version}
make %{?jobs:-j%jobs} CXXFLAGS="$RPM_OPT_FLAGS -fPIC -ggdb"
cd ..
# tap-plugins
cd tap-plugins-%{tap_version}
make %{?jobs:-j%jobs} CFLAGS="$RPM_OPT_FLAGS -fPIC -ggdb -c"
cd ..
# super-60
cd super-60
make %{?jobs:-j%jobs} CFLAGS="$RPM_OPT_FLAGS -ggdb -fPIC"
cd ..
# caps
cd caps-%{caps_version}
make %{?jobs:-j%jobs} CFLAGS="$RPM_OPT_FLAGS -ggdb -fPIC"
cd ..
# FIL plugins
cd FIL-plugins-%{FIL_version}
make %{?jobs:-j%jobs} CXXFLAGS="$RPM_OPT_FLAGS -ggdb -fPIC"
cd ..
# AMB plugins
cd AMB-plugins-%{AMB_version}
make %{?jobs:-j%jobs} CXXFLAGS="$RPM_OPT_FLAGS -ggdb -fPIC"
cd ..
# pvoc plugins
cd pvoc-%{pvoc_version}
make %{?jobs:-j%jobs} OPTS="$RPM_OPT_FLAGS -ggdb -fPIC"
cd ..
# blepvco
cd blepvco-%{blepvco_version}
make %{?jobs:-j%jobs} CPPFLAGS="$RPM_OPT_FLAGS -ggdb -fPIC"
cd ..

%install
# LADSPA SDK
cd ladspa_sdk/src
make INSTALL_PLUGINS_DIR="$RPM_BUILD_ROOT"%{_libdir}/ladspa \
     INSTALL_INCLUDE_DIR="$RPM_BUILD_ROOT"%{_includedir} \
     INSTALL_BINARY_DIR="$RPM_BUILD_ROOT"%{_bindir} install
cd ../..
# CMT
cd cmt/src
make INSTALL_PLUGINS_DIR="$RPM_BUILD_ROOT"%{_libdir}/ladspa install
cd ../..
# SWH plugins
cd swh-plugins-%{swh_version}
make DESTDIR="$RPM_BUILD_ROOT" plugindir=%{_libdir}/ladspa \
     INCLUDES=-I../ladspa_sdk/src install
cd ..
# Blop
cd blop-%{blop_version}
make DESTDIR="$RPM_BUILD_ROOT" install
cd ..
# Others
for i in \
  vocoder-%{vocoder_version} \
  alienwah-%{alienwah_version} \
  sooperlooper-%{sooperlooper_version} \
  vcf-%{vcf_version} \
  unmatched \
  matched \
  preamp \
  MCP-plugins-%{MCP_version} \
  REV-plugins-%{REV_version} \
  VCO-plugins-%{VCO_version} \
  vlevel-%{vlevel_version} \
  tap-plugins-%{tap_version} \
  super-60 \
  caps-%{caps_version} \
  FIL-plugins-%{FIL_version} \
  AMB-plugins-%{AMB_version} \
  pvoc-%{pvoc_version} \
  blepvco-%{blepvco_version}
do
  install -c $i/*.so "$RPM_BUILD_ROOT"%{_libdir}/ladspa
done
# install other binary execs
mkdir -p "$RPM_BUILD_ROOT"%{_bindir}
install -c -m 755 vlevel-%{vlevel_version}/vlevel-bin "$RPM_BUILD_ROOT"%{_bindir}
# additional RDF files
mkdir -p $RPM_BUILD_ROOT%{_datadir}/ladspa/rdf
cp -p %{SOURCE30} $RPM_BUILD_ROOT%{_datadir}/ladspa/rdf
cp tap-plugins-%{tap_version}/*.rdf $RPM_BUILD_ROOT%{_datadir}/ladspa/rdf
# install documents
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}/{cmt,swh,vcf}
cp -av cmt/README $RPM_BUILD_ROOT%{_docdir}/%{name}/cmt
cp -av cmt/doc/* $RPM_BUILD_ROOT%{_docdir}/%{name}/cmt
for i in \
   swh-plugins-%{swh_version} \
   vocoder-%{vocoder_version} \
   alienwah-%{alienwah_version} \
   sooperlooper-%{sooperlooper_version} \
   blop-%{blop_version} \
   MCP-plugins-%{MCP_version} \
   REV-plugins-%{REV_version} \
   VCO-plugins-%{VCO_version} \
   vlevel-%{vlevel_version} \
   preamp \
   tap-plugins-%{tap_version} \
   super-60 \
   caps-%{caps_version} \
   FIL-plugins-%{FIL_version} \
   AMB-plugins-%{AMB_version} \
   pvoc-%{pvoc_version} \
   blepvco-%{blepvco_version}
do
  # !! bashism...
  cd $i
  d=${i%-*}
  mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}/$d
  for f in AUTHORS README COPYRIGHT CREDITS COPYING NEWS THANKS TODO ChangeLog PARAMETERS *.html; do
    test -f $f && cp -a $f $RPM_BUILD_ROOT%{_docdir}/%{name}/$d
  done
  cd ..
done
# extra document files
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}/swh/gsm
cp -av swh-plugins-%{swh_version}/gsm/README $RPM_BUILD_ROOT%{_docdir}/%{name}/swh/gsm
cp %{SOURCE4} %{SOURCE5} $RPM_BUILD_ROOT%{_docdir}/%{name}/swh
cp %{SOURCE50} $RPM_BUILD_ROOT%{_docdir}/%{name}/vcf
cp -av vlevel-%{vlevel_version}/docs $RPM_BUILD_ROOT%{_docdir}/%{name}/vlevel
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}/examples/vlevel
cp -av vlevel-%{vlevel_version}/utils/* $RPM_BUILD_ROOT%{_docdir}/%{name}/examples/vlevel
chmod 644 $RPM_BUILD_ROOT%{_docdir}/%{name}/cmt/plugins.html
# remove incldue file (already in devel package)
rm -f $RPM_BUILD_ROOT%{_includedir}/*
%find_lang %{name} --all-name
%fdupes -s $RPM_BUILD_ROOT

%clean
rm -rf $RPM_BUILD_ROOT

%files -f %{name}.lang
%defattr(-,root,root)
%doc %{_docdir}/%{name}
%doc %{_docdir}/%{name}/examples
%{_libdir}/ladspa
%{_bindir}/*
%{_datadir}/ladspa

%changelog