addpkg(main/faust): A functional programming language for signal processing and sound synthesis

This commit is contained in:
Al-buharie Amjari 2024-03-22 14:57:37 +08:00 committed by Jia Yuan Lo
parent 070e99cba6
commit 338f8257ce
5 changed files with 191 additions and 0 deletions

View File

@ -0,0 +1,11 @@
--- faust-2.70.3/architecture/osclib/faust/src/threads/pthreads_impl.cpp 2024-01-27 14:11:37.678044497 +0800
+++ faust-2.70.3.mod/architecture/osclib/faust/src/threads/pthreads_impl.cpp 2024-01-27 14:11:18.190044511 +0800
@@ -73,7 +73,7 @@
//_____________________________________________________________________
void TThreads::quit ()
{
-#ifndef android
+#if !defined(android) && !defined(__ANDROID__)
if (fThread) {
void *threadRet;
pthread_cancel (fThread);

View File

@ -0,0 +1,18 @@
--- faust-2.70.3/build/backends/light.cmake 2024-01-05 16:34:56.000000000 +0800
+++ faust-2.70.3.mod/build/backends/light.cmake 2024-01-31 12:28:12.706051668 +0800
@@ -8,12 +8,13 @@
# WASM embed the backend in the faust wasm library
set ( C_BACKEND COMPILER STATIC DYNAMIC CACHE STRING "Include C backend" FORCE )
+set ( CODEBOX_BACKEND COMPILER STATIC DYNAMIC CACHE STRING "Include Codebox backend" FORCE )
set ( CPP_BACKEND COMPILER STATIC DYNAMIC CACHE STRING "Include CPP backend" FORCE )
set ( CMAJOR_BACKEND OFF CACHE STRING "Include Cmajor backend" FORCE )
set ( CSHARP_BACKEND OFF CACHE STRING "Include CSharp backend" FORCE )
set ( DLANG_BACKEND OFF CACHE STRING "Include Dlang backend" FORCE )
-set ( FIR_BACKEND OFF CACHE STRING "Include FIR backend" FORCE )
-set ( INTERP_BACKEND OFF CACHE STRING "Include Interpreter backend" FORCE )
+set ( FIR_BACKEND COMPILER STATIC DYNAMIC CACHE STRING "Include FIR backend" FORCE )
+set ( INTERP_BACKEND COMPILER STATIC DYNAMIC CACHE STRING "Include Interpreter backend" FORCE )
set ( JAVA_BACKEND OFF CACHE STRING "Include JAVA backend" FORCE )
set ( JAX_BACKEND OFF CACHE STRING "Include JAX backend" FORCE )
set ( JULIA_BACKEND OFF CACHE STRING "Include Julia backend" FORCE )

101
packages/faust/build.sh Normal file
View File

@ -0,0 +1,101 @@
TERMUX_PKG_HOMEPAGE=https://github.com/grame-cncm/faust
TERMUX_PKG_DESCRIPTION="A functional programming language for signal processing and sound synthesis"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=2.70.3
_FAUSTLIB_COMMIT=2a5b4ab36e5d47f7e56277b19f41892bcf6378f4
TERMUX_PKG_SRCURL=(https://github.com/grame-cncm/faust/archive/refs/tags/${TERMUX_PKG_VERSION}.tar.gz
https://github.com/grame-cncm/faustlibraries/archive/${_FAUSTLIB_COMMIT}.zip)
TERMUX_PKG_SHA256=(644484f95167fe63014eac3db410f50c58810289fea228a2221e07d27da50eec
be37b2d32b213996ca2b7ab12c6d282d254dc20a1792c796d26f6bd3bda8bdd6)
TERMUX_PKG_LICENSE="custom"
TERMUX_PKG_LICENSE_FILE="COPYING.txt, faustlibraries-${_FAUSTLIB_COMMIT}/licenses/stk-4.3.0.md"
TERMUX_PKG_DEPENDS="libc++"
TERMUX_PKG_BUILD_IN_SRC=true
termux_step_configure() {
cd $TERMUX_PKG_SRCDIR/build
mkdir faustdir && cd faustdir
termux_setup_cmake
# Build the faust compiler with backends for various language + faust API libraries
# these values are copied from build/Makefile:323
cmake -C ../backends/light.cmake \
-C ../targets/all.cmake \
-DCMAKE_BUILD_TYPE=Release \
"-DWORKLET=off" \
-DINCLUDE_LLVM=OFF \
-DUSE_LLVM_CONFIG=ON \
-DLLVM_PACKAGE_VERSION= \
-DLLVM_LIBS="" \
-DLLVM_LIB_DIR="" \
-DLLVM_INCLUDE_DIRS="" \
-DLLVM_DEFINITIONS="" \
-DLLVM_LD_FLAGS="" \
-DLIBSDIR=lib \
-DBUILD_HTTP_STATIC=OFF \
-DCMAKE_FIND_ROOT_PATH=$TERMUX_PREFIX \
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
-DCMAKE_INSTALL_PREFIX=$TERMUX_PREFIX \
-DCMAKE_INSTALL_LIBDIR=$TERMUX_PREFIX/lib \
-DCMAKE_C_FLAGS="-DANDROID $CFLAGS $CPPFLAGS" \
-DCMAKE_CXX_FLAGS="-DANDROID $CXXFLAGS $CPPFLAGS" \
-DCMAKE_SKIP_INSTALL_RPATH=ON \
-DCMAKE_USE_SYSTEM_LIBRARIES=True \
-DDOXYGEN_EXECUTABLE= \
-DBUILD_TESTING=OFF \
-G 'Unix Makefiles' ..
}
termux_step_make() {
cd $TERMUX_PKG_SRCDIR
make -C build PREFIX=$TERMUX_PREFIX
}
termux_step_make_install() {
make -C build install PREFIX=$TERMUX_PREFIX
cd faustlibraries-${_FAUSTLIB_COMMIT}
cp *.lib old/*.lib $TERMUX_PREFIX/share/faust
}
termux_step_post_make_install() {
cd $TERMUX_PREFIX/bin
# these are pretty much unusable inside Termux; requiring QT/Jack/Unity
for i in alqt caqt jackserver jaqtchain lv2 netjackqt paqt cagtk dummymem rosgtk \
raqt linuxunity jack jaqt jackrust jackconsole dummy; do
rm faust2${i}
done
mv usage.sh faustusage.sh
# find all ASCII scripts
local faustscripts=$(find . -type f -exec grep -Iq . {} \; -print)
sed -i 's/usage.sh/faustusage.sh/g' $faustscripts
# We need to replace all instance of "/usr" with $TERMUX_PREFIX but we can't do it
# in one go since $TERMUX_PREFIX also contain "/usr" so we risk doubling the prefix:
# "/data/data/com.termux/files/data/data/com.termux/files/usr"
sed -i "s@$TERMUX_PREFIX@\$TERMUX_PREFIX@g" $faustscripts
sed -i "s@/usr/local@\$TERMUX_PREFIX@g" $faustscripts
sed -i "s@/usr@\$TERMUX_PREFIX@g" $faustscripts
# turns /tmp and /var with $TERMUX_PREFIX_{tmp,var}
for i in tmp var; do
sed -i "s@\$TERMUX_PREFIX/${i}/@\$TERMUX_PREFIX_${i}@g" $faustscripts
perl -pi -e 's@(?<=("|[^[:alnum:]_\.]))/'${i}'(?=(/|\s))@\$TERMUX_PREFIX_'${i}'@g' \
$faustscripts
done
# restore
for i in tmp var; do
sed -i "s@\$TERMUX_PREFIX_${i}@\$TERMUX_PREFIX/${i}@g" $faustscripts
done
sed -i "s@\$TERMUX_PREFIX@$TERMUX_PREFIX@g" $faustscripts
cd $TERMUX_PREFIX/share/faust
rm jack-*.cpp && rm *-gtk.{c,cpp} *-qt.cpp
}

View File

@ -0,0 +1,12 @@
diff -uNr faust-2.70.3/compiler/tlib/compatibility.cpp faust-2.70.3.mod/compiler/tlib/compatibility.cpp
--- faust-2.70.3/compiler/tlib/compatibility.cpp 2024-01-05 16:34:56.000000000 +0800
+++ faust-2.70.3.mod/compiler/tlib/compatibility.cpp 2024-01-29 10:13:44.602047935 +0800
@@ -275,7 +275,7 @@
strncpy(str, path, size);
} else {
// prevent the case of _ undefined
- strncpy(str, "/usr/local/bin/faust", size);
+ strncpy(str, "@TERMUX_PREFIX@/bin/faust", size);
}
}
}

View File

@ -0,0 +1,49 @@
TERMUX_SUBPKG_DESCRIPTION="Faust DSP libraries"
TERMUX_SUBPKG_DEPEND_ON_PARENT=unversioned
TERMUX_SUBPKG_PLATFORM_INDEPENDENT=true
TERMUX_SUBPKG_INCLUDE="
share/faust/aanl.lib
share/faust/all.lib
share/faust/analyzers.lib
share/faust/basics.lib
share/faust/compressors.lib
share/faust/delays.lib
share/faust/demos.lib
share/faust/dx7.lib
share/faust/effect.lib
share/faust/envelopes.lib
share/faust/fds.lib
share/faust/filter.lib
share/faust/filters.lib
share/faust/hoa.lib
share/faust/instruments.lib
share/faust/interpolators.lib
share/faust/math.lib
share/faust/maths.lib
share/faust/maxmsp.lib
share/faust/mi.lib
share/faust/misceffects.lib
share/faust/music.lib
share/faust/noises.lib
share/faust/oscillator.lib
share/faust/oscillators.lib
share/faust/phaflangers.lib
share/faust/physmodels.lib
share/faust/platform.lib
share/faust/quantizers.lib
share/faust/reducemaps.lib
share/faust/reverbs.lib
share/faust/routes.lib
share/faust/sf.lib
share/faust/signals.lib
share/faust/soundfiles.lib
share/faust/spats.lib
share/faust/stdfaust.lib
share/faust/synths.lib
share/faust/tonestacks.lib
share/faust/tubes.lib
share/faust/vaeffects.lib
share/faust/version.lib
share/faust/wdmodels.lib
share/faust/webaudio.lib
"