File hydrogen.spec of Package hydrogen

# spec file for package hydrogen
# Copyright (c) 2018 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

%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
Version:        0.9.7
Release:        0
Summary:        A Real-Time Drum Machine and Sequencer
# NOTE: Don't forget to update the libsuffix macro.
License:        GPL-2.0+
Group:          Productivity/Multimedia/Sound/Midi
Source0:        %{name}-%{version}.tar.gz
Source1:        h2cli.1
Source2:        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
BuildRequires:  cmake
BuildRequires:  doxygen
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  help2man
BuildRequires:  hicolor-icon-theme
BuildRequires:  ladspa
BuildRequires:  ladspa-devel
BuildRequires:  pkgconfig
BuildRequires:  update-desktop-files
BuildRequires:  util-linux
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)
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(flac)
BuildRequires:  pkgconfig(flac++)
BuildRequires:  pkgconfig(jack)
BuildRequires:  pkgconfig(libarchive)
BuildRequires:  pkgconfig(libpulse)
BuildRequires:  pkgconfig(lrdf)
BuildRequires:  pkgconfig(portaudio-2.0)
BuildRequires:  pkgconfig(raptor2)
BuildRequires:  pkgconfig(sndfile)
BuildRequires:  pkgconfig(zlib)
#%%if 0%%{?suse_version} <= 1140
#BuildRequires:  libqt4-devel-doc-data
%if 0%{?librubberband} == 1
BuildRequires:  pkgconfig(rubberband)
BuildRequires:  rubberband-cli
Requires:       rubberband-cli

Hydrogen is a software synthesizer which can be used alone, emulating
a drum machine based on patterns, or via an external MIDI
keyboard/sequencer software.

It features a modular and graphical interface based on QT4, has a
sample-based stereo audio engine, with import of sound samples in PCM
formats. Furthermore, a pattern-based sequencer with the ability to
chain patterns into a song. Up to 64 ticks per pattern with
individual level per event and variable pattern length are possible.
32 instrument tracks with volume, mute, solo, pan capabilities are
provided, and there is multi-layer support for instruments (up to 16
samples for each instrument). Human velocity, human time, pitch and
swing functions are implemented as well.

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

%description -n libhydrogen-core%{soversion}
Hydrogen is a software synthesizer which can be used alone, emulating
a drum machine based on patterns, or via an external MIDI
keyboard/sequencer software.

This library 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 %{SOURCE2} ./


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
%make_install VERBOSE_MAKEFILE=1
# libhydrogen-core's internal SONAME = so we provide a link.
cd %{buildroot}%{_libdir} && ln -s

# Install the h2cli man page created by help2man
mkdir -p %{buildroot}%{_mandir}/man1
install -pm 0644 %{SOURCE1} %{buildroot}%{_mandir}/man1/
# Move hydrogen man page to the correct directory
mv %{buildroot}%{_prefix}/man/man1/hydrogen.1 %{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
rm -f %{buildroot}%{_datadir}/hydrogen/data/i18n/

%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



%files -f %{name}.lang
%doc AUTHORS ChangeLog README.txt
%license COPYING
%dir %{_datadir}/%{name}/*
%dir %{_datadir}/%{name}
%dir %{_datadir}/appdata

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

%files -n libhydrogen-core%{soversion}

%files -n libhydrogen-core-devel
%dir %{_includedir}/%{name}

openSUSE Build Service is sponsored by