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

jeremyhu at macports.org jeremyhu at macports.org
Mon Dec 8 22:50:38 PST 2008


Revision: 43321
          http://trac.macports.org/changeset/43321
Author:   jeremyhu at macports.org
Date:     2008-12-08 22:50:38 -0800 (Mon, 08 Dec 2008)
Log Message:
-----------
xorg-server: Pull in a patch from git to help build easeier on macports.  Ensure PATH is correct.  Unset DISPLAY, so we don't conflict with the Leopard launchd socket.

Modified Paths:
--------------
    trunk/dports/x11/xorg-server/Portfile

Added Paths:
-----------
    trunk/dports/x11/xorg-server/files/
    trunk/dports/x11/xorg-server/files/mesa-7.0-multisample.patch
    trunk/dports/x11/xorg-server/files/prefix.patch

Modified: trunk/dports/x11/xorg-server/Portfile
===================================================================
--- trunk/dports/x11/xorg-server/Portfile	2008-12-09 06:07:45 UTC (rev 43320)
+++ trunk/dports/x11/xorg-server/Portfile	2008-12-09 06:50:38 UTC (rev 43321)
@@ -4,6 +4,7 @@
 
 name		xorg-server
 version		1.4.2-apple27
+revision	1
 categories	x11 devel
 maintainers	jeremyhu
 description	The X.org / Xquartz X server.
@@ -40,7 +41,10 @@
                 port:xorg-xcmiscproto \
                 port:xorg-xproto \
                 port:xorg-xextproto \
-                port:xorg-xtrans
+                port:xorg-xtrans \
+		port:autoconf \
+		port:automake \
+		port:libtool
 
 # This xinit dependency needs to be port: not bin: because we specifically run ${prefix}/bin/startx from bundle-main.c
 depends_run     port:xinit
@@ -50,6 +54,19 @@
                 lib:libAppleWM.7:xorg-libAppleWM \
                 lib:libXfixes.3:xorg-libXfixes
 
+patchfiles	prefix.patch
+
+post-patch {
+	reinplace "s|ensure_path(X11BINDIR);|ensure_path(X11BINDIR); ensure_path(\"${x11prefix}/bin\");|" ${worksrcpath}/hw/xquartz/mach-startup/bundle-main.c
+
+	# Yeah, there's probably a better way to do this...
+	system "cd ${worksrcpath}/.. && patch -p0 < ${filespath}/mesa-7.0-multisample.patch"
+}
+
+use_autoconf yes
+autoconf.cmd autoreconf
+autoconf.args -fvi
+
 # Otherwise glcore.h will be pulled in from glproto in /opt/local/include/GL/internal
 configure.cppflags -I${worksrcpath}/../Mesa-${mesavers}/include -I${prefix}/include
 
@@ -58,17 +75,8 @@
     set applications_dir /Applications/MacPorts
 }
 
-configure.args	--with-mesa-source=${worksrcpath}/../Mesa-${mesavers} --with-apple-applications-dir=${applications_dir} --with-fontdir=${x11prefix}/lib/X11/fonts
+configure.args	--with-mesa-source=${worksrcpath}/../Mesa-${mesavers} --with-apple-applications-dir=${applications_dir} --with-fontdir=${x11prefix}/lib/X11/fonts --with-apple-application-id=org.macports.X11
 
-post-patch {
-	reinplace "s|org.x.X11|org.macports.X11|" ${worksrcpath}/hw/xquartz/bundle/Info.plist \
-	                                          ${worksrcpath}/hw/xquartz/mach-startup/bundle-main.c \
-	                                          ${worksrcpath}/hw/xquartz/mach-startup/stub.c
-
-	reinplace "s|/usr/X11|${prefix}|" ${worksrcpath}/hw/xquartz/mach-startup/bundle-main.c \
-	                                  ${worksrcpath}/hw/xquartz/X11Application.m
-}
-
 post-destroot {
 	ln -s Xquartz ${destroot}${prefix}/bin/X
 }

