[43393] trunk/dports/x11/xorg-server

jeremyhu at macports.org jeremyhu at macports.org
Wed Dec 10 02:01:22 PST 2008


Revision: 43393
          http://trac.macports.org/changeset/43393
Author:   jeremyhu at macports.org
Date:     2008-12-10 02:01:20 -0800 (Wed, 10 Dec 2008)
Log Message:
-----------
xorg-server: Pulled in some patches from git that I just pushed to fix Tiger support.  I now have this port running on Tiger.

Modified Paths:
--------------
    trunk/dports/x11/xorg-server/Portfile
    trunk/dports/x11/xorg-server/files/prefix.patch

Modified: trunk/dports/x11/xorg-server/Portfile
===================================================================
--- trunk/dports/x11/xorg-server/Portfile	2008-12-10 08:53:19 UTC (rev 43392)
+++ trunk/dports/x11/xorg-server/Portfile	2008-12-10 10:01:20 UTC (rev 43393)
@@ -4,7 +4,7 @@
 
 name		xorg-server
 version		1.4.2-apple27
-revision	1
+revision	2
 categories	x11 devel
 maintainers	jeremyhu
 description	The X.org / Xquartz X server.
@@ -97,10 +97,6 @@
 	ln -s Xquartz ${destroot}${prefix}/bin/X
 }
 
-post-install {
-	ui_msg "This server has only been tested on Leopard.  It should run on Tiger, but it has not been tested.  Feedback would be very appreciated if you use this port."
-}
-
 platform macosx {
 	if {${os.major} < 9} {
 		# Xplugin.h is missing on Tiger
@@ -108,5 +104,9 @@
 
 		# GLX doesn't work right on Tiger
 		configure.args-append --disable-glx
+
+		post-install {
+			ui_msg "This server not been thuroughly tested on Tiger.  Your feedback would be welcomed on x11-users at macosforge.org."
+		}
 	}
 }

Modified: trunk/dports/x11/xorg-server/files/prefix.patch
===================================================================
--- trunk/dports/x11/xorg-server/files/prefix.patch	2008-12-10 08:53:19 UTC (rev 43392)
+++ trunk/dports/x11/xorg-server/files/prefix.patch	2008-12-10 10:01:20 UTC (rev 43393)
@@ -52,6 +52,144 @@
  
  #ifndef XSERVER_VERSION
  #define XSERVER_VERSION "?"
+diff --git hw/xquartz/X11Controller.m hw/xquartz/X11Controller.m
+index 67a80d3..7222f46 100644
+--- hw/xquartz/X11Controller.m
++++ hw/xquartz/X11Controller.m
+@@ -314,65 +314,79 @@ BOOL xquartz_resetenv_display = NO;
+ 
+ - (void) launch_client:(NSString *)filename
+ {
+-  const char *command = [filename UTF8String];
+-  const char *argv[7];
+-  int child1, child2 = 0;
+-  int status;
+-	
+-  argv[0] = "/usr/bin/login";
+-  argv[1] = "-fp";
+-  argv[2] = getlogin();
+-  argv[3] = [X11App prefs_get_string:@PREFS_LOGIN_SHELL default:"/bin/sh"];
+-  argv[4] = "-c";
+-  argv[5] = command;
+-  argv[6] = NULL;
+-
+-  /* Do the fork-twice trick to avoid having to reap zombies */
++    const char *command = [filename UTF8String];
++    int child1, child2 = 0;
++    int status;
++    char newcommand[1024];
++    char *newargv[1024];
++    char buf[128];
++    size_t newargc;
++    char *s;
+     
+-  child1 = fork();
++    if(strlen(command) > 1023) {
++        fprintf(stderr, "Error: command is too long: %s\n", command);
++        return;
++    }
++    
++    strlcpy(newcommand, command, 1024);
+     
+-  switch (child1) {
+-  case -1:                                /* error */
+-    break;
++    for(newargc=0, s=newcommand; *s; newargc++) {
++        for(; *s && *s == ' '; s++);
++        if(!*s)
++            break;
++        
++        newargv[newargc] = s;
++        for(; *s && *s != ' '; s++);
++        
++        if(*s) {
++            *s='\0';
++            s++;
++        }
++    }
++    newargv[newargc] = NULL;
++    
++    s = getenv("DISPLAY");
++    if (xquartz_resetenv_display || s == NULL || s[0] == 0) {
++        snprintf(buf, sizeof(buf), ":%s", display);
++        setenv("DISPLAY", buf, TRUE);
++    }
++
++    /* Do the fork-twice trick to avoid having to reap zombies */
++    child1 = fork();
++    switch (child1) {
++        case -1:                                /* error */
++            break;
+       
+-  case 0:                                 /* child1 */
+-    child2 = fork();
++        case 0:                                 /* child1 */
++            child2 = fork();
+       
+-    switch (child2) {
+-      int max_files, i;
+-      char buf[1024], *temp;
+-	
+-    case -1:                            /* error */
+-      _exit(1);
+-	
+-    case 0:                             /* child2 */
+-      /* close all open files except for standard streams */
+-      max_files = sysconf(_SC_OPEN_MAX);
+-      for (i = 3; i < max_files; i++)	close(i);
+-	
+-      /* ensure stdin is on /dev/null */
+-      close(0);
+-      open("/dev/null", O_RDONLY);
+-	
+-      /* Setup environment */
+-      temp = getenv("DISPLAY");
+-      if (xquartz_resetenv_display || temp == NULL || temp[0] == 0) {
+-    snprintf(buf, sizeof(buf), ":%s", display);
+-	setenv("DISPLAY", buf, TRUE);
+-      }
+-
+-      execvp(argv[0], (char **const) argv);
+-	
+-      _exit(2);
+-	
+-    default:                            /* parent (child1) */
+-      _exit(0);
+-    }
+-    break;
++            switch (child2) {
++                int max_files, i;
++	
++                case -1:                            /* error */
++                    _exit(1);
++	 
++                case 0:                             /* child2 */
++                /* close all open files except for standard streams */
++                max_files = sysconf(_SC_OPEN_MAX);
++                for(i = 3; i < max_files; i++)
++                    close(i);
++	
++                /* ensure stdin is on /dev/null */
++                close(0);
++                open("/dev/null", O_RDONLY);
++	
++                execvp(newargv[0], (char **const) newargv);
++                _exit(2);
++	
++                default:                            /* parent (child1) */
++                _exit(0);
++            }
++            break;
+       
+-  default:                                /* parent */
+-    waitpid(child1, &status, 0);
+-  }
++        default:                                /* parent */
++            waitpid(child1, &status, 0);
++    }
+ }
+ 
+ - (void) app_selected:sender
 diff --git hw/xquartz/bundle/Info.plist hw/xquartz/bundle/Info.plist
 deleted file mode 100644
 index f4a9287..0000000
