Skip to content

Commit

Permalink
contrib/calf: new package (0.90.3)
Browse files Browse the repository at this point in the history
  • Loading branch information
nekopsykose authored and q66 committed Dec 10, 2023
1 parent 06842ef commit 21926aa
Show file tree
Hide file tree
Showing 5 changed files with 169 additions and 0 deletions.
47 changes: 47 additions & 0 deletions contrib/calf/patches/clang-lerp.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Patch-Source: https://gitweb.gentoo.org/repo/gentoo.git/plain/media-plugins/calf/files/calf-0.90.3-clang-lerp_table_lookup_float_mask.patch
--
From bfb857445e72230659493d3491970e3cb3c7eb9a Mon Sep 17 00:00:00 2001
From: Krzysztof Foltman <wdev@foltman.com>
Date: Fri, 2 Aug 2019 20:55:50 +0100
Subject: [PATCH] Compatibility: A possible fix for the clang++-8 issue.

---
src/calf/fixed_point.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/calf/fixed_point.h b/src/calf/fixed_point.h
index 7dbf5c9bc..63bfce167 100644
--- a/src/calf/fixed_point.h
+++ b/src/calf/fixed_point.h
@@ -215,7 +215,7 @@ template<class T, int FracBits> class fixed_point {
}

template<class U, int UseBits>
- inline U lerp_table_lookup_int(U data[(1U<<IntBits)+1]) const {
+ inline U lerp_table_lookup_int(U *data) const {
unsigned int pos = uipart();
return lerp_by_fract_int<U, UseBits>(data[pos], data[pos+1]);
}
@@ -223,19 +223,19 @@ template<class T, int FracBits> class fixed_point {
/// Untested... I've started it to get a sin/cos readout for rotaryorgan, but decided to use table-less solution instead
/// Do not assume it works, because it most probably doesn't
template<class U, int UseBits>
- inline U lerp_table_lookup_int_shift(U data[(1U<<IntBits)+1], unsigned int shift) {
+ inline U lerp_table_lookup_int_shift(U *data, unsigned int shift) {
unsigned int pos = (uipart() + shift) & ((1ULL << IntBits) - 1);
return lerp_by_fract_int<U, UseBits>(data[pos], data[pos+1]);
}

template<class U>
- inline U lerp_table_lookup_float(U data[(1U<<IntBits)+1]) const {
+ inline U lerp_table_lookup_float(U *data) const {
unsigned int pos = uipart();
return data[pos] + (data[pos+1]-data[pos]) * fpart_as_double();
}

template<class U>
- inline U lerp_table_lookup_float_mask(U data[(1U<<IntBits)+1], unsigned int mask) const {
+ inline U lerp_table_lookup_float_mask(U *data, unsigned int mask) const {
unsigned int pos = ui64part() & mask;
// printf("full = %lld pos = %d + %f\n", value, pos, fpart_as_double());
return data[pos] + (data[pos+1]-data[pos]) * fpart_as_double();
37 changes: 37 additions & 0 deletions contrib/calf/patches/cpp11.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Patch-Source: https://github.com/calf-studio-gear/calf/commit/76b11e6e1f616034071fcf5f1ed45cb82c3979a3
--
From b7e423628f32db3e6a9ea9bb2d81071d44773a80 Mon Sep 17 00:00:00 2001
From: Violet Purcell <vimproved@inventati.org>
Date: Thu, 21 Sep 2023 18:16:35 -0400
Subject: [PATCH] Replace use of std::bind2nd with std::bind

std::bind2nd was deprecated in C++11 and removed in C++17. Remove usage
of it and replace with std::bind.

Signed-off-by: Violet Purcell <vimproved@inventati.org>
---
src/calf/orfanidis_eq.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/calf/orfanidis_eq.h b/src/calf/orfanidis_eq.h
index 47abf5bea..61e51ec76 100644
--- a/src/calf/orfanidis_eq.h
+++ b/src/calf/orfanidis_eq.h
@@ -748,7 +748,7 @@ class EllipticTypeBPFilter : public BPFilter {
std::vector<eq_double_t> v = landen(k, tol);

std::transform(v.begin(), v.end(), v.begin(),
- bind2nd(std::plus<eq_double_t>(), 1.0));
+ bind(std::plus<eq_double_t>(), std::placeholders::_1, 1.0));

K = std::accumulate(v.begin(), v.end(),
1, std::multiplies<eq_double_t>()) * M_PI/2.0;
@@ -764,7 +764,7 @@ class EllipticTypeBPFilter : public BPFilter {
std::vector<eq_double_t> vp = landen(kp, tol);

std::transform(vp.begin(), vp.end(), vp.begin(),
- bind2nd(std::plus<eq_double_t>(), 1.0));
+ bind(std::plus<eq_double_t>(), std::placeholders::_1, 1.0));

Kprime = std::accumulate(vp.begin(), vp.end(),
1.0, std::multiplies<eq_double_t>()) * M_PI/2.0;
22 changes: 22 additions & 0 deletions contrib/calf/patches/fix-autoconf.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/configure.ac b/configure.ac
index 533dd908..510b017d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,7 +69,7 @@ AC_CHECK_PROG(SORDI_ENABLED, sordi, yes, no)

if test "$have_jack_header" = "yes"; then
PKG_CHECK_MODULES(JACK_DEPS, jack >= 0.103.0,
- AC_CHECK_LIB([jack], [jack_port_register], JACK_FOUND="yes", ),)
+ [AC_CHECK_LIB([jack], [jack_port_register], JACK_FOUND="yes", )],)
fi

if test "$JACK_FOUND" = "yes"; then
@@ -83,7 +83,7 @@ fi
PKG_CHECK_MODULES(LV2_DEPS, lv2 >= 1.1.14, LV2_FOUND="yes", LV2_FOUND="no")

PKG_CHECK_MODULES(LASH_DEPS, lash-1.0 >= 0.6.0,
- AC_CHECK_LIB([lash], [lash_client_is_being_restored], LASH_0_6_FOUND="yes", LASH_0_6_FOUND="no"),
+ [AC_CHECK_LIB([lash], [lash_client_is_being_restored], LASH_0_6_FOUND="yes", LASH_0_6_FOUND="no")],
LASH_0_6_FOUND="no")
if test "$LASH_0_6_FOUND" = "yes"; then
LASH_FOUND="yes"
36 changes: 36 additions & 0 deletions contrib/calf/patches/syms.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Patch-Source: https://github.com/calf-studio-gear/calf/commit/f6c6aaef3d8c744faefa13842fd452323bb30750
--
From cec78130b8ea1fcd7fe8c2f93de004df134e6ce5 Mon Sep 17 00:00:00 2001
From: Violet Purcell <vimproved@inventati.org>
Date: Thu, 21 Sep 2023 19:08:39 -0400
Subject: [PATCH] Fix build with LLD

LLVM's LLD handles the -retain-symbols-file option (used by
-export-symbols-regex in libtool) differently from GNU ld, causing
undefined references during link. This commit removes the
-export-symbols-regex option from libcalf_la_LDFLAGS since by default
libtool exports all symbols anyway, so it should not be necessary.

Fixes https://github.com/calf-studio-gear/calf/issues/156.

Signed-off-by: Violet Purcell <vimproved@inventati.org>
---
src/Makefile.am | 4 ----
1 file changed, 4 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index b1e37c522..6f11628ba 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -39,11 +39,7 @@ calfbenchmark_LDADD = libcalf.la

calf_la_SOURCES = audio_fx.cpp analyzer.cpp lv2wrap.cpp metadata.cpp modules_tools.cpp modules_delay.cpp modules_comp.cpp modules_limit.cpp modules_dist.cpp modules_filter.cpp modules_mod.cpp modules_pitch.cpp fluidsynth.cpp giface.cpp monosynth.cpp organ.cpp osctl.cpp plugin.cpp preset.cpp synth.cpp utils.cpp wavetable.cpp modmatrix.cpp
calf_la_LIBADD = $(FLUIDSYNTH_DEPS_LIBS) $(GLIB_DEPS_LIBS)
-if USE_DEBUG
calf_la_LDFLAGS = -rpath $(pkglibdir) -avoid-version -module -lexpat -disable-static
-else
-calf_la_LDFLAGS = -rpath $(pkglibdir) -avoid-version -module -lexpat -disable-static -export-symbols-regex "lv2_descriptor"
-endif

if USE_LV2_GUI

27 changes: 27 additions & 0 deletions contrib/calf/template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
pkgname = "calf"
pkgver = "0.90.3"
pkgrel = 0
build_style = "gnu_configure"
configure_args = [
"--disable-experimental",
"--disable-static",
]
hostmakedepends = [
"autoconf",
"automake",
"libtool",
"pkgconf",
]
makedepends = [
"fluidsynth-devel",
"libexpat-devel",
"lv2",
]
pkgdesc = "Calf Studio Gear audio plugins"
maintainer = "psykose <alice@ayaya.dev>"
license = "LGPL-2.0-or-later"
url = "https://calf-studio-gear.org"
source = f"https://github.com/calf-studio-gear/calf/archive/refs/tags/{pkgver}.tar.gz"
sha256 = "8781cbd1a81dec59b5923a23141ab2ca74e0e724389e15ffcf3820ace138a46c"
# vis breaks symbols
hardening = ["!vis"]

0 comments on commit 21926aa

Please sign in to comment.