Added: trunk/dports/x11/xorg-server/files/mesa-7.0-multisample.patch
===================================================================
--- trunk/dports/x11/xorg-server/files/mesa-7.0-multisample.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server/files/mesa-7.0-multisample.patch	2008-12-09 06:50:38 UTC (rev 43321)
@@ -0,0 +1,13 @@
+diff -Naurp Mesa-7.0.4.orig/src/glx/x11/glcontextmodes.c Mesa-7.0.4/src/glx/x11/glcontextmodes.c
+--- Mesa-7.0.4.orig/src/glx/x11/glcontextmodes.c	2008-11-10 15:14:25.000000000 -0800
++++ Mesa-7.0.4/src/glx/x11/glcontextmodes.c	2008-11-10 15:15:16.000000000 -0800
+@@ -185,6 +185,9 @@ _gl_copy_visual_to_context_mode( __GLcon
+     mode->transparentAlpha = config->transparentAlpha;
+     mode->transparentIndex = config->transparentIndex;
+ 
++    mode->sampleBuffers = config->nMultiSampleBuffers;
++    mode->samples = config->multiSampleSize;
++
+     mode->swapMethod = GLX_SWAP_UNDEFINED_OML;
+ 
+     mode->bindToTextureRgb = (mode->rgbMode) ? GL_TRUE : GL_FALSE;

Added: trunk/dports/x11/xorg-server/files/prefix.patch
===================================================================
--- trunk/dports/x11/xorg-server/files/prefix.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server/files/prefix.patch	2008-12-09 06:50:38 UTC (rev 43321)
@@ -0,0 +1,335 @@
+diff --git configure.ac configure.ac
+index 32ccf0c..6ce1dcd 100644
+--- configure.ac
++++ configure.ac
+@@ -64,6 +64,7 @@ AC_PROG_LEX
+ AC_PROG_YACC
+ AC_SYS_LARGEFILE
+ XORG_PROG_RAWCPP
++AC_PATH_PROG(SED,sed)
+ 
+ dnl Check for dtrace program (needed to build Xserver dtrace probes)
+ dnl Also checks for <sys/sdt.h>, since some Linux distros have an 
+@@ -470,6 +471,14 @@ AC_ARG_WITH(apple-applications-dir,AS_HELP_STRING([--with-apple-applications-dir
+ 				[ APPLE_APPLICATIONS_DIR="${withval}" ],
+ 				[ APPLE_APPLICATIONS_DIR="/Applications/Utilities" ])
+ AC_SUBST([APPLE_APPLICATIONS_DIR])
++AC_ARG_WITH(apple-application-name,AS_HELP_STRING([--with-apple-application-name=NAME], [Name for the .app (default: X11)]),
++				[ APPLE_APPLICATION_NAME="${withval}" ],
++				[ APPLE_APPLICATION_NAME="X11" ])
++AC_SUBST([APPLE_APPLICATION_NAME])
++AC_ARG_WITH(apple-application-id,AS_HELP_STRING([--with-apple-application-id=VALUE], [CFBundleIdentification for the .app (default: org.x.X11)]),
++				[ APPLE_APPLICATION_ID="${withval}" ],
++				[ APPLE_APPLICATION_ID="org.x.X11" ])
++AC_SUBST([APPLE_APPLICATION_ID])
+ AC_ARG_ENABLE(builddocs,      AS_HELP_STRING([--enable-builddocs], [Build docs (default: disabled)]),
+                                 [BUILDDOCS=$enableval],
+                                 [BUILDDOCS=no])
+diff --git hw/xquartz/Makefile.am hw/xquartz/Makefile.am
+index d1eb283..e5e2e9e 100644
+--- hw/xquartz/Makefile.am
++++ hw/xquartz/Makefile.am
+@@ -7,7 +7,8 @@ AM_CPPFLAGS = \
+ 	-DINXQUARTZ \
+ 	-DUSE_NEW_CLUT \
+ 	-DXFree86Server \
+-	-I$(top_srcdir)/miext/rootless
++	-I$(top_srcdir)/miext/rootless \
++	-DX11LIBDIR=\"$(libdir)\"
+ 
+ if GLX
+ GL_DIR = GL
+diff --git hw/xquartz/X11Application.m hw/xquartz/X11Application.m
+index 2fe4ca7..d03d3b6 100644
+--- hw/xquartz/X11Application.m
++++ hw/xquartz/X11Application.m
+@@ -54,7 +54,7 @@
+ // pbproxy/pbproxy.h
+ extern BOOL xpbproxy_init (void);
+ 
+-#define DEFAULTS_FILE "/usr/X11/lib/X11/xserver/Xquartz.plist"
++#define DEFAULTS_FILE X11LIBDIR"/X11/xserver/Xquartz.plist"
+ 
+ #ifndef XSERVER_VERSION
+ #define XSERVER_VERSION "?"
+diff --git hw/xquartz/bundle/Info.plist hw/xquartz/bundle/Info.plist
+deleted file mode 100644
+index f4a9287..0000000
+--- hw/xquartz/bundle/Info.plist
++++ /dev/null
+@@ -1,39 +0,0 @@
+-<?xml version="1.0" encoding="UTF-8"?>
+-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+-<plist version="1.0">
+-<dict>
+-	<key>CFBundleDevelopmentRegion</key>
+-		<string>English</string>
+-	<key>CFBundleExecutable</key>
+-		<string>X11</string>
+-	<key>CFBundleGetInfoString</key>
+-		<string>X11</string>
+-	<key>CFBundleIconFile</key>
+-		<string>X11.icns</string>
+-	<key>CFBundleIdentifier</key>
+-		<string>org.x.X11</string>
+-	<key>CFBundleInfoDictionaryVersion</key>
+-		<string>6.0</string>
+-	<key>CFBundleName</key>
+-		<string>X11</string>
+-	<key>CFBundlePackageType</key>
+-		<string>APPL</string>
+-	<key>CFBundleShortVersionString</key>
+-		<string>2.3.2</string>
+-	<key>CFBundleVersion</key>
+-		<string>2.3.2</string>
+-	<key>CFBundleSignature</key>
+-		<string>x11a</string>
+-	<key>CSResourcesFileMapped</key>
+-		<true/>
+-	<key>NSHumanReadableCopyright</key>
+-		<string>Copyright © 2003-2008, Apple Inc.
+-Copyright © 2003, XFree86 Project, Inc.
+-Copyright © 2003-2008, X.org Foundation, Inc.
+-</string>
+-	<key>NSMainNibFile</key>
+-		<string>main</string>
+-	<key>NSPrincipalClass</key>
+-		<string>X11Application</string>
+-</dict>
+-</plist>
+diff --git hw/xquartz/bundle/Info.plist.cpp hw/xquartz/bundle/Info.plist.cpp
+new file mode 100644
+index 0000000..16434f2
+--- /dev/null
++++ hw/xquartz/bundle/Info.plist.cpp
+@@ -0,0 +1,39 @@
++<?xml version="1.0" encoding="UTF-8"?>
++<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
++<plist version="1.0">
++<dict>
++	<key>CFBundleDevelopmentRegion</key>
++		<string>English</string>
++	<key>CFBundleExecutable</key>
++		<string>X11</string>
++	<key>CFBundleGetInfoString</key>
++		<string>APPLE_APPLICATION_NAME</string>
++	<key>CFBundleIconFile</key>
++		<string>X11.icns</string>
++	<key>CFBundleIdentifier</key>
++		<string>APPLE_APPLICATION_ID</string>
++	<key>CFBundleInfoDictionaryVersion</key>
++		<string>6.0</string>
++	<key>CFBundleName</key>
++		<string>APPLE_APPLICATION_NAME</string>
++	<key>CFBundlePackageType</key>
++		<string>APPL</string>
++	<key>CFBundleShortVersionString</key>
++		<string>2.3.2</string>
++	<key>CFBundleVersion</key>
++		<string>2.3.2</string>
++	<key>CFBundleSignature</key>
++		<string>x11a</string>
++	<key>CSResourcesFileMapped</key>
++		<true/>
++	<key>NSHumanReadableCopyright</key>
++		<string>Copyright © 2003-2008, Apple Inc.
++Copyright © 2003, XFree86 Project, Inc.
++Copyright © 2003-2008, X.org Foundation, Inc.
++</string>
++	<key>NSMainNibFile</key>
++		<string>main</string>
++	<key>NSPrincipalClass</key>
++		<string>X11Application</string>
++</dict>
++</plist>
+diff --git hw/xquartz/bundle/Makefile.am hw/xquartz/bundle/Makefile.am
+index 7b76f84..e765d6e 100644
+--- hw/xquartz/bundle/Makefile.am
++++ hw/xquartz/bundle/Makefile.am
+@@ -1,12 +1,23 @@
++include cpprules.in
++
++CPP_FILES_FLAGS = \
++	-DAPPLE_APPLICATION_ID="$(APPLE_APPLICATION_ID)" \
++	-DAPPLE_APPLICATION_NAME="$(APPLE_APPLICATION_NAME)"
++
+ install-data-hook:
+-	./mk_bundke.sh $(DESTDIR)$(APPLE_APPLICATIONS_DIR)/X11.app
++	./mk_bundke.sh $(DESTDIR)$(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app
++
++noinst_PRE = Info.plist.cpp
++noinst_DATA = $(noinst_PRE:plist.cpp=plist)
++
++CLEANFILES = $(noinst_DATA)
+ 
+ resourcedir=$(libdir)/X11/xserver
+ resource_DATA = Xquartz.plist
+ 
+ EXTRA_DIST = \
+ 	mk_bundke.sh \
+-	Info.plist \
++	Info.plist.cpp \
+ 	PkgInfo \
+ 	$(resource_DATA) \
+ 	Resources/da.lproj/InfoPlist.strings \
+diff --git hw/xquartz/bundle/cpprules.in hw/xquartz/bundle/cpprules.in
+new file mode 100644
+index 0000000..f32eafc
+--- /dev/null
++++ hw/xquartz/bundle/cpprules.in
+@@ -0,0 +1,37 @@
++# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
++# to cpp, because that trick does not work on all ANSI C preprocessors.
++# Delete line numbers from the cpp output (-P is not portable, I guess).
++# Allow XCOMM to be preceded by whitespace and provide a means of generating
++# output lines with trailing backslashes.
++# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
++
++CPP_SED_MAGIC = $(SED) -e '/^\#  *[0-9][0-9]*  *.*$$/d' \
++                       -e '/^\#line  *[0-9][0-9]*  *.*$$/d' \
++                       -e '/^[ 	]*XCOMM$$/s/XCOMM/\#/' \
++                       -e '/^[ 	]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
++                       -e '/^[ 	]*XHASH/s/XHASH/\#/' \
++                       -e '/XSLASHGLOB/s/XSLASHGLOB/\/\*/' \
++                       -e '/\@\@$$/s/\@\@$$/\\/'
++
++# Strings to replace in man pages
++XORGRELSTRING = @PACKAGE_STRING@
++  XORGMANNAME = X Version 11
++
++MANDEFS =  \
++	-D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
++	-D__appmansuffix__=$(APP_MAN_SUFFIX) \
++	-D__filemansuffix__=$(FILE_MAN_SUFFIX) \
++	-D__libmansuffix__=$(LIB_MAN_SUFFIX) \
++	-D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
++	-D__XSERVERNAME__=Xorg -D__XCONFIGFILE__=xorg.conf \
++	-D__xinitdir__=$(XINITDIR) \
++	-D__bindir__=$(bindir) \
++	-DSHELL_CMD=$(SHELL_CMD) $(ARCHMANDEFS)
++
++SUFFIXES = .$(APP_MAN_SUFFIX) .man .cpp
++
++.cpp:
++	$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
++
++.man.$(APP_MAN_SUFFIX):
++	$(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
+diff --git hw/xquartz/mach-startup/bundle-main.c hw/xquartz/mach-startup/bundle-main.c
+index 0e4ed34..6b48c13 100644
+--- hw/xquartz/mach-startup/bundle-main.c
++++ hw/xquartz/mach-startup/bundle-main.c
+@@ -59,8 +59,8 @@ extern int noPanoramiXExtension;
+ 
+ extern int xquartz_resetenv_display;
+ 
+-#define DEFAULT_CLIENT "/usr/X11/bin/xterm"
+-#define DEFAULT_STARTX "/usr/X11/bin/startx"
++#define DEFAULT_CLIENT X11BINDIR "/xterm"
++#define DEFAULT_STARTX X11BINDIR "/startx"
+ #define DEFAULT_SHELL  "/bin/sh"
+ 
+ #ifndef BUILD_DATE
+@@ -278,8 +278,12 @@ static int create_socket(char *filename_out) {
+     return 0;
+ }
+ 
++static int launchd_socket_handed_off = 0;
++
+ kern_return_t do_request_fd_handoff_socket(mach_port_t port, string_t filename) {
+     socket_handoff_t *handoff_data;
++    
++    launchd_socket_handed_off = 1;
+ 
+     handoff_data = (socket_handoff_t *)calloc(1,sizeof(socket_handoff_t));
+     if(!handoff_data) {
+@@ -318,6 +322,12 @@ kern_return_t do_start_x11_server(mach_port_t port, string_array_t argv,
+     char **_envp = alloca((envpCnt + 1) * sizeof(char *));
+     size_t i;
+     
++    /* If we didn't get handed a launchd DISPLAY socket, we shoul
++     * unset DISPLAY or we can run into problems with pbproxy
++     */
++    if(!launchd_socket_handed_off)
++        unsetenv("DISPLAY");
++    
+     if(!_argv || !_envp) {
+         return KERN_FAILURE;
+     }
+@@ -420,19 +430,49 @@ int startup_trigger(int argc, char **argv, char **envp) {
+ }
+ 
+ /** Setup the environment we want our child processes to inherit */
+-static void setup_env() {
++static void ensure_path(const char *dir) {
+     char buf[1024], *temp;
+-
++    
+     /* Make sure /usr/X11/bin is in the $PATH */
+     temp = getenv("PATH");
+     if(temp == NULL || temp[0] == 0) {
+-        snprintf(buf, sizeof(buf), "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:%s", X11BINDIR);
++        snprintf(buf, sizeof(buf), "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:%s", dir);
+         setenv("PATH", buf, TRUE);
+     } else if(strnstr(temp, X11BINDIR, sizeof(temp)) == NULL) {
+-        snprintf(buf, sizeof(buf), "%s:%s", temp, X11BINDIR);
++        snprintf(buf, sizeof(buf), "%s:%s", temp, dir);
+         setenv("PATH", buf, TRUE);
+     }
++}
+ 
++static void setup_env() {
++    char *temp;
++    const char *pds = NULL;
++
++    /* Pass on our prefs domain to startx and its inheritors (mainly for
++     * quartz-wm and the Xquartz stub's MachIPC)
++     */
++    CFBundleRef bundle = CFBundleGetMainBundle();
++    if(bundle) {
++        CFStringRef pd = CFBundleGetIdentifier(bundle);
++        if(pd) {
++            pds = CFStringGetCStringPtr(pd, 0);
++            if(pds) {
++                server_bootstrap_name = malloc(sizeof(char) * (strlen(pds) + 1));
++                strcpy(server_bootstrap_name, pds);
++                setenv("X11_PREFS_DOMAIN", pds, 1);
++            }
++        }
++    }
++
++    /* If we're not org.x.X11, we want to unset DISPLAY, so we don't
++     * use the launchd DISPLAY socket.
++     */
++    if(pds == NULL || strcmp(pds, "org.x.X11") != 0)
++        unsetenv("DISPLAY");
++
++    /* Make sure PATH is right */
++    ensure_path(X11BINDIR);
++    
+     /* cd $HOME */
+     temp = getenv("HOME");
+     if(temp != NULL && temp[0] != '\0')
+@@ -455,22 +495,6 @@ int main(int argc, char **argv, char **envp) {
+ 
+     /* Setup the initial crasherporter info */
+     strlcpy(__crashreporter_info__, __crashreporter_info__base, __crashreporter_info__len);
+-
+-    /* Pass on our prefs domain to startx and its inheritors (mainly for
+-     * quartz-wm and the Xquartz stub's MachIPC)
+-     */
+-    CFBundleRef bundle = CFBundleGetMainBundle();
+-    if(bundle) {
+-        CFStringRef pd = CFBundleGetIdentifier(bundle);
+-        if(pd) {
+-            const char *pds = CFStringGetCStringPtr(pd, 0);
+-            if(pds) {
+-                server_bootstrap_name = malloc(sizeof(char) * (strlen(pds) + 1));
+-                strcpy(server_bootstrap_name, pds);
+-                setenv("X11_PREFS_DOMAIN", pds, 1);
+-            }
+-        }
+-    }
+     
+     fprintf(stderr, "X11.app: main(): argc=%d\n", argc);
+     for(i=0; i < argc; i++) {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20081208/bce8dc7a/attachment-0001.html>


More information about the macports-changes mailing list