@@ -99,7 +237,7 @@
 -</plist>
 diff --git hw/xquartz/bundle/Info.plist.cpp hw/xquartz/bundle/Info.plist.cpp
 new file mode 100644
-index 0000000..16434f2
+index 0000000..9713289
 --- /dev/null
 +++ hw/xquartz/bundle/Info.plist.cpp
 @@ -0,0 +1,39 @@
@@ -110,7 +248,7 @@
 +	<key>CFBundleDevelopmentRegion</key>
 +		<string>English</string>
 +	<key>CFBundleExecutable</key>
-+		<string>X11</string>
++		<string>X11.sh</string>
 +	<key>CFBundleGetInfoString</key>
 +		<string>APPLE_APPLICATION_NAME</string>
 +	<key>CFBundleIconFile</key>
@@ -143,10 +281,10 @@
 +</dict>
 +</plist>
 diff --git hw/xquartz/bundle/Makefile.am hw/xquartz/bundle/Makefile.am
-index 7b76f84..e765d6e 100644
+index 7b76f84..03fa1dd 100644
 --- hw/xquartz/bundle/Makefile.am
 +++ hw/xquartz/bundle/Makefile.am
-@@ -1,12 +1,23 @@
+@@ -1,12 +1,24 @@
 +include cpprules.in
 +
 +CPP_FILES_FLAGS = \
@@ -168,10 +306,20 @@
  EXTRA_DIST = \
  	mk_bundke.sh \
 -	Info.plist \
++	X11.sh \
 +	Info.plist.cpp \
  	PkgInfo \
  	$(resource_DATA) \
  	Resources/da.lproj/InfoPlist.strings \
+diff --git hw/xquartz/bundle/X11.sh hw/xquartz/bundle/X11.sh
+new file mode 100755
+index 0000000..5e00a82
+--- /dev/null
++++ hw/xquartz/bundle/X11.sh
+@@ -0,0 +1,3 @@
++#!/bin/bash --login
++
++"$(dirname $0)"/X11 "${@}"
 diff --git hw/xquartz/bundle/cpprules.in hw/xquartz/bundle/cpprules.in
 new file mode 100644
 index 0000000..f32eafc
