File hydrogen.spec of Package hydrogen

#
# spec file for package hydrogen
#
# Copyright (c) 2024 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


%bcond_with lash
# The use of librubberband2 is marked as experimental.
# Because the current implementation produce wrong timing!
# So long this bug isn't solved, please disable this option.
# If rubberband-cli is installed, the hydrogen rubberband-function
# will work properly as expected.
%bcond_with librubberband
Name:           hydrogen
Version:        1.2.2+git.107.2aec080
%define soversion 1_2_2
Release:        0
Summary:        A Real-Time Drum Machine and Sequencer
License:        GPL-2.0-or-later
Group:          Productivity/Multimedia/Sound/Midi
URL:            http://www.hydrogen-music.org/
Source0:        https://github.com/hydrogen-music/hydrogen/archive/%{version}/%{name}-%{version}.tar.gz
Patch2:         release-version.patch
BuildRequires:  cmake
BuildRequires:  fdupes
BuildRequires:  help2man
BuildRequires:  hicolor-icon-theme
BuildRequires:  ladspa
BuildRequires:  ladspa-devel
BuildRequires:  libtar-devel
BuildRequires:  pkgconfig
BuildRequires:  portmidi-devel
BuildRequires:  update-desktop-files
BuildRequires:  cmake(Qt5Concurrent)
BuildRequires:  cmake(Qt5Core) >= 5.6
BuildRequires:  cmake(Qt5DBus)
BuildRequires:  cmake(Qt5Gui)
BuildRequires:  cmake(Qt5LinguistTools)
BuildRequires:  cmake(Qt5Network)
BuildRequires:  cmake(Qt5OpenGL)
BuildRequires:  cmake(Qt5Sql)
BuildRequires:  cmake(Qt5Svg)
BuildRequires:  cmake(Qt5Test)
BuildRequires:  cmake(Qt5Widgets)
BuildRequires:  cmake(Qt5X11Extras)
BuildRequires:  cmake(Qt5Xml)
BuildRequires:  cmake(Qt5XmlPatterns)
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(flac)
BuildRequires:  pkgconfig(jack)
BuildRequires:  pkgconfig(libarchive)
BuildRequires:  pkgconfig(liblo)
BuildRequires:  pkgconfig(libpulse)
BuildRequires:  pkgconfig(lrdf)
BuildRequires:  pkgconfig(portaudio-2.0)
BuildRequires:  pkgconfig(raptor2)
BuildRequires:  pkgconfig(sndfile)
BuildRequires:  pkgconfig(zlib)
%if 0%{?suse_version} <= 1500
BuildRequires:  gcc9
BuildRequires:  gcc9-c++
%else
BuildRequires:  gcc-c++
%endif
%if %{with lash}
BuildRequires:  pkgconfig(lash-1.0)
%endif
%if %{with librubberband}
BuildRequires:  pkgconfig(rubberband)
%else
BuildRequires:  rubberband-cli
Requires:       rubberband-cli
%endif

%description
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 QT5, 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
BuildArch:      noarch
Summary:        Development files and headers for libhydrogen-core
Group:          Development/Libraries/C and C++
Requires:       libhydrogen-core-%{soversion} = %{version}

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

%prep
%autosetup -p1

%build
export LADSPA_PATH=%{_libdir}/ladspa

cmake -B build -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_BINDIR:PATH=bin -DCMAKE_INSTALL_SBINDIR:PATH=sbin \
-DCMAKE_INSTALL_LIBEXECDIR:PATH=libexec -DCMAKE_INSTALL_SYSCONFDIR:PATH=etc -DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=/var/lib \
-DCMAKE_INSTALL_LOCALSTATEDIR:PATH=var -DCMAKE_INSTALL_RUNSTATEDIR:PATH=run -DCMAKE_INSTALL_LIBDIR:PATH=lib64 -DCMAKE_INSTALL_INCLUDEDIR:PATH=include \
-DCMAKE_INSTALL_DATAROOTDIR:PATH=share -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc \
-DSHARE_INSTALL_PREFIX:PATH=/usr/share -DCMAKE_BUILD_TYPE=RelWithDebInfo \
'-DCMAKE_C_FLAGS=-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g' \
'-DCMAKE_CXX_FLAGS=-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g' \
'-DCMAKE_EXE_LINKER_FLAGS=-flto=auto -Wl,--as-needed -Wl,-z,now' \
'-DCMAKE_MODULE_LINKER_FLAGS=-flto=auto -Wl,--as-needed' '-DCMAKE_SHARED_LINKER_FLAGS=-flto=auto -Wl,--as-needed -Wl,-z,now' -DLIB_SUFFIX=64 \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_STATIC_LIBS:BOOL=OFF -DCMAKE_COLOR_MAKEFILE:BOOL=OFF -DCMAKE_INSTALL_DO_STRIP:BOOL=OFF \
-DCMAKE_MODULES_INSTALL_DIR=/usr/lib64/cmake/hydrogen -DWANT_LIBARCHIVE:BOOL=ON -DWANT_LRDF:BOOL=ON -DWANT_PORTAUDIO:BOOL=ON -DWANT_PORTMIDI:BOOL=ON -DWANT_SHARED:BOOL=ON

cmake --build build

%install
%cmake_install

# Install the h2cli man page created by help2man
install -d -m 0755 %{buildroot}%{_mandir}/man1
LD_LIBRARY_PATH=%{buildroot}%{_libdir} \
	help2man -N -o %{buildroot}%{_mandir}/man1/h2cli.1 %{buildroot}%{_bindir}/h2cli

%suse_update_desktop_file -i org.hydrogenmusic.Hydrogen AudioVideo Sequencer

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

%find_lang %{name} --with-qt

%files -f %{name}.lang
%license COPYING
%doc AUTHORS ChangeLog README.md
%{_bindir}/*
%{_datadir}/%{name}
%{_datadir}/applications/org.hydrogenmusic.Hydrogen.desktop
%{_datadir}/icons/hicolor/scalable/apps/*.svg
%{_datadir}/metainfo/org.hydrogenmusic.Hydrogen.metainfo.xml
%{_mandir}/man1/h2cli.1%{?ext_man}
%{_mandir}/man1/hydrogen.1%{?ext_man}

%files -n libhydrogen-core-%{soversion}
%{_libdir}/libhydrogen-core-1.2.2.so

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

%changelog
openSUSE Build Service is sponsored by