File csound.spec of Package csound

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

%define rev 0dad8304c78efba48b4f405f4757f3e0a7e339c0

%define py3version %(pkg-config python3 --modversion)
%define support_fltk 1
%bcond_with python

%if 0%{?suse_version} > 1500
%bcond_with java
%bcond_with java

%define maj 6
%define min 0

Name:           csound
Version:        6.14.0+git20200601
Release:        0
Summary:        Computer Sound Synthesis and Composition Program
License:        LGPL-2.1-or-later AND GPL-2.0-or-later
Group:          Productivity/Multimedia/Sound/Utilities
Source0:        %{name}-%{version}.tar.xz
Source1:        README.SUSE
Source2:        COPYING_gpl2+.txt
# Default to using pulseaudio instead of portaudio
Patch2:         csound-6.08-default-pulse.patch
# Use xdg-open to open a browser to view the manual
Patch4:         csound-6.08-xdg-open.patch
Patch5:         csound-rename-sndinfo.patch
BuildRequires:  alsa-devel
BuildRequires:  bison
BuildRequires:  cmake
BuildRequires:  doxygen
BuildRequires:  eigen3-devel
BuildRequires:  fdupes
BuildRequires:  flex
BuildRequires:  fluidsynth-devel
BuildRequires:  gcc-c++
BuildRequires:  jack-devel
%if %{with java}
BuildRequires:  java-devel-openjdk
BuildRequires:  libboost_atomic-devel
BuildRequires:  libboost_filesystem-devel
BuildRequires:  libboost_locale-devel
BuildRequires:  libboost_regex-devel
BuildRequires:  libboost_thread-devel
BuildRequires:  liblo-devel
BuildRequires:  libsndfile-devel
BuildRequires:  lua-devel
BuildRequires:  portaudio-devel
BuildRequires:  swig
%if %{with python}
BuildRequires:  python3-devel
%if %support_fltk
BuildRequires:  fltk-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  xorg-x11-devel
Recommends:     %{name}-lang
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%global luaver %(lua -v | sed -r 's/Lua ([[:digit:]]+\\.[[:digit:]]+).*/\\1/')
Csound is a software synthesis program. It is modular and
supports an unlimited amount of oscillators and filters.

%package -n libcsnd6-%{maj}_%{min}
Summary:        Computer sound synthesis and composition library
Group:          System/Libraries

%description -n libcsnd6-%{maj}_%{min}
Library for csound use.
Csound is a software synthesis program supporting oscillators and

%package -n libcsound64-%{maj}_%{min}
Summary:        Computer sound synthesis and composition library
Group:          System/Libraries

%description -n libcsound64-%{maj}_%{min}
Library for csound use
Csound is a software synthesis program supporting oscillators and

%package java-bindings
Summary:        Java bindings for the Csound sound synthesis and composition library
Group:          System/Libraries

%description java-bindings
Java bindings for csound use.
Csound is a software synthesis program supporting oscillators and

%package plugins
Summary:        Plugins for csound
Group:          Productivity/Multimedia/Other

%description plugins
Plugins for csound

%package devel
Summary:        Development files for Csound
Group:          Development/Libraries/C and C++
%if %{with java}
Requires:       %{name}-java-bindings = %{version}
Requires:       libcsnd6-%{maj}_%{min} = %{version}
Requires:       libcsound64-%{maj}_%{min} = %{version}

%description devel
Development files for Csound, a sound synthesis program.


%setup -q
%autopatch -p1
# remove __DATE__ from source files, causes unnecessary rebuilds
sed -i 's:__DATE__:"":' Engine/musmon.c include/version.h Top/main.c
# copy readme
cp %{SOURCE1} %{SOURCE2} .
#These source files are undistributable
#rm -f Opcodes/scansyn*
head -n 28 util/SDIF/sdif.c > COPYING.PostgreSQL

# Needed to link
export CFLAGS="%{optflags} -lm"
export CXXFLAGS="%{optflags} -std=c++11"

%cmake \
%if %{with python}
       -DPYTHON_LIBRARY="%{_libdir}/libpython$(pkg-config python3 --modversion)$(python3-config --abiflags).so" \
       -DPYTHON_INCLUDE_DIR="%{_includedir}/python$(pkg-config python3 --modversion)$(python3-config --abiflags)" \
       -DRPM_LUAVER:STRING=%{luaver} \
%if "%{_lib}" == "lib64"

make %{_smp_mflags}

#python bindings are wip
rm -rf %{buildroot}root
cp -v OOps/ README.OOps

%fdupes -s %{buildroot}
%find_lang %{name}%{maj}

%post -n libcsnd6-%{maj}_%{min} -p /sbin/ldconfig
%postun -n libcsnd6-%{maj}_%{min} -p /sbin/ldconfig

%post -n libcsound64-%{maj}_%{min} -p /sbin/ldconfig
%postun -n libcsound64-%{maj}_%{min} -p /sbin/ldconfig

%post java-bindings -p /sbin/ldconfig
%postun java-bindings -p /sbin/ldconfig

%license COPYING COPYING_gpl2+.txt COPYING.PostgreSQL

%files -n libcsnd6-%{maj}_%{min}

%files -n libcsound64-%{maj}_%{min}

%if %{with java}
%files java-bindings

%files plugins

%files devel

%files lang -f %{name}%{maj}.lang

openSUSE Build Service is sponsored by