[66399] trunk/dports/aqua/gimp-app

jmr at macports.org jmr at macports.org
Sun Apr 11 01:43:20 PDT 2010


Revision: 66399
          http://trac.macports.org/changeset/66399
Author:   jmr at macports.org
Date:     2010-04-11 01:43:16 -0700 (Sun, 11 Apr 2010)
Log Message:
-----------
gimp-app: patch to build for 64-bit (#21718), use notes

Modified Paths:
--------------
    trunk/dports/aqua/gimp-app/Portfile

Added Paths:
-----------
    trunk/dports/aqua/gimp-app/files/patch-main.c.diff

Modified: trunk/dports/aqua/gimp-app/Portfile
===================================================================
--- trunk/dports/aqua/gimp-app/Portfile	2010-04-11 07:01:21 UTC (rev 66398)
+++ trunk/dports/aqua/gimp-app/Portfile	2010-04-11 08:43:16 UTC (rev 66399)
@@ -23,6 +23,8 @@
                 gimp.app.skel.tar.gz md5 66ad4912a3c71056c479c8eeef11fd43
 worksrcdir      ScriptExec
 
+patchfiles      patch-main.c.diff
+
 pre-patch {
     foreach f {Info.plist PkgInfo} {
         delete ${workpath}/Gimp.app/Contents/$f
@@ -33,7 +35,7 @@
     reinplace "s|__VERSION__|${version}|g" ${workpath}/Gimp.app/Contents/Info.plist
 }
 
-patch {
+post-patch {
     reinplace "s|`dirname \\\\\"\$0\\\\\"`|${prefix}|g" \
         ${workpath}/Gimp.app/Contents/Resources/openDoc \
         ${workpath}/Gimp.app/Contents/Resources/script
@@ -64,34 +66,15 @@
     copy ${workpath}/Gimp.app ${destroot}${applications_dir}
 }
 
-post-install {
-    ui_msg "
-    If you are having problems viewing the help files when using Gimp.app,
-	    1- Make sure you have the user manual installed (port gimp-user-manual)
-	    2- Add the following line to ~/.gimp-2.6/gimprc :
-	    	(help-locales \"LANG\")
-	    		where LANG is your two-letters locale (fr, en, jp, ...)
-    "
-}
+notes "
+If you are having problems viewing the help files when using Gimp.app,
+    1- Make sure you have the user manual installed (port gimp-user-manual)
+    2- Add the following line to ~/.gimp-2.6/gimprc :
+        (help-locales \"LANG\")
+       where LANG is your two-letters locale (fr, en, jp, ...)
+"
 
-# Does not build 64-bit due to Carbon
-if [info exists supported_archs] {
-    supported_archs i386 ppc
-}
-if [info exists depends_skip_archcheck] {
-    depends_skip_archcheck gimp2
-}
-switch ${configure.build_arch} {
-    x86_64 {
-        configure.build_arch i386
-    }
-    ppc64 {
-        configure.build_arch ppc
-    }
-}
-
 variant quartz {
-    patch {}
     destroot {
         foreach f {openDoc script} {
             delete ${workpath}/Gimp.app/Contents/Resources/$f

Added: trunk/dports/aqua/gimp-app/files/patch-main.c.diff
===================================================================
--- trunk/dports/aqua/gimp-app/files/patch-main.c.diff	                        (rev 0)
+++ trunk/dports/aqua/gimp-app/files/patch-main.c.diff	2010-04-11 08:43:16 UTC (rev 66399)
@@ -0,0 +1,215 @@
+--- main.c.orig	2010-04-11 18:34:17.000000000 +1000
++++ main.c	2010-04-11 18:33:55.000000000 +1000
+@@ -65,14 +65,13 @@ static void *OpenDoc(void *arg);
+ static OSErr ExecuteScript(char *script, pid_t *pid);
+ 
+ static void  GetParameters(void);
+-static char* GetScript(void);
+-static char* GetOpenDoc(void);
++static unsigned char* GetScript(void);
++static unsigned char* GetOpenDoc(void);
+ 
+ OSErr LoadMenuBar(char *appName);
+ 
+-static OSStatus FSMakePath(FSSpec file, char *path, long maxPathSize);
+-static void RedFatalAlert(Str255 errorString, Str255 expStr);
+-static short DoesFileExist(char *path);
++static void RedFatalAlert(CFStringRef errorString, CFStringRef expStr);
++static short DoesFileExist(unsigned char *path);
+ 
+ static OSErr AppQuitAEHandler(const AppleEvent *theAppleEvent,
+                               AppleEvent *reply, long refCon);
+@@ -134,12 +133,12 @@ int main(int argc, char* argv[])
+                                NewEventHandlerUPP(X11FailedHandler), 1,
+                                &events, NULL, NULL);
+ 
+-    if (err) RedFatalAlert("\pInitialization Error",
+-                           "\pError initing Apple Event handlers.");
++    if (err) RedFatalAlert(CFSTR("Initialization Error"),
++                           CFSTR("Error initing Apple Event handlers."));
+ 
+     //create the menu bar
+-    if (err = LoadMenuBar(NULL)) RedFatalAlert("\pInitialization Error",
+-                                               "\pError loading MenuBar.nib.");
++    if (err = LoadMenuBar(NULL)) RedFatalAlert(CFSTR("Initialization Error"),
++                                               CFSTR("Error loading MenuBar.nib."));
+     
+     GetParameters(); //load data from files containing exec settings
+ 
+@@ -212,28 +211,27 @@ static OSErr ExecuteScript (char *script
+ ///////////////////////////////////////
+ static void GetParameters (void)
+ {
+-    char *str;
+-    if (! (str = (char *)GetScript())) //get path to script to be executed
+-        RedFatalAlert("\pInitialization Error",
+-                      "\pError getting script from application bundle.");
++    unsigned char *str;
++    if (! (str = GetScript())) //get path to script to be executed
++        RedFatalAlert(CFSTR("Initialization Error"),
++                      CFSTR("Error getting script from application bundle."));
+     strcpy((char *)&scriptPath, str);
+     
+     if (! (str = (char *)GetOpenDoc())) //get path to openDoc
+-        RedFatalAlert("\pInitialization Error",
+-                      "\pError getting openDoc from application bundle.");
++        RedFatalAlert(CFSTR("Initialization Error"),
++                      CFSTR("Error getting openDoc from application bundle."));
+     strcpy((char *)&openDocPath, str);
+ }
+ 
+ ///////////////////////////////////////
+ // Get path to the script in Resources folder
+ ///////////////////////////////////////
+-static char* GetScript (void)
++static unsigned char* GetScript (void)
+ {
+     CFStringRef fileName;
+     CFBundleRef appBundle;
+     CFURLRef scriptFileURL;
+     FSRef fileRef;
+-    FSSpec fileSpec;
+     char *path;
+ 
+     //get CF URL for script
+@@ -250,14 +248,10 @@ static char* GetScript (void)
+     //dispose of the CF variables
+     CFRelease(scriptFileURL);
+     CFRelease(fileName);
+-    
+-    //convert FSRef to FSSpec
+-    if (FSGetCatalogInfo(&fileRef, kFSCatInfoNone, NULL, NULL, &fileSpec,
+-                         NULL)) return NULL;
+-        
++
+     //create path string
+     if (! (path = malloc(kMaxPathLength))) return NULL;
+-    if (FSMakePath(fileSpec, path, kMaxPathLength)) return NULL;
++    if (FSRefMakePath(&fileRef, path, kMaxPathLength)) return NULL;
+     if (! DoesFileExist(path)) return NULL;
+     
+     return path;
+@@ -266,13 +260,12 @@ static char* GetScript (void)
+ ///////////////////////////////////////
+ // Gets the path to openDoc in Resources folder
+ ///////////////////////////////////////
+-static char* GetOpenDoc (void)
++static unsigned char* GetOpenDoc (void)
+ {
+     CFStringRef fileName;
+     CFBundleRef appBundle;
+     CFURLRef openDocFileURL;
+     FSRef fileRef;
+-    FSSpec fileSpec;
+     char *path;
+     
+     //get CF URL for openDoc
+@@ -290,13 +283,9 @@ static char* GetOpenDoc (void)
+     CFRelease(openDocFileURL);
+     CFRelease(fileName);
+         
+-    //convert FSRef to FSSpec
+-    if (FSGetCatalogInfo(&fileRef, kFSCatInfoNone, NULL, NULL, &fileSpec,
+-                         NULL)) return NULL;
+-
+     //create path string
+     if (! (path = malloc(kMaxPathLength))) return NULL;
+-    if (FSMakePath(fileSpec, path, kMaxPathLength)) return NULL;
++    if (FSRefMakePath(&fileRef, path, kMaxPathLength)) return NULL;
+     if (! DoesFileExist(path)) return NULL;
+     
+     return path;
+@@ -321,36 +310,28 @@ OSErr LoadMenuBar (char *appName)
+ 
+ #pragma mark -
+ 
+-///////////////////////////////////////
+-// Generate path string from FSSpec record
+-///////////////////////////////////////
+-static OSStatus FSMakePath(FSSpec file, char *path, long maxPathSize)
+-{
+-    OSErr err = noErr;
+-    FSRef fileRef;
+-
+-    //create file reference from file spec
+-    if (err = FSpMakeFSRef(&file, &fileRef)) return err;
+-
+-    // and then convert the FSRef to a path
+-    return FSRefMakePath(&fileRef, path, maxPathSize);
+-}
+-
+ ////////////////////////////////////////
+ // Standard red error alert, then exit application
+ ////////////////////////////////////////
+-static void RedFatalAlert (Str255 errorString, Str255 expStr)
++static void RedFatalAlert (CFStringRef errorString, CFStringRef expStr)
+ {
+-    StandardAlert(kAlertStopAlert, errorString,  expStr, NULL, NULL);
++    DialogRef theAlert;
++    DialogItemIndex itemIndex;
++
++    CreateStandardAlert(kAlertStopAlert,
++                errorString, expStr,
++                NULL, &theAlert);
++    RunStandardAlert(theAlert, NULL, &itemIndex);
++    
+     ExitToShell();
+ }
+ 
+ ///////////////////////////////////////
+ // Determines whether file exists at path or not
+ ///////////////////////////////////////
+-static short DoesFileExist (char *path)
++static short DoesFileExist (unsigned char *path)
+ {
+-    if (access(path, F_OK) == -1) return false;
++    if (access((char *)path, F_OK) == -1) return false;
+     return true;	
+ }
+ 
+@@ -396,7 +377,7 @@ static OSErr AppOpenDocAEHandler(const A
+     short i;
+     long count, actualSize;
+         
+-    FSSpec fileSpec;
++    FSRef fileRef;
+     char path[kMaxPathLength];
+     
+     while (numArgs > 0) free(fileArgs[numArgs--]);
+@@ -408,12 +389,12 @@ static OSErr AppOpenDocAEHandler(const A
+     err = AECountItems(&fileSpecList, &count); //Count number of files
+                 
+     for (i = 1; i <= count; i++) { //iteratively process each file
+-        //get fsspec from apple event
+-        if (! (err = AEGetNthPtr(&fileSpecList, i, typeFSS, &keyword, &type,
+-                                 (Ptr)&fileSpec, sizeof(FSSpec), &actualSize)))
++        //get fsref from apple event
++        if (! (err = AEGetNthPtr(&fileSpecList, i, typeFSRef, &keyword, &type,
++                                 (Ptr)&fileRef, sizeof(FSRef), &actualSize)))
+         {
+             //get path from file spec
+-            if ((err = FSMakePath(fileSpec, (unsigned char *)&path,
++            if ((err = FSRefMakePath(&fileRef, (unsigned char *)&path,
+                                   kMaxPathLength))) return err;
+                             
+             if (numArgs == kMaxArgumentsToScript) break;
+@@ -441,6 +422,8 @@ static OSErr AppOpenAppAEHandler(const A
+ 	
+     // the app has been opened without any items dragged on to it
+     pthread_create(&tid, NULL, Execute, NULL);
++    
++    return noErr;
+ }
+ 
+ //////////////////////////////////
+@@ -454,8 +437,8 @@ static OSStatus X11FailedHandler(EventHa
+     pthread_join(tid, NULL);
+     if (odtid) pthread_join(odtid, NULL);
+ 
+-    RedFatalAlert("\pFailed to start X11",
+-                  "\pGimp.app requires Apple's X11.");
++    RedFatalAlert("Failed to start X11",
++                  "Gimp.app requires Apple's X11.");
+ 
+     return noErr;
+ }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100411/712d5ff5/attachment.html>


More information about the macports-changes mailing list