File hydrogen.spec of Package hydrogen

# spec file for package hydrogen
# 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

%define soversion 0
%define soage 0
%define sorevision 0
# WARNING: ATM librubberband2 support is experimental currently it is recommended that you disable
# this config option to ensure backwards compatibility with songs created under 0.9.5 which use
# rubberband. Use the rubberband -cli package instead.
%define librubberband 0

Name:           hydrogen
BuildRequires:  alsa-devel
BuildRequires:  cmake
BuildRequires:  doxygen
BuildRequires:  fdupes
BuildRequires:  flac-devel
BuildRequires:  gcc-c++
BuildRequires:  help2man
BuildRequires:  hicolor-icon-theme
BuildRequires:  ladspa
BuildRequires:  ladspa-devel
BuildRequires:  lash-devel
BuildRequires:  libarchive-devel
BuildRequires:  libjack-devel
BuildRequires:  liblrdf-devel
BuildRequires:  libqt4-devel
BuildRequires:  libraptor-devel
BuildRequires:  libsndfile-devel
BuildRequires:  pkg-config
BuildRequires:  portaudio-devel
BuildRequires:  rsync
BuildRequires:  subversion
BuildRequires:  update-desktop-files
BuildRequires:  util-linux
BuildRequires:  zlib-devel
BuildRequires:  pkgconfig(Qt3Support)
BuildRequires:  pkgconfig(QtCLucene)
BuildRequires:  pkgconfig(QtCore)
BuildRequires:  pkgconfig(QtDBus)
BuildRequires:  pkgconfig(QtDeclarative)
BuildRequires:  pkgconfig(QtDesigner)
BuildRequires:  pkgconfig(QtDesignerComponents)
BuildRequires:  pkgconfig(QtGui)
BuildRequires:  pkgconfig(QtHelp)
BuildRequires:  pkgconfig(QtMultimedia)
BuildRequires:  pkgconfig(QtNetwork)
BuildRequires:  pkgconfig(QtOpenGL)
BuildRequires:  pkgconfig(QtScript)
BuildRequires:  pkgconfig(QtScriptTools)
BuildRequires:  pkgconfig(QtSql)
BuildRequires:  pkgconfig(QtSvg)
BuildRequires:  pkgconfig(QtTest)
BuildRequires:  pkgconfig(QtUiTools)
BuildRequires:  pkgconfig(QtXml)
BuildRequires:  pkgconfig(QtXmlPatterns)

#%%if 0%%{?suse_version} <= 1140
#BuildRequires:  libqt4-devel-doc-data
%if 0%{?librubberband} == 1
BuildRequires:  librubberband-devel
Requires:       rubberband-cli
BuildRequires:  rubberband-cli
Summary:        A Real-Time Drum Machine and Sequencer
License:        GPL-2.0+
Group:          Productivity/Multimedia/Sound/Midi
# NOTE: Don't forget to update the libsuffix macro.
Version:        0.9.6
Release:        0
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source0:        %{name}-%{version}.tar.bz2
Source1:        hydrogen.1
Source2:        h2cli.1
Source3:        COPYING
# Fixup the desktop file.
Patch0:         hydrogen-0.9.6-desktop.patch
# Remove current date and time from sources.
Patch1:         hydrogen-no-current-time.patch
# libhydrogencore has no soname and installs in _libexecdir
Patch2:         hydrogen-0.9.6-lib64.patch
# PATCH-FIX-UPSTREAM hydrogen-gcc47.patch -- Fix build with gcc 4.7.
Patch3:         hydrogen-gcc47.patch