@@ -215,8 +363,22 @@
 +
 +.man.$(APP_MAN_SUFFIX):
 +	$(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
+diff --git hw/xquartz/bundle/mk_bundke.sh hw/xquartz/bundle/mk_bundke.sh
+index 0b2a144..5c5733a 100755
+--- hw/xquartz/bundle/mk_bundke.sh
++++ hw/xquartz/bundle/mk_bundke.sh
+@@ -20,6 +20,9 @@ install -m 644 Resources/X11.icns ${BUNDLE_ROOT}/Contents/Resources
+ install -m 644 Info.plist ${BUNDLE_ROOT}/Contents
+ install -m 644 PkgInfo ${BUNDLE_ROOT}/Contents
+ 
++mkdir -p ${BUNDLE_ROOT}/Contents/MacOS
++install -m 755 X11.sh ${BUNDLE_ROOT}/Contents/MacOS
++
+ if [[ $(id -u) == 0 ]] ; then
+ 	chown -R root:admin ${BUNDLE_ROOT}
+ fi
 diff --git hw/xquartz/mach-startup/bundle-main.c hw/xquartz/mach-startup/bundle-main.c
-index 0e4ed34..6b48c13 100644
+index 0e4ed34..7677a9a 100644
 --- hw/xquartz/mach-startup/bundle-main.c
 +++ hw/xquartz/mach-startup/bundle-main.c
 @@ -59,8 +59,8 @@ extern int noPanoramiXExtension;
@@ -277,7 +439,7 @@
          setenv("PATH", buf, TRUE);
      }
 +}
- 
++
 +static void setup_env() {
 +    char *temp;
 +    const char *pds = NULL;
@@ -297,7 +459,7 @@
 +            }
 +        }
 +    }
-+
+ 
 +    /* If we're not org.x.X11, we want to unset DISPLAY, so we don't
 +     * use the launchd DISPLAY socket.
 +     */
@@ -333,3 +495,78 @@
      
      fprintf(stderr, "X11.app: main(): argc=%d\n", argc);
      for(i=0; i < argc; i++) {
+@@ -505,22 +529,39 @@ int main(int argc, char **argv, char **envp) {
+     
+     return EXIT_SUCCESS;
+ }
+-    
+-static int execute(const char *command) {
+-    const char *newargv[7];
+-    const char **s;
+ 
+-    newargv[0] = "/usr/bin/login";
+-    newargv[1] = "-fp";
+-    newargv[2] = getlogin();
+-    newargv[3] = command_from_prefs("login_shell", DEFAULT_SHELL);
+-    newargv[4] = "-c";
+-    newargv[5] = command;
+-    newargv[6] = NULL;
++static int execute(const char *command) {
++    char newcommand[1024];
++    char *newargv[1024];
++    size_t newargc;
++    char *s;
++    char **p;
++    
++    if(strlen(command) > 1023) {
++        fprintf(stderr, "Error: command is too long: %s\n", command);
++        return 1;
++    }
++    
++    strlcpy(newcommand, command, 1024);
++    
++    for(newargc=0, s=newcommand; *s; newargc++) {
++        for(; *s && *s == ' '; s++);
++        if(!*s)
++            break;
++        
++        newargv[newargc] = s;
++        for(; *s && *s != ' '; s++);
++        
++        if(*s) {
++            *s='\0';
++            s++;
++        }
++    }
++    newargv[newargc] = NULL;
+     
+     fprintf(stderr, "X11.app: Launching %s:\n", command);
+-    for(s=newargv; *s; s++) {
+-        fprintf(stderr, "\targv[%ld] = %s\n", (long int)(s - newargv), *s);
++    for(p=newargv; *p; p++) {
++        fprintf(stderr, "\targv[%ld] = %s\n", (long int)(p - newargv), *p);
+     }
+ 
+     execvp (newargv[0], (char * const *) newargv);
+diff --git hw/xquartz/xpr/xprScreen.c hw/xquartz/xpr/xprScreen.c
+index 18406b8..b813727 100644
+--- hw/xquartz/xpr/xprScreen.c
++++ hw/xquartz/xpr/xprScreen.c
+@@ -279,7 +279,7 @@ xprAddScreen(int index, ScreenPtr pScreen)
+     
+     switch(depth) {
+         case -8: // broken
+-            FatalError("Unsupported color depth %d\n", darwinDesiredDepth);
++            FatalError("Unsupported color depth %d %d\n", darwinDesiredDepth, depth);
+             dfb->visuals = (1 << StaticGray) | (1 << GrayScale);
+             dfb->preferredCVC = GrayScale;
+             dfb->depth = 8;
+@@ -320,7 +320,7 @@ xprAddScreen(int index, ScreenPtr pScreen)
+             dfb->blueMask  = 0x000000ff;
+             break;
+         default:
+-            FatalError("Unsupported color depth %d\n", darwinDesiredDepth);
++            FatalError("Unsupported color depth %d %d\n", darwinDesiredDepth, depth);
+     }
+ 
+     if (noPseudoramiXExtension)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20081210/6493851f/attachment.html>


More information about the macports-changes mailing list