aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/flext')
-rw-r--r--externals/grill/flext/changes.txt1
-rw-r--r--externals/grill/flext/config-pd-linux.txt4
-rw-r--r--externals/grill/flext/makefile.pd-linux53
-rw-r--r--externals/grill/flext/source/flbase.h2
-rwxr-xr-xexternals/grill/flext/source/fllib.cpp2
-rw-r--r--externals/grill/flext/source/flstdc.h3
-rw-r--r--externals/grill/flext/source/flsupport.cpp2
-rw-r--r--externals/grill/flext/source/flsupport.h15
8 files changed, 66 insertions, 16 deletions
diff --git a/externals/grill/flext/changes.txt b/externals/grill/flext/changes.txt
index 5bb63b9c..696f4266 100644
--- a/externals/grill/flext/changes.txt
+++ b/externals/grill/flext/changes.txt
@@ -16,6 +16,7 @@ Version history:
0.5.0:
- added some more SIMD functions
- fixed wrong returned result of flext::buffer::set function
+- fix for linux static exported function name-clash (flext::Setup() single- vs. multi-threading)
0.4.4:
- fixed deadly bug for Max/MSP method-to-symbol-binding proxies
diff --git a/externals/grill/flext/config-pd-linux.txt b/externals/grill/flext/config-pd-linux.txt
index e1ead53e..97bbb655 100644
--- a/externals/grill/flext/config-pd-linux.txt
+++ b/externals/grill/flext/config-pd-linux.txt
@@ -29,3 +29,7 @@ INSTDIR=/usr/local/lib/pd/flext
# (check if they fit for your system!)
# UFLAGS=-mcpu=pentiumpro # gcc 2.95
# UFLAGS=-mcpu=pentium3 -msse # gcc 3.2
+
+# define to use old library naming for backwards compatibility (to externals depending on flext versions < 0.5)
+# ("flext.a" instead of new "libflext.a" etc.)
+V4_NAMING=1
diff --git a/externals/grill/flext/makefile.pd-linux b/externals/grill/flext/makefile.pd-linux
index 9f02fb28..ad3238e9 100644
--- a/externals/grill/flext/makefile.pd-linux
+++ b/externals/grill/flext/makefile.pd-linux
@@ -27,6 +27,9 @@ CFLAGS_D=-g
# additional flags for threading
CFLAGS_T=-DFLEXT_THREADS
+# additional flags for shared library
+CFLAGS_S=-DFLEXT_SHARED -DFLEXT_EXPORTS
+
# libraries
LIBS=
@@ -53,12 +56,22 @@ HDRS+=${HDRS_STK}
endif
MAKEFILE=makefile.pd-linux
+
+ifdef V4_NAMING
TARGET=${TARGDIR}/${NAME}.a
TARGET_D=${TARGDIR}/${NAME}_d.a
TARGET_T=${TARGDIR}/${NAME}_t.a
TARGET_TD=${TARGDIR}/${NAME}_td.a
+else
+TARGET=${TARGDIR}/lib${NAME}.a
+TARGET_D=${TARGDIR}/lib${NAME}_d.a
+TARGET_T=${TARGDIR}/lib${NAME}_t.a
+TARGET_TD=${TARGDIR}/lib${NAME}_td.a
+endif
+TARGET_S=${TARGDIR}/lib${NAME}.so
+TARGET_SD=${TARGDIR}/lib${NAME}_d.so
-all: $(TARGDIR) $(TARGET) $(TARGET_D) $(TARGET_T) $(TARGET_TD)
+all: $(TARGDIR) $(TARGET) $(TARGET_D) $(TARGET_T) $(TARGET_TD) $(TARGET_S) $(TARGET_SD)
$(TARGDIR):
mkdir $(TARGDIR)
@@ -66,38 +79,56 @@ $(TARGDIR):
$(patsubst %,$(SRCDIR)/%,$(SRCS)): $(patsubst %,$(SRCDIR)/%,$(HDRS)) $(patsubst %,$(SRCDIR)/%,$(IHDRS)) $(MAKEFILE) $(CONFIG)
touch $@
-$(TARGDIR)/%.o : $(SRCDIR)/%.cpp
+$(TARGDIR)/%.ro : $(SRCDIR)/%.cpp
$(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@
$(TARGDIR)/%.do : $(SRCDIR)/%.cpp
$(CXX) -c $(CFLAGS_D) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@
-$(TARGDIR)/%.to : $(SRCDIR)/%.cpp
+$(TARGDIR)/%.tro : $(SRCDIR)/%.cpp
$(CXX) -c $(CFLAGS) $(CFLAGS_T) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@
$(TARGDIR)/%.tdo : $(SRCDIR)/%.cpp
$(CXX) -c $(CFLAGS_D) $(CFLAGS_T) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@
-$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS))
+$(TARGDIR)/%.sro : $(SRCDIR)/%.cpp
+ $(CXX) -c $(CFLAGS) $(CFLAGS_T) $(CFLAGS_S) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@
+
+$(TARGDIR)/%.sdo : $(SRCDIR)/%.cpp
+ $(CXX) -c $(CFLAGS_D) $(CFLAGS_T) $(CFLAGS_S) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@
+
+
+
+
+$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.ro,$(SRCS))
ar rc $@ $^
- chmod 755 $@
+ chmod 644 $@
$(TARGET_D) : $(patsubst %.cpp,$(TARGDIR)/%.do,$(SRCS))
ar rc $@ $^
- chmod 755 $@
+ chmod 644 $@
-$(TARGET_T) : $(patsubst %.cpp,$(TARGDIR)/%.to,$(SRCS))
+$(TARGET_T) : $(patsubst %.cpp,$(TARGDIR)/%.tro,$(SRCS))
ar rc $@ $^
- chmod 755 $@
+ chmod 644 $@
$(TARGET_TD) : $(patsubst %.cpp,$(TARGDIR)/%.tdo,$(SRCS))
ar rc $@ $^
+ chmod 644 $@
+
+$(TARGET_S) : $(patsubst %.cpp,$(TARGDIR)/%.sro,$(SRCS))
+ ld -shared -Bdynamic --strip-debug -o $@ $^
chmod 755 $@
+$(TARGET_SD) : $(patsubst %.cpp,$(TARGDIR)/%.sdo,$(SRCS))
+ ld -shared -Bdynamic -o $@ $^
+ chmod 755 $@
+
+
.PHONY: clean install
clean:
- rm -f $(TARGDIR)/*.{o,do,to,tdo} $(TARGET) $(TARGET_D) $(TARGET_T) $(TARGET_TD)
+ rm -f $(TARGDIR)/*.{ro,do,tro,tdo,sro,sdo} $(TARGET) $(TARGET_D) $(TARGET_T) $(TARGET_TD) $(TARGET_S) $(TARGET_SD)
ifdef INSTDIR
$(INSTDIR):
@@ -106,8 +137,8 @@ $(INSTDIR):
install:: $(INSTDIR)
endif
-install:: $(TARGET) $(TARGET_D) $(TARGET_T) $(TARGET_TD) $(patsubst %,$(SRCDIR)/%,$(HDRS))
+install:: $(TARGET) $(TARGET_D) $(TARGET_T) $(TARGET_TD) $(TARGET_S) $(TARGET_SD) $(patsubst %,$(SRCDIR)/%,$(HDRS))
cp $^ $(INSTDIR)
- chmod 755 $(patsubst %,$(INSTDIR)/%,$(notdir $^))
+ chmod a+r $(patsubst %,$(INSTDIR)/%,$(notdir $^))
chown root.users $(patsubst %,$(INSTDIR)/%,$(notdir $^))
diff --git a/externals/grill/flext/source/flbase.h b/externals/grill/flext/source/flbase.h
index 4d0dbdc6..4d0541b8 100644
--- a/externals/grill/flext/source/flbase.h
+++ b/externals/grill/flext/source/flbase.h
@@ -221,7 +221,7 @@ class FLEXT_SHARE flext_obj:
public:
//! Creation callback
- static void __setup__(t_classid) { flext::Setup(); }
+ static void __setup__(t_classid) { flext::FLEXT_SETUPFUNC(); }
/*! \brief This is a temporary holder
\warning don't touch it!
diff --git a/externals/grill/flext/source/fllib.cpp b/externals/grill/flext/source/fllib.cpp
index a6d95895..f84968f2 100755
--- a/externals/grill/flext/source/fllib.cpp
+++ b/externals/grill/flext/source/fllib.cpp
@@ -194,7 +194,7 @@ t_class *flext_obj::getClass(t_classid id) { return reinterpret_cast<libclass *>
void flext_obj::lib_init(const char *name,void setupfun(),bool attr)
{
- flext::Setup();
+ flext::FLEXT_SETUPFUNC();
#if FLEXT_SYS == FLEXT_SYS_MAX
lib_name = MakeSymbol(name);
diff --git a/externals/grill/flext/source/flstdc.h b/externals/grill/flext/source/flstdc.h
index 6c13a9c4..c875ac1e 100644
--- a/externals/grill/flext/source/flstdc.h
+++ b/externals/grill/flext/source/flstdc.h
@@ -207,7 +207,8 @@ typedef t_symbol *t_symptr;
#ifdef _MSC_VER
#ifdef FLEXT_SHARED
- #ifdef FLEXT_DLL
+ // for compiling a shared flext library FLEXT_EXPORTS must be defined
+ #ifdef FLEXT_EXPORTS
#define FLEXT_SHARE __declspec(dllexport)
#else
#define FLEXT_SHARE __declspec(dllimport)
diff --git a/externals/grill/flext/source/flsupport.cpp b/externals/grill/flext/source/flsupport.cpp
index 20474812..ac501f78 100644
--- a/externals/grill/flext/source/flsupport.cpp
+++ b/externals/grill/flext/source/flsupport.cpp
@@ -32,7 +32,7 @@ const t_symbol *flext::sym_signal = NULL;
int flext::Version() { return FLEXT_VERSION; }
const char *flext::VersionStr() { return FLEXT_VERSTR; }
-void flext::Setup()
+void flext::FLEXT_SETUPFUNC()
{
static bool issetup = false;
if(issetup)
diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h
index 6a756590..98fbe441 100644
--- a/externals/grill/flext/source/flsupport.h
+++ b/externals/grill/flext/source/flsupport.h
@@ -974,7 +974,20 @@ protected:
#ifdef __MRC__
friend class flext_obj;
#endif
- static void Setup();
+
+/*
+ With linux and more than one flext-based external loaded all calls to static
+ exported functions refer to the first instance loaded!
+ As single- and multi-threaded to different initializations the function names have
+ to be different as well.
+*/
+#ifdef FLEXT_THREADS
+#define FLEXT_SETUPFUNC SetupMulti
+#else
+#define FLEXT_SETUPFUNC SetupSingle
+#endif
+
+ static void FLEXT_SETUPFUNC();
static bool chktilde(const char *objname);