Hydrogen is an advanced drum machine for GNU/Linux.
It's main goal is to bring professional yet simple and intuitive
pattern-based drum programming. sequencer MIDI input.
Very user-friendly, modular, fast and intuitive graphical
interface based on QT4.
Sample-based stereo audio engine, with import of sound samples
in .wav, .au and .aiff formats.
Pattern-based sequencer, with unlimited number of patterns and
ability to chain patterns into a song.
Up to 64 ticks per pattern with individual level per event and
variable pattern length.
32 instrument tracks with volume, mute, solo, pan capabilities.
Multi layer support for instruments (up to 16 samples for each
Ability to import/export song files.
Unique human velocity, human time, pitch and swing functions.
Multiple patterns playing at once.
JACK, ALSA, PortAudio and OSS audio drivers.
ALSA MIDI input with assignable midi-in channel (1..16, ALL).
Import/export of drumkits.
Export song to wav file.
Export song to midi file.

%package -n libhydrogen-core%{soversion}
Summary:        Library essential for hydrogen
Group:          System/Libraries

%description -n libhydrogen-core%{soversion}
This is the core of hydrogen's operation.

%package -n libhydrogen-core-devel
Summary:        Development files and headers for libhydrogen-core
Group:          Development/Libraries/C and C++
Requires:       libhydrogen-core%{soversion} = %{version}-%{release}

%description -n libhydrogen-core-devel
These are the headers needed to develop apps that
link with libhydrogen-core.

%setup -q

# copy licence with correct fsf address
install -m 0644 %{S:3} ./


mkdir -p Build && pushd Build
cmake -L ../ -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
	-DCMAKE_CXX_FLAGS:STRING="%{optflags} -ggdb" \
	-DCMAKE_C_FLAGS:STRING="%{optflags} -ggdb" \
	-DLADSPA_INCLUDE_DIR:PATH=%{_includedir} \
	-DLADSPA_LIBRARIES:PATH=%{_libdir}/ladspa \
	-Dcoreversion:STRING=%{soversion} \
	-Dsoage:STRING=%{soage} \
	-Dsorevision:STRING=%{sorevision} \

# For some reason cmake won't produce a correct soname with only the version so this is a hack to fix it.
pushd src/core/CMakeFiles/hydrogen-core.dir && \
cat link.txt|sed 's/-soname,,'>\
link.txt~;mv link.txt~ link.txt

cat relink.txt|sed 's/-soname,,'>\
relink.txt~;mv relink.txt~ relink.txt


make %{?_smp_mflags}

# LD_LIBRARY_PATH=%%{_libdir}/mpi/gcc/openmpi/%%{_lib}
# LD_RUN_PATH=%%{_libdir}



#export QTDIR=%%{_libdir}/qt4/
pushd Build
%makeinstall VERBOSE_MAKEFILE=1
# libhydrogen-core's internal SONAME = so we provide a link.
cd %{buildroot}%{_libdir} && ln -s

# Install the man pages created by help2man
mkdir -p %{buildroot}%{_mandir}/man1
install -pm 0644 %{S:1} %{S:2} %{buildroot}%{_mandir}/man1/

# temporary link i18n files from usr/share/hydrogen/data/i18n to _datadir/locale for find_lang to find.
ln -s %{_datadir}/hydrogen/data/i18n %{buildroot}%{_datadir}/locale
%find_lang %{name} %{name}.lang --without-kde --with-qt --all-name --without-mo
rm -rf %{buildroot}%{_datadir}/locale
cat %{name}.lang

# Set executable bit on scripts in buildroot/_datadir/name/data/i18n
for i in $(find %{buildroot}%{_datadir}/hydrogen/data/i18n -type f -perm 0644 -print0|xargs -0r grep -l '#!'); \
do chmod 0755 ${i}; done

%fdupes -s %{buildroot}%{_datadir}

# Make icon avalable for desktop file
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/ \
&& pushd %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/
ln -s ../../../../%{name}/data/img/gray/h2-icon.svg h2-icon.svg
popd && %suse_update_desktop_file -i %{name} AudioVideo Sequencer

update-desktop-database &> /dev/null || :

update-desktop-database &> /dev/null || :

%files -f %{name}.lang
%defattr(-, root, root)
%dir %{_datadir}/%{name}/*
%dir %{_datadir}/%{name}

%post -n libhydrogen-core%{soversion} -p /sbin/ldconfig

%postun -n libhydrogen-core%{soversion} -p /sbin/ldconfig

%files -n libhydrogen-core%{soversion}
%defattr(-, root, root)

%files -n libhydrogen-core-devel
%defattr(-, root, root)
%dir %{_includedir}/%{name}