From 8476554bc26567564d6381e1b733579d5b45d881 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 16 Dec 2005 18:38:11 +0000 Subject: - Lots of bug fixes - added script which searches thru all of the .pd_darwin files for dependencies from Fink. It then copies those libs into the Pd.app and sets everything up for them to be sourced by the objects. - added Guenter's quick hack to allow international characters in Pd patches svn path=/trunk/; revision=4241 --- packages/darwin_app/Makefile | 112 +++++++++++++++-------- packages/darwin_app/TODO | 32 ++++++- packages/darwin_app/embed-MacOSX-dependencies.sh | 54 +++++++++++ packages/darwin_app/org.puredata.pd.plist | 10 +- 4 files changed, 165 insertions(+), 43 deletions(-) create mode 100755 packages/darwin_app/embed-MacOSX-dependencies.sh (limited to 'packages/darwin_app') diff --git a/packages/darwin_app/Makefile b/packages/darwin_app/Makefile index 06a333a3..96fe7ff9 100644 --- a/packages/darwin_app/Makefile +++ b/packages/darwin_app/Makefile @@ -2,7 +2,7 @@ current: darwin_app # needed to support weak linking of frameworks -MAKE=MACOSX_DEPLOYMENT_TARGET=10.3 make +MAKE = MACOSX_DEPLOYMENT_TARGET=10.3 make CWD := $(shell pwd) BUILD_BASE = $(CWD)/build @@ -25,26 +25,58 @@ WISH_CONTENTS = $(WISH)/Contents include $(BUILDLAYOUT_DIR)/Makefile.buildlayout +# base level optimizations +OPT_CFLAGS = -O3 -funroll-loops -fomit-frame-pointer + +# CPU-specific gleaned from http://developer.apple.com/releasenotes/DeveloperTools/GCC3.html +# check this too: http://hpc.sourceforge.net/ +# Generic PowerPC +#OPT_CFLAGS += -mcpu=powerpc -mpowerpc +# PowerPC 750 (G3) +#OPT_CFLAGS += -mcpu=750 -mpowerpc-gfxopt +# PowerPC 7400 (G4 <= 700Mhz) +#OPT_CFLAGS += -mcpu=7400 -faltivec -mpowerpc-gfxopt +# PowerPC 7450 (G4 >= 533MHz) +#OPT_CFLAGS += -fast -fPIC -mcpu=7450 -mtune=7450 -faltivec -ffast-math -mpowerpc-gfxopt +# PowerPC G5 (gcc-3.3) +#OPT_CFLAGS += -fast -fPIC -faltivec -mpowerpc-gpopt -mpowerpc-gfxopt + +# Package default, support older PowerPCs, but G4 (7450) is the most common +OPT_CFLAGS += -mcpu=powerpc -mtune=7450 -mpowerpc-gfxopt + + # these are sent to all of the various Makefiles so that they all copy their # output to the same directory tree DEST_PATHS = BUILDLAYOUT_DIR=$(BUILDLAYOUT_DIR) \ cvs_root_dir=$(cvs_root_dir) \ prefix=$(prefix) \ DESTDIR=$(DESTDIR) \ + OPT_CFLAGS="$(OPT_CFLAGS)" \ UNAME=$(UNAME) +all: + cd $(packages_src) && $(MAKE) $(DEST_PATHS) + install: darwin_app #------------------------------------------------------------------------------# -darwin_app: darwin_app_core extended_app_install darwin_app_doc_format rez_install +darwin_app: darwin_app_core extended_install darwin_app_doc_format rez_install \ +darwin_app_embed_libs @echo " " @echo "Pd.app build succeeded!" +extended_install: + cd $(packages_src) && $(MAKE) $(DEST_PATHS) install + #------------------------------------------------------------------------------# # this target is for when you already have a pre-built Pd.app and you # just want to fill it with goodies from CVS. To do so, place your # Pd.app in $(BUILD_BASE)/Pd.app -extended_app_install: extended_install +extended_app_install: + cd $(packages_src) && $(MAKE) $(DEST_PATHS) abstractions_install + cd $(packages_src) && $(MAKE) $(DEST_PATHS) doc_install + cd $(packages_src) && $(MAKE) $(DEST_PATHS) extensions_install + cd $(packages_src) && $(MAKE) $(DEST_PATHS) externals_install #------------------------------------------------------------------------------# @@ -60,7 +92,7 @@ darwin_app_wrapper: Info.plist "$(PD_APP_CONTENTS)/MacOS" install -d "$(PD_APP_CONTENTS)/Resources" install -m0644 -p \ - $(WISH_CONTENTS)/Resources/Wish\ Shell.rsrc \ + $(WISH_CONTENTS)/Resources/$(WISH_NAME).rsrc \ "$(PD_APP_CONTENTS)/Resources" install -d "$(PD_APP_CONTENTS)/Frameworks" cp -Rp $(WISH_CONTENTS)/Frameworks "$(PD_APP_CONTENTS)" @@ -87,11 +119,14 @@ rez_install: cd $(bindir) && /Developer/tools/Rez -t APPL mac.r -o pd +darwin_app_embed_libs: + ./embed-MacOSX-dependencies.sh $(PD_APP_CONTENTS) + + #------------------------------------------------------------------------------# darwin_app_core: darwin_app_wrapper - export MACOSX_DEPLOYMENT_TARGET=10.3 cd $(packages_src) && \ - make $(DEST_PATHS) PD_CONFIGURE_FLAGS=--enable-jack pd_install + $(MAKE) $(DEST_PATHS) PD_CONFIGURE_FLAGS=--enable-jack pd_install cd "$(PD_APP_CONTENTS)/Resources/Scripts" && \ ln -s ../bin/pd.tk AppMain.tcl # support for Info Panel Plugins mgmt @@ -117,9 +152,6 @@ darwin_app_doc_format: # #==============================================================================# -extended_install: - cd $(packages_src) && make $(DEST_PATHS) install - #------------------------------------------------------------------------------# darwin_app_externals: darwin_app_externals_standard darwin_app_externals_c++ darwin_app_externals_flext @@ -147,40 +179,43 @@ package: dmg DMG_NAME = $(PACKAGE_NAME) dmg: darwin_app_perms install -d "$(CWD)/$(DMG_NAME)" - cd $(BUILD_BASE) && mv $(PD_APP_NAME).app "$(CWD)/$(DMG_NAME)/" install -p -m0444 $(manualsdir)/Pd/Pd-LICENSE.txt \ $(manualsdir)/Pd/License.html \ $(manualsdir)/Pd/Welcome.html \ $(manualsdir)/Pd/ReadMe.html \ "$(CWD)/$(DMG_NAME)" + cd $(BUILD_BASE) && mv $(PD_APP_NAME).app "$(CWD)/$(DMG_NAME)/" install -p -m0444 org.puredata.pd.plist "$(CWD)/$(DMG_NAME)" cd $(CWD) && /bin/sh mkdmg "$(DMG_NAME)" -clean: darwin_app_clean darwin_app_externals_flext_clean \ - cd $(packages_src) && make clean + +distclean: clean + cd $(packages_src) && $(MAKE) $(DEST_PATHS) distclean + + +clean: darwin_app_clean + cd $(packages_src) && $(MAKE) $(DEST_PATHS) clean -rm Info.plist darwin_app_clean: - -sudo rm -Rf -- $(PD_APP_CONTENTS)/Frameworks + -chmod -R u+w $(PD_APP_CONTENTS)/Frameworks + -rm -rf -- $(PD_APP_CONTENTS)/Frameworks -rm -f -- $(PD_APP_CONTENTS)/Plugins $(PD_APP_CONTENTS)/Info.plist -rm -f -- $(PD_APP_CONTENTS)/MacOS/Pd -rmdir $(PD_APP_CONTENTS)/MacOS -rm -f -- $(PD_APP_CONTENTS)/Resources/Scripts/AppMain.tcl -rmdir $(PD_APP_CONTENTS)/Resources/Scripts + -rm -f -- $(WISH_CONTENTS)/Resources/$(WISH_NAME).rsrc \ + $(WISH_CONTENTS)/Resources/pd*.icns + -rmdir $(PD_APP_CONTENTS)/Resources -rm -f -- $(DESTDIR) -rm -f -- *~ 1 $(README_FILE) $(WELCOME_FILE) $(LICENSE_FILE) \ $(UNIX_PACKAGE_NAME).pkg "$(DMG_NAME).dmg" -darwin_app_externals_flext_clean: - cd $(externals_src)/footils/syncgrain && make -f makefile.pd-darwin clean - -cd $(externals_src)/grill && \ - rm -- flext/buildsys/config-mac-pd-gcc.txt config.txt flext/config.txt \ - flext/source/libflext.a */pd-darwin/*.o */pd-darwin/*/*.o \ - */pd-darwin/*/*.pd_darwin */pd-darwin/*.pd_darwin \ - */pd-darwin/release-shared/*.dylib */pd-darwin/release-shared/*.opp + @@ -210,79 +245,84 @@ test_locations: # #==============================================================================# +darwin_app_externals_flext_clean: + @echo " " + @echo "Deprecated!!" + @echo "cd $(packages_src) && $(MAKE) flext_clean" + darwin_app_externals_flext: @echo " " @echo "Deprecated!!" - @echo "cd $(packages_src) && make flext_install" - cd $(packages_src) && make $(DEST_PATHS) flext_install + @echo "cd $(packages_src) && $(MAKE) flext_install" + cd $(packages_src) && $(MAKE) $(DEST_PATHS) flext_install darwin_app_noncvs: @echo " " @echo "Deprecated!!" - @echo "cd $(packages_src) && make noncvs_install" - cd $(packages_src) && make $(DEST_PATHS) noncvs_install + @echo "cd $(packages_src) && $(MAKE) noncvs_install" + cd $(packages_src) && $(MAKE) $(DEST_PATHS) noncvs_install darwin_app_externals_gem_clean: @echo " " @echo "Deprecated!!" - @echo "cd $(packages_src) && make gem_clean" + @echo "cd $(packages_src) && $(MAKE) gem_clean" darwin_app_externals_gem: @echo " " @echo "Deprecated!!" - @echo "cd $(packages_src) && make gem_install" + @echo "cd $(packages_src) && $(MAKE) gem_install" darwin_app_externals_standard_clean: @echo " " @echo "Deprecated!!" - @echo "cd $(packages_src) && make externals_clean" + @echo "cd $(packages_src) && $(MAKE) externals_clean" darwin_pd_clean: @echo " " @echo "Deprecated!!" - @echo "cd $(packages_src) && make pd_clean" + @echo "cd $(packages_src) && $(MAKE) pd_clean" darwin_app_externals: @echo " " @echo "Deprecated!!" - @echo "cd $(externals_src) && make install" + @echo "cd $(externals_src) && $(MAKE) install" darwin_app_externals_standard: @echo " " @echo "Deprecated!!" - @echo "cd $(externals_src) && make install" + @echo "cd $(externals_src) && $(MAKE) install" darwin_patch_pd: @echo " " @echo "Deprecated!!" - @echo "cd .. && make patch_pd" + @echo "cd .. && $(MAKE) patch_pd" darwin_unpatch_pd: @echo " " @echo "Deprecated!!" - @echo "cd .. && make unpatch_pd" + @echo "cd .. && $(MAKE) unpatch_pd" darwin_app_docs: @echo " " @echo "Deprecated!!" - @echo "cd $(doc_src) && make install" + @echo "cd $(doc_src) && $(MAKE) install" darwin_app_license: @echo " " @echo "Deprecated!!" - @echo "cd .. && make license" + @echo "cd .. && $(MAKE) license" darwin_app_welcome: @echo " " @echo "Deprecated!!" - @echo "cd .. && make welcome" + @echo "cd .. && $(MAKE) welcome" darwin_app_readme: @echo " " @echo "Deprecated!!" - @echo "cd .. && make readme" + @echo "cd .. && $(MAKE) readme" darwin_prebuilt_app: @echo " " diff --git a/packages/darwin_app/TODO b/packages/darwin_app/TODO index c9dfd820..30db65cc 100644 --- a/packages/darwin_app/TODO +++ b/packages/darwin_app/TODO @@ -4,31 +4,57 @@ - research Tcl "auto_path" + - make Pd open a new window when its launched to workaround the bug where the menus don't work until a window is opened. + - otool dylib help: http://qin.laya.com/tech_coding_help/dylib_linking.html -- from Carmen Rocco about [fiddle~] crash: "is fiddle~: * compiled with the same header * linked with the same binary of (lib)pd * compiled with the same compiler? i had very similar issues with bonk on windows (Virtually same stacktrace but s/fiddle/bonk) until fixing the above 3 things..." + http://doc.trolltech.com/qq/qq09-mac-deployment.html + + Now that we have copied the Qt library into the bundle, we must update + both the library and the executable so that they know where they can be + found. This is where the install_name_tool command-line tool comes in + handy. For the Qt library: + + install_name_tool \ + -id @executable_path/../Frameworks/libqt.3.dylib \ + demo.app/Contents/Frameworks/libqt.3.dylib + + otool -L oggcast~.pd_darwin | grep /sw/ | sed -n 's|.*/sw/lib/\(.*\.dylib\).*|\1|p' + + +- from Carmen Rocco about [fiddle~] crash: "is fiddle~: * compiled with the + same header * linked with the same binary of (lib)pd * compiled with the + same compiler? i had very similar issues with bonk on windows (Virtually + same stacktrace but s/fiddle/bonk) until fixing the above 3 things..." + - review permissions so that you can build on top on existing builds (its the Frameworks) + - add standard paths to included org.puredata.pd.plist following these guidelines: http://developer.apple.com/documentation/MacOSX/Conceptual/BPFileSystem/Articles/WhereToPutFiles.html + - Pd should then test to see if Jack is available before switching to it, otherwise it'll just crash. Here's apple's method of testing: http://developer.apple.com/documentation/mac/runtimehtml/RTArch-43.html + - try this for the Pref Pane: kAEShowPreferences ::tk::mac::ShowPreferences + - research Tk + "Custom MDEF" for menus + - create Tcl script called from Prefs that creates links for the standard unix + - redo menu system - the menus are the same for all windows - instead of hiding menus, grey-out/disable menu items on Pd window @@ -37,19 +63,23 @@ http://developer.apple.com/documentation/MacOSX/Conceptual/BPFileSystem/Articles - flash menu when accelerator hits - fix edit mode menu item (make it a checkbox or change to "play mode" + - redo key mapping system - make Cmd-Delete also delete, as well as just Delete, so that my Finder key command habits work in Pd as well - make Cmd-click work like Ctrl-click + - write script to convert from -DMACOSX to -D__APPLE__ where ever possible (check out __gnu_linux__ and WIN32 while I am at it) and submit to miller + - instead of shipping Pd.app with a org.puredata.pd.plist, make a script that uses the "defaults" command to add the desired prefs to any existing file. (its a good idea, but unforunately, the key names prevent that from working, i.e. loadlib1, loadlib2, etc) + ------------------------------------------------------------------------------ semi-abandoned TODOs diff --git a/packages/darwin_app/embed-MacOSX-dependencies.sh b/packages/darwin_app/embed-MacOSX-dependencies.sh new file mode 100755 index 00000000..0d4d3022 --- /dev/null +++ b/packages/darwin_app/embed-MacOSX-dependencies.sh @@ -0,0 +1,54 @@ +#!/bin/sh +# +# This script finds all of the dependecies from Fink and included them into +# the Pd.app. +# +# run it in the root directory where the externals are stored, i.e. "extra" + + +if [ $# -ne 1 ]; then + echo "Usage: $0 Pd.app-Contents" + echo " i.e. $0 /Applications/Pd.app/Contents/" + exit +fi + +LIB_DIR=lib +PD_APP_CONTENTS=$1 +PD_APP_LIB=$PD_APP_CONTENTS/$LIB_DIR + +#echo "PD_APP_CONTENTS: $PD_APP_CONTENTS" +#echo "PD_APP_LIB: $PD_APP_LIB" + +echo " " + +for pd_darwin in `find $PD_APP_CONTENTS -name '*.pd_darwin'`; do + LIBS=`otool -L $pd_darwin | sed -n 's|.*/sw/lib/\(.*\.dylib\).*|\1|p'` + if [ "x$LIBS" != "x" ]; then + echo "`echo $pd_darwin | sed 's|.*/\(.*\.pd_darwin$\)|\1|'` is using:" + for lib in $LIBS; do + echo -e "\t$lib" + install -d $PD_APP_LIB + install -p /sw/lib/$lib $PD_APP_LIB + # @executable_path starts from Contents/Resources/bin/pd + install_name_tool -id @executable_path/../../$LIB_DIR/$lib $PD_APP_LIB/$lib + install_name_tool -change /sw/lib/$lib @executable_path/../../$LIB_DIR/$lib $pd_darwin + done + echo " " + fi +done + +for dylib in $PD_APP_LIB/*.dylib; do + LIBS=`otool -L $dylib | sed -n 's|.*/sw/lib/\(.*\.dylib\).*|\1|p'` + if [ "x$LIBS" != "x" ]; then + echo "`echo $dylib | sed 's|.*/\(.*\.dylib\)|\1|'` is using:" + for lib in $LIBS; do + echo -e "\t$lib" + install -p /sw/lib/$lib $PD_APP_LIB + # @executable_path starts from Contents/Resources/bin/pd + install_name_tool -id @executable_path/../../$LIB_DIR/$lib $PD_APP_LIB/$lib + install_name_tool -change /sw/lib/$lib @executable_path/../../$LIB_DIR/$lib $dylib + done + echo " " + fi +done + diff --git a/packages/darwin_app/org.puredata.pd.plist b/packages/darwin_app/org.puredata.pd.plist index 4d5b7583..acdb29ac 100644 --- a/packages/darwin_app/org.puredata.pd.plist +++ b/packages/darwin_app/org.puredata.pd.plist @@ -7,9 +7,9 @@ loadlib1 Gem loadlib2 - cyclone + zexy loadlib3 - iemabs + cyclone loadlib4 iemmatrix loadlib5 @@ -29,7 +29,7 @@ loadlib12 xsample loadlib13 - zexy + markex loadlib14 maxlib loadlib15 @@ -37,8 +37,6 @@ loadlib16 motex loadlib17 - loaders - loadlib18 - markex + iemabs -- cgit v1.2.1