aboutsummaryrefslogtreecommitdiff
path: root/externals
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2004-08-24 02:34:30 +0000
committerThomas Grill <xovo@users.sourceforge.net>2004-08-24 02:34:30 +0000
commit02a91a1c1287fea5932bde76ceaece20cb69d1e1 (patch)
treee5f21bd2bdd1d47f790f27301c3459dd15559ba8 /externals
parent6bde9039f63f4529bc29705cf05750161d299cf5 (diff)
""
svn path=/trunk/; revision=1972
Diffstat (limited to 'externals')
-rwxr-xr-xexternals/grill/flext/build-max-darwin.sh11
-rw-r--r--externals/grill/flext/changes.txt3
-rwxr-xr-xexternals/grill/flext/config-max-darwin.txt28
-rwxr-xr-xexternals/grill/flext/makefile.max-darwin148
-rw-r--r--externals/grill/flext/readme.txt4
-rw-r--r--externals/grill/flext/source/flattr.cpp2
-rwxr-xr-xexternals/grill/flext/source/flprefix.h4
-rw-r--r--externals/grill/flext/source/flstdc.h16
-rw-r--r--externals/grill/flext/source/flthr.cpp31
9 files changed, 208 insertions, 39 deletions
diff --git a/externals/grill/flext/build-max-darwin.sh b/externals/grill/flext/build-max-darwin.sh
new file mode 100755
index 00000000..b8360772
--- /dev/null
+++ b/externals/grill/flext/build-max-darwin.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. config-max-darwin.txt
+
+make -f makefile.max-darwin &&
+{
+ if [ $INSTDIR != "" ]; then
+ echo Now install as root
+ sudo make -f makefile.max-darwin install
+ fi
+}
diff --git a/externals/grill/flext/changes.txt b/externals/grill/flext/changes.txt
index f00dc4d5..8782d4ba 100644
--- a/externals/grill/flext/changes.txt
+++ b/externals/grill/flext/changes.txt
@@ -20,7 +20,7 @@ Version history:
- support exceptions for setup functions, object creation and destruction, method handling
- small fixes for MSVC6 incompatibilites
- fixes for Max 4.5 headers
-- removed Mach-O/CFM glue stuff again....Max has gone Mach-O in the meantime...
+- removed Mach-O/CFM glue stuff again and added makefiles for Max/MachO
- in flext::StopThread don't wait for thread to have stopped!
0.4.6:
@@ -302,6 +302,7 @@ TODO list:
for 0.4.7:
- SIMD for gcc
- individual apply buttons for each attribute in the attribute editor
+- Max/MSP MachO support
bugs:
- recreation of object with different argument line forgets about eventually present attributes
diff --git a/externals/grill/flext/config-max-darwin.txt b/externals/grill/flext/config-max-darwin.txt
new file mode 100755
index 00000000..f29aa86d
--- /dev/null
+++ b/externals/grill/flext/config-max-darwin.txt
@@ -0,0 +1,28 @@
+# flext - C++ layer for Max/MSP and pd (pure data) externals
+# Copyright (c) 2001-2004 Thomas Grill (xovo@gmx.net)
+#
+
+# your c++ compiler (define only if it's different than g++)
+# CXX=g++-3.3
+
+# where is the Max SDK? (version 4.5 upwards!!)
+MAXSDKPATH="/Volumes/Daten/Prog/MaxMSP-SDK/4.5 headers/c74support"
+
+# where is the SndObj include directory?
+# (leave blank or comment out to disable SndObj support)
+# SNDOBJ=/usr/src/sndobj/include
+
+# where is the STK include directory?
+# (leave blank or comment out to disable STK support)
+# STK=/usr/src/stk/include
+
+# where should flext libraries be built?
+TARGDIR=./max-darwin
+
+# where should flext libraries be installed?
+# (leave blank to omit installation)
+INSTDIR="/Library/Application Support/Cycling '74/flext"
+
+# additional compiler flags
+# (check if they fit for your system!)
+UFLAGS=-DFLEXT_USE_SIMD -malign-power -maltivec -faltivec
diff --git a/externals/grill/flext/makefile.max-darwin b/externals/grill/flext/makefile.max-darwin
new file mode 100755
index 00000000..a2fee930
--- /dev/null
+++ b/externals/grill/flext/makefile.max-darwin
@@ -0,0 +1,148 @@
+# flext - C++ layer for Max/MSP and pd (pure data) externals
+# Copyright (c) 2001-2004 Thomas Grill (xovo@gmx.net)
+#
+# Makefile for gcc @ darwin
+#
+# usage:
+# to build run "make -f makefile.max-darwin"
+# to install (as root), do "make -f makefile.max-darwin install"
+#
+
+CONFIG=config-max-darwin.txt
+
+include ${CONFIG}
+
+# compiler+linker stuff
+# the MaxMSP SDK path is directly inserted with the FLAGS below because it normally contains spaces...
+INCLUDES=
+FLAGS=-I${MAXSDKPATH}/max-includes -I${MAXSDKPATH}/msp-includes -DFLEXT_SYS=1 ${UFLAGS}
+
+# compiler flags for optimized build
+CFLAGS=-O2
+
+# compiler flags for debug build
+CFLAGS_D=-g
+
+# additional flags for threading
+CFLAGS_T=-DFLEXT_THREADS
+
+# additional flags for shared library
+CFLAGS_S=-DFLEXT_SHARED -DFLEXT_EXPORTS
+
+# flags for shared linking
+LSHFLAGS= -dylib -dynamic -flat_namespace -undefined suppress
+
+# frameworks
+FRAMEWORKS=MaxAPI MaxAudioAPI
+
+
+# ----------------------------------------------
+# the rest can stay untouched
+# ----------------------------------------------
+
+NAME=flext
+
+SRCDIR=./source
+
+# all the source files from the package
+include make-files.txt
+
+ifdef SNDOBJ
+INCLUDES+=$(SNDOBJ)
+SRCS+=$(SRCS_SNDOBJ)
+HDRS+=$(HDRS_SNDOBJ)
+endif
+
+ifdef STK
+INCLUDES+=$(STK)
+SRCS+=$(SRCS_STK)
+HDRS+=$(HDRS_STK)
+endif
+
+
+MAKEFILE=makefile.max-darwin
+
+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
+TARGET_S=$(TARGDIR)/lib$(NAME).dylib
+TARGET_SD=$(TARGDIR)/lib$(NAME)_d.dylib
+
+
+all: $(TARGDIR) $(TARGET) $(TARGET_D) $(TARGET_T) $(TARGET_TD) # $(TARGET_S) $(TARGET_SD)
+
+$(TARGDIR):
+ mkdir $(TARGDIR)
+
+$(patsubst %,$(SRCDIR)/%,$(SRCS)): $(patsubst %,$(SRCDIR)/%,$(HDRS)) $(patsubst %,$(SRCDIR)/%,$(IHDRS)) $(MAKEFILE) $(CONFIG)
+ touch $@
+
+$(TARGDIR)/%.o : $(SRCDIR)/%.cpp
+ $(CXX) -c -dynamic $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $(patsubst %,-F%,$(FRAMEWORKS)) $< -o $@
+
+$(TARGDIR)/%.do : $(SRCDIR)/%.cpp
+ $(CXX) -c -dynamic $(CFLAGS_D) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $(patsubst %,-F%,$(FRAMEWORKS)) $< -o $@
+
+$(TARGDIR)/%.to : $(SRCDIR)/%.cpp
+ $(CXX) -c -dynamic $(CFLAGS) $(CFLAGS_T) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $(patsubst %,-F%,$(FRAMEWORKS)) $< -o $@
+
+$(TARGDIR)/%.tdo : $(SRCDIR)/%.cpp
+ $(CXX) -c -dynamic $(CFLAGS_D) $(CFLAGS_T) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $(patsubst %,-F%,$(FRAMEWORKS)) $< -o $@
+
+$(TARGDIR)/%.so : $(SRCDIR)/%.cpp
+ $(CXX) -c -dynamic $(CFLAGS) $(CFLAGS_T) $(CFLAGS_S) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $(patsubst %,-F%,$(FRAMEWORKS)) $< -o $@
+
+$(TARGDIR)/%.sdo : $(SRCDIR)/%.cpp
+ $(CXX) -c -dynamic $(CFLAGS_D) $(CFLAGS_T) $(CFLAGS_S) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $(patsubst %,-F%,$(FRAMEWORKS)) $< -o $@
+
+$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS))
+ libtool -static -o $@ $^
+
+$(TARGET_D) : $(patsubst %.cpp,$(TARGDIR)/%.do,$(SRCS))
+ libtool -static -o $@ $^
+
+$(TARGET_T) : $(patsubst %.cpp,$(TARGDIR)/%.to,$(SRCS))
+ libtool -static -o $@ $^
+
+$(TARGET_TD) : $(patsubst %.cpp,$(TARGDIR)/%.tdo,$(SRCS))
+ libtool -static -o $@ $^
+
+$(TARGET_S) : $(patsubst %.cpp,$(TARGDIR)/%.so,$(SRCS))
+ ld $(LSHFLAGS) -o $@ $^ -ldylib1.o -lgcc -lstdc++ $(patsubst %,-framework %,$(FRAMEWORKS))
+
+$(TARGET_SD) : $(patsubst %.cpp,$(TARGDIR)/%.sdo,$(SRCS))
+ ld $(LSHFLAGS) -o $@ $^ -ldylib1.o -lgcc -lstdc++ $(patsubst %,-framework %,$(FRAMEWORKS))
+
+.PHONY: clean install
+
+clean:
+ rm -f $(TARGDIR)/*.{o,do,to,tdo,so,sdo} $(TARGET) $(TARGET_D) $(TARGET_T) $(TARGET_TD) $(TARGET_S) $(TARGET_SD)
+
+ifdef INSTDIR
+$(INSTDIR):
+ -mkdir $(INSTDIR)
+
+install:: $(INSTDIR)
+endif
+
+install:: $(TARGET) $(TARGET_D) $(TARGET_T) $(TARGET_TD) $(TARGET_S) $(TARGET_SD) $(patsubst %,$(SRCDIR)/%,$(HDRS))
+ cp $^ $(INSTDIR)
+ mv $(INSTDIR)/lib*.dylib /usr/local/lib
+ ranlib $(INSTDIR)/*.a # have to rerun ranlib at install dir ?!
+
+ #make compatibility links for old-style naming
+ for i in $(foreach f,$(notdir $(filter %.a,$^)),$(patsubst lib%.a,%,$(f))); do rm -f $(INSTDIR)/$$i.a && ln -sf lib$$i.a $(INSTDIR)/$$i.a; done
+
+# chmod 755 $(patsubst %,$(INSTDIR)/%,$(notdir $^))
+# chgrp admin $(patsubst %,$(INSTDIR)/%,$(notdir $^))
+
+
+
+
+
+
+
+
+
+
diff --git a/externals/grill/flext/readme.txt b/externals/grill/flext/readme.txt
index 916ec74c..97c1f4b2 100644
--- a/externals/grill/flext/readme.txt
+++ b/externals/grill/flext/readme.txt
@@ -121,6 +121,10 @@ You should changes all of these to
#endif /* _MOTO_ */
+o GCC: edit "config-max-darwin.txt" & run "sh build-max-darwin.sh"
+ additional settings (e.g. target processor, compiler flags) can be made in makefile.max-darwin
+
+
With your project using flext, be sure to define "FLEXT_SYS=1"
- alternatively use the prefix file "flcwmax-x.h" or "flcwmax-x-thr.h" for threading support.
diff --git a/externals/grill/flext/source/flattr.cpp b/externals/grill/flext/source/flattr.cpp
index 4890e62a..30b8fea1 100644
--- a/externals/grill/flext/source/flattr.cpp
+++ b/externals/grill/flext/source/flattr.cpp
@@ -169,7 +169,7 @@ bool flext_base::InitAttrib(int argc,const t_atom *argv)
bool flext_base::ListAttrib() const
{
- if(procattr) {
+ if(procattr) {
AtomList la;
ListAttrib(la);
ToOutAnything(GetOutAttr(),MakeSymbol("attributes"),la.Count(),la.Atoms());
diff --git a/externals/grill/flext/source/flprefix.h b/externals/grill/flext/source/flprefix.h
index 626ff70a..ba9b4b50 100755
--- a/externals/grill/flext/source/flprefix.h
+++ b/externals/grill/flext/source/flprefix.h
@@ -340,8 +340,8 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#ifdef FLEXT_THREADS
#undef FLEXT_THREADS
- #if FLEXT_OS == FLEXT_OS_MAC && FLEXT_SYS == FLEXT_SYS_MAX
- // Max crashes with posix threads (because it's in the CFM model)
+ #if FLEXT_SYS == FLEXT_SYS_MAX && FLEXT_OS == FLEXT_OS_MAC && FLEXT_OSAPI != FLEXT_OSAPI_MAC_MACH
+ // Max for CFM doesn't like posix threads
#define FLEXT_THREADS FLEXT_THR_MP
#elif FLEXT_SYS == FLEXT_SYS_MAX && FLEXT_OS == FLEXT_OS_WIN
// for wmax use native Windows threads
diff --git a/externals/grill/flext/source/flstdc.h b/externals/grill/flext/source/flstdc.h
index 5f503f1f..97dacd54 100644
--- a/externals/grill/flext/source/flstdc.h
+++ b/externals/grill/flext/source/flstdc.h
@@ -96,12 +96,18 @@ typedef t_clock t_qelem;
// Include the relevant Max/MSP header files
#if FLEXT_OS == FLEXT_OS_MAC
- #ifndef __MRC__
- #define powerc
- #endif
- #define __MOTO__ 0
+ #if FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH
+ // MachO version - must insert prefix header
+ #include <ext_carbon_prefix.h>
+ #else
+ // CFM version
+ #ifndef __MRC__
+ #define powerc
+ #endif
+ #define __MOTO__ 0
- #include <MacTypes.h>
+ #include <MacTypes.h>
+ #endif
#elif FLEXT_OS == FLEXT_OS_WIN
#define WIN_VERSION 1
#endif
diff --git a/externals/grill/flext/source/flthr.cpp b/externals/grill/flext/source/flthr.cpp
index d6bc9276..8a7a841f 100644
--- a/externals/grill/flext/source/flthr.cpp
+++ b/externals/grill/flext/source/flthr.cpp
@@ -50,29 +50,6 @@ static bool thrhelpexit = false;
static flext::ThrCond *thrhelpcond = NULL;
-#if defined(FLEXT_THREADS) && FLEXT_SYS == FLEXT_SYS_MAX && FLEXT_OS == FLEXT_OS_MAC && FLEXT_THREADS == FLEXT_THR_POSIX
-// utility code taken from from Apple's CFM_MachO_CFM example:
-//
-// This function allocates a block of CFM glue code which contains the instructions to call CFM routines
-//
-(void (*)(void *))MachOFunctionPointerForCFMFunctionPointer( (void (*)(void *))cfmfp )
-{
- // Apple utility code for CFM callback glue
- static const UInt32 tmpl[6] = {0x3D800000, 0x618C0000, 0x800C0000, 0x804C0004, 0x7C0903A6, 0x4E800420};
- UInt32 *mfp = (UInt32*) NewPtr( sizeof(tmpl) ); // Must later dispose of allocated memory
- // (this is freed with app heap in this object)
- mfp[0] = tmpl[0] | ((UInt32)cfmfp >> 16);
- mfp[1] = tmpl[1] | ((UInt32)cfmfp & 0xFFFF);
- mfp[2] = tmpl[2];
- mfp[3] = tmpl[3];
- mfp[4] = tmpl[4];
- mfp[5] = tmpl[5];
- MakeDataExecutable( mfp, sizeof(tmpl) );
- return (void (*)(void *))mfp;
-}
-#endif
-
-
flext::thrid_t flext::GetSysThreadId() { return thrid; }
@@ -100,13 +77,7 @@ bool flext::StartHelper()
pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED);
thrhelpexit = false;
-#if FLEXT_SYS == FLEXT_SYS_MAX && FLEXT_OS == FLEXT_OS_MAC
- void (*CFMThrHelper)(void *) = MachOFunctionPointerForCFMFunctionPointer(ThrHelper);
- int ret = pthread_create (&thrhelpid,&attr,(void *(*)(void *))CFMThrHelper,NULL);
-#else
- int ret = pthread_create (&thrhelpid,&attr,(void *(*)(void *))ThrHelper,NULL);
-#endif
- ok = !ret;
+ ok = pthread_create (&thrhelpid,&attr,(void *(*)(void *))ThrHelper,NULL) == 0;
#elif FLEXT_THREADS == FLEXT_THR_MP
if(!MPLibraryIsLoaded())
error("Thread library is not loaded");