Files
haikuports/media-sound/csound/csound-6.18.1.recipe

219 lines
4.9 KiB
Bash

SUMMARY="A sound processing language and software synthesizer"
DESCRIPTION="Csound is a user-programmable and user-extensible sound processing \
language and software synthesizer. It is not restricted to any style of music, \
having been used for many years in at least classical, pop, techno, and ambient."
HOMEPAGE="https://github.com/csound/csound"
COPYRIGHT="1991-2020 The Csound Developers"
LICENSE="GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="$HOMEPAGE/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="b84be8237fa9258ef60fdddf36fae27b20c11665811bf5ed12540da9a9a4414e"
SOURCE_FILENAME="csound-$portVersion.tar.gz"
PATCHES="csound-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
libVersion="6.0"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
# --> Recipe options:
luaBindings=false # Currently not working.
luaVersion=5.1
pythonBindings=false
pythonVersion=3.10
# Build standalone commmands for things that otherwise can be called via: "csound -U <utility name>".
standaloneUtilities=false
# Build just the basics, with only libsndfile as dependency, or everything *and* the kitchen sink?
kitchenSink=false
# <--
PROVIDES="
csound$secondaryArchSuffix = $portVersion
cmd:cs
cmd:csb64enc
cmd:csbeats
cmd:csdebugger
cmd:csound
cmd:extract
cmd:makecsd
cmd:scot
cmd:scsort
cmd:sdif2ad
lib:libcsnd6$secondaryArchSuffix = $libVersionCompat
lib:libcsound64$secondaryArchSuffix = $libVersionCompat
"
if $standaloneUtilities; then
PROVIDES+="
cmd:atsa
cmd:csanalyze
cmd:cvanal
cmd:dnoise
cmd:envext
cmd:extractor
cmd:het_export
cmd:het_import
cmd:hetro
cmd:lpanal
cmd:lpc_export
cmd:lpc_import
cmd:mixer
cmd:pv_export
cmd:pv_import
cmd:pvanal
cmd:pvlook
cmd:scale
cmd:sndinfo
cmd:srconv
"
fi
REQUIRES="
haiku$secondaryArchSuffix
lib:libsndfile$secondaryArchSuffix
"
PROVIDES_devel="
csound${secondaryArchSuffix}_devel = $portVersion
devel:libcsnd6$secondaryArchSuffix = $libVersionCompat
devel:libcsound64$secondaryArchSuffix = $libVersionCompat
"
REQUIRES_devel="
csound$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libsndfile$secondaryArchSuffix # the only dependency required for a basic Csound build.
"
BUILD_PREREQUIRES="
cmd:bison
cmd:cmake
cmd:flex
cmd:gcc$secondaryArchSuffix
cmd:make
cmd:pkg_config$secondaryArchSuffix
"
if $kitchenSink; then
PROVIDES+="
cmd:src_conv # requires libsamplerate
"
REQUIRES+="
# lib:libfluidsynth$secondaryArchSuffix
lib:libintl$secondaryArchSuffix
lib:liblo$secondaryArchSuffix
lib:libsamplerate$secondaryArchSuffix
"
BUILD_REQUIRES+="
# devel:libfluidsynth$secondaryArchSuffix < 2 # we don't have v1 _devel anymore.
devel:libintl$secondaryArchSuffix # to enable usage of gettext
devel:liblo$secondaryArchSuffix
devel:libsamplerate$secondaryArchSuffix
"
BUILD_PREREQUIRES+="
cmd:msgmerge$secondaryArchSuffix # gettext
"
maybeLocaleDir=-DCMAKE_INSTALL_LOCALEDIR=$dataDir/locale
fi
if $luaBindings; then
PROVIDES+="
lib:luaCsnd6$secondaryArchSuffix
"
PROVIDES_devel+="
devel:luaCsnd6$secondaryArchSuffix
"
REQUIRES="
lib:liblua$secondaryArchSuffix
"
BUILD_REQUIRES+="
devel:liblua$secondaryArchSuffix >= $luaVersion
"
BUILD_PREREQUIRES+="
cmd:swig
"
# This doesn't seems to help, getting:
# "make[2]: *** No rule to make target 'lua.so.5.1', needed by 'luaCsnd6.so'. Stop."
# and without it, LUA bindings are disabled because LUA_LIBRARY is not found.
maybeLUALibrary=-DLUA_LIBRARY=lua.so.5.1
defineDebugInfoPackage csound$secondaryArchSuffix \
$libDir/luaCsnd6.so
fi
maybePythonModulesDir=
if $pythonBindings; then
pythonPackage=python${pythonVersion//.}
eval "PROVIDES_$pythonPackage=\"
${portName}_$pythonPackage
\""
eval "REQUIRES_$pythonPackage=\"
csound$secondaryArchSuffix == $portVersion base
numpy_$pythonPackage
cmd:python$pythonVersion
\""
BUILD_PREREQUIRES+="
cmd:python$pythonVersion
cmd:swig
"
pythonModuleDir="$prefix/lib/python$pythonVersion/vendor-packages"
maybePythonModulesDir=-DPYTHON3_MODULE_INSTALL_DIR=$pythonModuleDir
fi
BUILD()
{
mkdir -p build && cd build
maybeStandaloneUtilities=
if ! $standaloneUtilities; then
maybeStandaloneUtilities=-DBUILD_UTILITIES=OFF
fi
cmake .. $cmakeDirArgs \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_MODULEDIR=$dataDir/cmake/Modules/Csound \
-DCMAKE_SHARED_LINKER_FLAGS="-lnetwork" \
-DCMAKE_SKIP_INSTALL_RPATH=YES \
-DCMAKE_SKIP_RPATH=YES \
$maybeLocaleDir \
$maybeLUALibrary \
$maybePythonModulesDir \
$maybeStandaloneUtilities \
-DUSE_GIT_COMMIT=OFF
make $jobArgs
}
INSTALL()
{
cd build
make install
prepareInstalledDevelLibs \
libcsnd6 \
libcsound64
if $luaBindings; then
prepareInstalledDevelLib \
luaCsnd6
fi
if $pythonBindings; then
packageEntries $pythonPackage \
$pythonModuleDir/*.py
fi
packageEntries devel \
$developDir \
$dataDir/cmake
}