Revision: 10711
http://pure-data.svn.sourceforge.net/pure-data/?rev=10711&view=rev
Author: eighthave
Date: 2009-02-02 03:27:22 +0000 (Mon, 02 Feb 2009)
Log Message:
-----------
rebuilt procedure for finding the Wish.app on Mac OS X and made it use a Pd* glob for the embedded Wish so that the executable can have the exact same name as the app, as the Wish.app structure prefers
Modified Paths:
--------------
branches/pd-devel/0.41.4/src/s_inter.c
Modified: branches/pd-devel/0.41.4/src/s_inter.c
===================================================================
--- branches/pd-devel/0.41.4/src/s_inter.c 2009-02-02 00:49:58 UTC (rev 10710)
+++ branches/pd-devel/0.41.4/src/s_inter.c 2009-02-02 03:27:22 UTC (rev 10711)
@@ -47,6 +47,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <pthread.h>
+#include <glob.h>
#else
#include <stdlib.h>
#endif
@@ -1023,59 +1024,44 @@
if (!sys_guicmd)
{
#ifdef __APPLE__
- char *homedir = getenv("HOME"), filename[250];
+ int i;
struct stat statbuf;
- /* first look for Wish bundled with and renamed "Pd" */
- sprintf(filename, "%s/../../MacOS/Pd", guidir);
- if (stat(filename, &statbuf) >= 0)
- goto foundit;
- if (!homedir || strlen(homedir) > 150)
- goto nohomedir;
- /* Look for Wish in user's Applications. Might or might
- not be names "Wish Shell", and might or might not be
- in "Utilities" subdir. */
- sprintf(filename,
- "%s/Applications/Utilities/Wish shell.app/Contents/MacOS/Wish Shell",
- homedir);
- if (stat(filename, &statbuf) >= 0)
- goto foundit;
- sprintf(filename,
- "%s/Applications/Utilities/Wish.app/Contents/MacOS/Wish",
- homedir);
- if (stat(filename, &statbuf) >= 0)
- goto foundit;
- sprintf(filename,
- "%s/Applications/Wish shell.app/Contents/MacOS/Wish Shell",
- homedir);
- if (stat(filename, &statbuf) >= 0)
- goto foundit;
- sprintf(filename,
- "%s/Applications/Wish.app/Contents/MacOS/Wish",
- homedir);
- if (stat(filename, &statbuf) >= 0)
- goto foundit;
- nohomedir:
- /* Perform the same search among system applications. */
- strcpy(filename,
- "/usr/bin/wish");
- if (stat(filename, &statbuf) >= 0)
- goto foundit;
- strcpy(filename,
- "/Applications/Utilities/Wish Shell.app/Contents/MacOS/Wish Shell");
- if (stat(filename, &statbuf) >= 0)
- goto foundit;
- strcpy(filename,
- "/Applications/Utilities/Wish.app/Contents/MacOS/Wish");
- if (stat(filename, &statbuf) >= 0)
- goto foundit;
- strcpy(filename,
- "/Applications/Wish Shell.app/Contents/MacOS/Wish Shell");
- if (stat(filename, &statbuf) >= 0)
- goto foundit;
- strcpy(filename,
- "/Applications/Wish.app/Contents/MacOS/Wish");
- foundit:
- sprintf(cmdbuf, "\"%s\" %s/pd.tk %d\n", filename, guidir, portno);
+ glob_t glob_buffer;
+ char *homedir = getenv("HOME");
+ char embed_glob[FILENAME_MAX];
+ char embed_filename[FILENAME_MAX], home_filename[FILENAME_MAX];
+ char *wish_paths[10] = {
+ "(did not find an embedded wish)",
+ "(did not find a home directory)",
+ "/Applications/Utilities/Wish.app/Contents/MacOS/Wish",
+ "/Applications/Utilities/Wish Shell.app/Contents/MacOS/Wish Shell",
+ "/Applications/Wish.app/Contents/MacOS/Wish",
+ "/Applications/Wish Shell.app/Contents/MacOS/Wish Shell",
+ "/usr/local/bin/wish",
+ "/sw/bin/wish",
+ "/opt/bin/wish",
+ "/usr/bin/wish"
+ };
+ /* this glob is needed so the Wish executable can have the same
+ * filename as the Pd.app, i.e. 'Pd-0.42-3.app' should have a Wish
+ * executable called 'Pd-0.42-3.app/Contents/MacOS/Pd-0.42-3' */
+ sprintf(embed_glob, "%s/../../MacOS/Pd*", guidir);
+ glob_buffer.gl_matchc = 1; /* we only need one match */
+ glob(embed_glob, GLOB_LIMIT, NULL, &glob_buffer);
+ if (glob_buffer.gl_pathc > 0) {
+ strcpy(embed_filename, glob_buffer.gl_pathv[0]);
+ wish_paths[0] = embed_filename;
+ }
+ sprintf(home_filename,
+ "%s/Applications/Wish.app/Contents/MacOS/Wish",homedir);
+ wish_paths[1] = home_filename;
+ for(i=0;i<10;i++) {
+ if (sys_verbose)
+ fprintf(stderr, "Trying Wish at \"%s\"\n", wish_paths[i]);
+ if (stat(wish_paths[i], &statbuf) >= 0)
+ break;
+ }
+ sprintf(cmdbuf,"\"%s\" %s/pd.tk %d\n",wish_paths[i],guidir,portno);
#else
sprintf(cmdbuf,
"TCL_LIBRARY=\"%s/tcl/library\" TK_LIBRARY=\"%s/tk/library\" \
@@ -1099,6 +1085,7 @@
{
seteuid(getuid()); /* lose setuid priveliges */
#ifndef __APPLE__
+// TODO this seems unneeded on any platform hans(a)eds.org
/* the wish process in Unix will make a wish shell and
read/write standard in and out unless we close the
file descriptors. Somehow this doesn't make the MAC OSX
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 10710
http://pure-data.svn.sourceforge.net/pure-data/?rev=10710&view=rev
Author: eighthave
Date: 2009-02-02 00:49:58 +0000 (Mon, 02 Feb 2009)
Log Message:
-----------
removed crufty old README
Removed Paths:
-------------
trunk/packages/darwin_app/README
Deleted: trunk/packages/darwin_app/README
===================================================================
--- trunk/packages/darwin_app/README 2009-02-01 07:58:46 UTC (rev 10709)
+++ trunk/packages/darwin_app/README 2009-02-02 00:49:58 UTC (rev 10710)
@@ -1,69 +0,0 @@
-==============================================================================
- Patches
-==============================================================================
-
-Since currently, only Miller has commit permissions to the 'pd' section of the
-CVS, optional fixes and fixes necessary for building the whole Pd.app are
-included in 'packages/darwin_app/patches'. The currently used patches can be
-applied by running "make darwin_patch_pd" or unpatched using "make
-darwin_unpatch_pd".
-
-
-==============================================================================
- Compiling Pd.app
-==============================================================================
-
-To compile a standalone Pd.app, you need this stuff:
-
-______________________________
-Tcl/Tk Standalone .app
-------------------------------
-
- 1. download TclTkAquaStandalone-8.4.*.dmg from http://tcltkaqua.sourceforge.net/
- (I used 8.4.9)
- 2. mount the dmg manually, or, put TclTkAquaStandalone-8.4.*.dmg in
- packages/darwin_app and it will be automatically mounted
- 3. the Makefile will find what it needs in the mounted .dmg
-
-Tcl/Tk Frameworks
- 1. download TclTkAqua-8.4.*.dmg from http://tcltkaqua.sourceforge.net/
- (I used 8.4.9)
- 2. install Tcl/Tk.pkg in the standard location
-
-______________________________
-JackOSX
-______________________________
-
-Jack is optional. The current linking allows Jack to be "weakly" linked,
-meaning that its an optional dependency.
-
- 1. download latest JackOSX from http://www.jackosx.com/download.html
- (I used version 0.6.1)
- 2. install the .pkg in the standard location
-
-______________________________
-You will need all this stuff from CVS:
-------------------------------
- mkdir pure-data && chdir pure-data
- CVSROOT = :pserver:anonymous@cvs.sourceforge.net:/cvsroot/pure-data
- cvs co abstractions
- cvs co doc
- cvs co externals
- cvs co packages
-
-either get Pd core from CVS:
- cvs co pd
-
-or untar a tarball:
- tar xzf pd-0.38-4.src.tar.gz
- ln -s pd-0.38-4 pd
-
-______________________________
-making the Pd.app
-------------------------------
-
- In packages/darwin_app/Makefile, on line 177, you'll need to choose wheter
- you compiling from MSP source or CVS.
-
-
- The final build product will be put into build/Pd.app.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.