File faust.spec of Package faust

#
# spec file for package faust
#
# Copyright (c) 2023 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/
#

%global _lto_cflags %{?_lto_cflags} -ffat-lto-objects
Name:           faust
Version:        2.75.7
Release:        0
Summary:        Functional Programming Language for Real Time Signal Processing
License:        GPL-2.0-only
Group:          Development/Languages/Other
URL:            https://faust.grame.fr/
Source:         https://github.com/grame-cncm/faust/releases/download/%{version}/%{name}-%{version}.tar.gz
Patch0:         01-fix-no-return.patch
Patch1:         02-disable-llvm-static.patch
Patch2:         03-support-for-LLVM19.patch
BuildRequires:  cmake
BuildRequires:  fdupes
BuildRequires:  gcc-c++
# BuildRequires:  libjacknet0
BuildRequires:  libmicrohttpd-devel
BuildRequires:  llvm-devel
Requires:       libfaust2

%description
Faust (Functional Audio Stream) is a functional programming language
specifically designed for real-time signal processing and synthesis.
A distinctive characteristic of Faust is to be fully compiled.

The Faust compiler translates DSP specifications into very efficient code for
various languages (C++, C, JAVA, JavaScript, ASM JavaScript, LLVM IR,
WebAssembly etc.) working at sample level. It targets high-performance signal
processing applications, libraries and audio plug-ins for a variety of audio
platforms and standards. A same Faust specification can be used to easily
generate various kinds of native standalone applications, iOS and Android apps,
as well as Csound, LADSPA, Max/MSP, PD, Q, SuperCollider, VST, AU plugins, etc.
(see the README in the /architecture folder for an exhaustive list).

%package devel
Summary:        Faust devel files
Group:          Development/Languages/Other
Requires:       %{name} = %{version}-%{release}
Requires:       libfaust2 = %{version}-%{release}

%description  devel
Devel files for embedding the Faust compiler in to your own application.

%package -n libfaust2
Summary:        Faust dynamic library
Group:          Development/Libraries/Other

%description -n libfaust2
Development files for embedding the Faust compiler in to your own application.

%package -n libHTTPDFaust0
Summary:        Faust HTTPD Library
Group:          Development/Libraries/Other

%description -n libHTTPDFaust0
Dynamic Faust HTTPD Library.

%package  -n libOSCFaust1
Summary:        Faust OSC Library
Group:          Development/Libraries/Other

%description -n libOSCFaust1
Dynamic Faust OSC Library.

%package  -n libfaustmachine0
Summary:        Faust Interpreter dynamic library
Group:          Development/Libraries/Other

%description -n libfaustmachine0
Dynamic Faust Interpreter library.

%prep
%autosetup -p1

%build
cd build
%cmake  \
%if %{defined fedora}
       -C backends/all.cmake \
%else
       -C ../backends/all.cmake \
%endif
       -DINCLUDE_DYNAMIC=ON \
       -DINCLUDE_STATIC=OFF \
       -DINCLUDE_LLVM=ON \
       -DINCLUDE_OSC=ON \
       -DINCLUDE_HTTP=ON \
       -DINCLUDE_ITP=ON \
       -DUSE_LLVM_CONFIG=ON \
       -DHTTPDYNAMIC=ON \
       -DOSCDYNAMIC=ON \
       -DITPDYNAMIC=ON \
       -DLIBSDIR=%{_lib}

%cmake_build

%install
for i in `grep -rl "%{_bindir}/env python3"`;do sed -i '1s/^#!.*/#!\/usr\/bin\/python3/' ${i} ;done
for i in `grep -rl "%{_bindir}/env ruby"`;do sed -i '1s/^#!.*/#!\/usr\/bin\/ruby/' ${i} ;done
for i in `grep -rl "%{_bindir}/env bash"`;do sed -i '1s/^#!.*/#!\/usr\/bin\/bash/' ${i} ;done

cd build
%cmake_install

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

%files
%license COPYING.txt
%doc README.md
%{_bindir}/*
%{_mandir}/man1/faust.1.gz

%files -n libfaust2
%{_libdir}/libfaust.so
%{_libdir}/libfaust.so.*

%files -n libfaustmachine0

%{_libdir}/libfaustmachine.so
%{_libdir}/libfaustmachine.so.*

%files -n libHTTPDFaust0
%{_libdir}/libHTTPDFaust.so
%{_libdir}/libHTTPDFaust.so.*

%files -n libOSCFaust1
%{_libdir}/libOSCFaust.so
%{_libdir}/libOSCFaust.so.*

%files devel
%exclude %{_libdir}/ios-libsndfile.a
%exclude %{_datadir}/faust/android/app/lib/libsndfile/lib/arm64-v8a/libsndfile.so
%exclude %{_datadir}/faust/android/app/lib/libsndfile/lib/armeabi-v7a/libsndfile.so
%exclude %{_datadir}/faust/max-msp/sndfile/arm/libsndfile.a
%exclude %{_datadir}/faust/max-msp/sndfile/intel/libsndfile.a
%{_includedir}/faust/
%{_datadir}/faust/
# %{_libdir}/libfaust.a
%{_libdir}/libHTTPDFaust.a
%{_libdir}/libOSCFaust.a
%{_libdir}/libfaustmachine.a

%post -n libfaust2 -p /sbin/ldconfig
%postun -n libfaust2 -p /sbin/ldconfig
%post -n libHTTPDFaust0 -p /sbin/ldconfig
%postun -n libHTTPDFaust0 -p /sbin/ldconfig
%post -n libOSCFaust1 -p /sbin/ldconfig
%postun -n libOSCFaust1 -p /sbin/ldconfig
%post -n libfaustmachine0 -p /sbin/ldconfig
%postun -n libfaustmachine0 -p /sbin/ldconfig

%changelog
openSUSE Build Service is sponsored by