File Bad-Circuit-Modelling.spec of Package Bad-Circuit-Modelling

#
# spec file for package Bad-Circuit-Modelling
#
# 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/
#


Name:           Bad-Circuit-Modelling
Version:        20201208
Release:        0
Summary:        Correct modelling of incorrect circuits
License:        MIT
Group:          Productivity/Multimedia/Sound/Utilities
URL:            https://github.com/jatinchowdhury18/Bad-Circuit-Modelling
Source0:        %{name}-%{version}.tar.xz
Patch0:         01-juce-5.4.7.patch
BuildRequires:  JUCE-Projucer
BuildRequires:  JUCE-devel
BuildRequires:  Mesa-libGL-devel
BuildRequires:  gcc-c++
BuildRequires:  ladspa-devel
BuildRequires:  libXcursor-devel
BuildRequires:  libXrandr-devel
BuildRequires:  libcurl-devel
BuildRequires:  libjack-devel
BuildRequires:  pkgconfig
BuildRequires:  xorg-x11-server
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(jack)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xext)
BuildRequires:  pkgconfig(xinerama)
Requires:       alsa

%description
The idea is to model realistic variations in circuits, caused by things like imperfect components, age, temperature, etc.

%package -n vst-%{name}
Summary:        %summary (VST)

%description -n vst-%{name}
The idea is to model realistic variations in circuits, caused by things like imperfect components, age, temperature, etc.

%prep
%autosetup -p1

%build

%define _lto_cflags %{nil}
%define X_display ":98"

#############################################
### Launch a virtual framebuffer X server ###
#############################################
export DISPLAY=%{X_display}
Xvfb %{X_display} >& Xvfb.log &
trap "kill $! || true" EXIT
#sleep 10

Projucer --set-global-search-path linux defaultJuceModulePath %{_datadir}/juce/modules

for Dir in `find . -maxdepth 1 -type d`
do
    if [ -d $Dir/Plugin ]
        then
        name="${Dir:2}"
        pushd $Dir/Plugin
        sed -i -e 's/useGlobalPath="0"/useGlobalPath="1"/' $name.jucer
        sed -i -e 's/JUCEOPTIONS/JUCEOPTIONS JUCE_JACK="1" JUCE_WEB_BROWSER="0" JUCE_USE_CURL="0"/' $name.jucer
        sed -i -e 's/LINUX_MAKE targetFolder="Builds\/LinuxMakefile"/LINUX_MAKE targetFolder="Builds\/LinuxMakefile" extraCompilerFlags="-fvisibility=hidden" extraLinkerFlags="-fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,--strip-all"/' $name.jucer
        Projucer --resave $name.jucer
        popd
    fi
done

for Dir in `find . -maxdepth 1 -type d`
do
    if [ -d $Dir/Plugin ]
        then
        name="${Dir:2}"
        pushd $Dir/Plugin/Builds/LinuxMakefile
        TARGET_ARCH=-Wl,--as-needed CONFIG=Release make %{?_smp_mflags}
        popd
    fi
done

%install
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_libdir}/vst

for Dir in `find . -maxdepth 1 -type d`
do
    if [ -d $Dir/Plugin ]
        then
        name="${Dir:2}"
        pushd $Dir/Plugin/Builds/LinuxMakefile
        install build/$name %{buildroot}%{_bindir}/
        install build/$name.so %{buildroot}%{_libdir}/vst/
        popd
    fi
done

%files
%{_bindir}/*
%doc README.md
%license LICENSE

%files  -n vst-%{name}
%dir %{_libdir}/vst
%{_libdir}/vst/*.so
%doc README.md
%license LICENSE

%changelog
openSUSE Build Service is sponsored by