xserver: Branch 'xorg-server-1.4-apple' - 4 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Thu Dec 13 16:32:10 PST 2007


 .gitignore                            |    1 
 configure.ac                          |   26 +++++------
 hw/xquartz/Makefile.am                |    6 ++
 hw/xquartz/bundle/Makefile.am         |   11 ++++-
 hw/xquartz/bundle/org.x.X11.plist.in  |   23 ----------
 hw/xquartz/bundle/org.x.X11.plist.pre |   23 ++++++++++
 hw/xquartz/x11-exec.c                 |   74 ++++++++++++++++++++++++++++++++++
 7 files changed, 123 insertions(+), 41 deletions(-)

New commits:
commit 32e74d744cd1a84108b8e04c1b69e2a688a5b396
Author: Jeremy Huddleston <jeremy at yuffie.local>
Date:   Thu Dec 13 16:23:46 2007 -0800

    Xquartz: Don't hardcode libexec dir
    (cherry picked from commit 67b479ef80cb740a24981335eb8d596744168a62)

diff --git a/configure.ac b/configure.ac
index 06f1ff5..eee0d23 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2147,7 +2147,6 @@ hw/xnest/Makefile
 hw/xwin/Makefile
 hw/xquartz/Makefile
 hw/xquartz/bundle/Makefile
-hw/xquartz/bundle/org.x.X11.plist
 hw/xquartz/xpr/Makefile
 hw/kdrive/Makefile
 hw/kdrive/ati/Makefile
diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am
index 846beae..b40a4f5 100644
--- a/hw/xquartz/Makefile.am
+++ b/hw/xquartz/Makefile.am
@@ -1,7 +1,3 @@
-libexec_PROGRAMS = x11-exec
-
-x11_exec_LDFLAGS = -framework ApplicationServices
-
 noinst_LTLIBRARIES = libXquartz.la
 AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
 AM_CPPFLAGS = \
@@ -13,6 +9,12 @@ AM_CPPFLAGS = \
 
 if X11APP
 X11APP_SUBDIRS = bundle
+
+if LAUNCHD
+libexec_PROGRAMS = x11-exec
+x11_exec_LDFLAGS = -framework ApplicationServices
+endif
+
 endif
 
 SUBDIRS = . xpr $(X11APP_SUBDIRS)
diff --git a/hw/xquartz/bundle/Makefile.am b/hw/xquartz/bundle/Makefile.am
index 8aa2357..775e1aa 100644
--- a/hw/xquartz/bundle/Makefile.am
+++ b/hw/xquartz/bundle/Makefile.am
@@ -9,7 +9,14 @@ install-data-hook:
 	xcodebuild install DSTROOT="/$(DESTDIR)" INSTALL_PATH="$(APPLE_APPLICATIONS_DIR)" DEPLOYMENT_LOCATION=YES SKIP_INSTALL=NO ARCHS="$(X11APP_ARCHS)"
 
 if LAUNCHD
-launchagents_DATA = org.x.X11.plist
+launchagents_PRE = org.x.X11.plist.pre
+launchagents_DATA = $(launchagents_PRE:plist.pre=plist)
+
+CPP_FILES_FLAGS = -D__libexecdir__="${libexecdir}"
+
+CLEANFILES = $(launchagents_DATA)
+
+include $(top_srcdir)/cpprules.in
 endif
 
 clean-local:
diff --git a/hw/xquartz/bundle/org.x.X11.plist b/hw/xquartz/bundle/org.x.X11.plist
deleted file mode 100644
index 1e646ac..0000000
--- a/hw/xquartz/bundle/org.x.X11.plist
+++ /dev/null
@@ -1,23 +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>Label</key>
-		<string>org.x.X11</string>
-	<key>ProgramArguments</key>
-		<array>
-		<string>/usr/libexec/x11-exec</string>
-		<string>-launchd</string>
-		</array>
-	<key>Sockets</key>
-		<dict>
-		<key>:0</key>
-			<dict>
-			<key>SecureSocketWithKey</key>
-				<string>DISPLAY</string>
-			</dict>
-		</dict>
-	<key>ServiceIPC</key>
-		<true/>
-</dict>
-</plist>
diff --git a/hw/xquartz/bundle/org.x.X11.plist.pre b/hw/xquartz/bundle/org.x.X11.plist.pre
new file mode 100644
index 0000000..83d8b2f
--- /dev/null
+++ b/hw/xquartz/bundle/org.x.X11.plist.pre
@@ -0,0 +1,23 @@
+<?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>Label</key>
+		<string>org.x.X11</string>
+	<key>ProgramArguments</key>
+		<array>
+		<string>__libexecdir__/x11-exec</string>
+		<string>-launchd</string>
+		</array>
+	<key>Sockets</key>
+		<dict>
+		<key>:0</key>
+			<dict>
+			<key>SecureSocketWithKey</key>
+				<string>DISPLAY</string>
+			</dict>
+		</dict>
+	<key>ServiceIPC</key>
+		<true/>
+</dict>
+</plist>
commit 8eb15256ecfad3d968b664122d0d118a2f232cb8
Author: Jeremy Huddleston <jeremy at yuffie.local>
Date:   Thu Dec 13 15:56:31 2007 -0800

    Xquartz: Don't hardcode LaunchAgents dir
    (cherry picked from commit 07a12d71fefd78c380078efa835700f2868ab204)

diff --git a/configure.ac b/configure.ac
index 0fab244..06f1ff5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -454,13 +454,15 @@ AC_ARG_WITH(rgb-path,         AS_HELP_STRING([--with-rgb-path=PATH], [Path to RG
 AC_ARG_WITH(serverconfig-path, AS_HELP_STRING([--with-serverconfig-path=PATH], [Path to server config (default: ${libdir}/xserver)]),
 				[ SERVERCONFIG="$withval" ],
 				[ SERVERCONFIG="${libdir}/xserver" ])
-APPLE_APPLICATIONS_DIR="/Applications/Utilities"
 AC_ARG_WITH(apple-applications-dir,AS_HELP_STRING([--with-apple-applications-dir=PATH], [Path to the Applications directory (default: /Applications/Utilities)]),
-				[ APPLE_APPLICATIONS_DIR="${withval}" ].
+				[ APPLE_APPLICATIONS_DIR="${withval}" ],
 				[ APPLE_APPLICATIONS_DIR="/Applications/Utilities" ])
-
+AC_SUBST([APPLE_APPLICATIONS_DIR])
 AC_ARG_WITH(launchd,          AS_HELP_STRING([--with-launchd], [Build with support for Apple's launchd (default: auto)]), [LAUNCHD=$withval], [LAUNCHD=auto])
-
+AC_ARG_WITH(launchagents-dir,AS_HELP_STRING([--with-launchagents-dir=PATH], [Path to launchd's LaunchAgents directory (default: /Library/LaunchAgents)]),
+				[ launchagentsdir="${withval}" ],
+				[ launchagentsdir="/Library/LaunchAgents" ])
+AC_SUBST([launchagentsdir])
 AC_ARG_ENABLE(builddocs,      AS_HELP_STRING([--enable-builddocs], [Build docs (default: disabled)]),
                                 [BUILDDOCS=$enableval],
                                 [BUILDDOCS=no])
@@ -1745,7 +1747,6 @@ if test "x$XQUARTZ" = xyes; then
 	DARWIN_LIBS="$MI_LIB $OS_LIB $DIX_LIB $FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $DARWIN_GLX_LIBS"
 	AC_SUBST([DARWIN_LIBS])
 	AC_CHECK_LIB([Xplugin],[xp_init],[:])
-	AC_SUBST([APPLE_APPLICATIONS_DIR])
 	CFLAGS="${CFLAGS} -DROOTLESS_WORKAROUND -DNO_ALLOCA"
 	if test "x$XF86MISC" = xyes || test "x$XF86MISC" = xauto; then
 		AC_MSG_NOTICE([Disabling XF86Misc extension])
@@ -1791,22 +1792,18 @@ if test "x$X11APP" = xauto; then
 fi
 AM_CONDITIONAL(X11APP,[test "X$X11APP" = Xyes]) 
 
-if test "x$LAUNCHD" = xauto; then
-	# Do we want to have this default to on for Xquartz builds only or any time we have launchd (like Xnest or Xvfb on OS-X)
-	#AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no])
-	AC_MSG_CHECKING([whether to support launchd])
-	if test "x$XQUARTZ" = xyes ; then
+if test "x$LAUNCHD" = "xauto"; then
+	if test "x$XQUARTZ" = "xyes" ; then
 		LAUNCHD=yes
 	else
-		LAUNCHD=no
+		AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no])
 	fi
-	AC_MSG_RESULT([$LAUNCHD])
 fi
 
-if test "x$LAUNCHD" = xyes ; then
+if test "x$LAUNCHD" = "xyes" ; then
 	AC_DEFINE(HAVE_LAUNCHD, 1, [launchd support available])
 fi
-AM_CONDITIONAL(LAUNCHD, [test "x$LAUNCHD" = xyes])
+AM_CONDITIONAL(LAUNCHD, [test "x$LAUNCHD" = "xyes"])
 
 dnl kdrive DDX
 
diff --git a/hw/xquartz/bundle/Makefile.am b/hw/xquartz/bundle/Makefile.am
index 5734434..8aa2357 100644
--- a/hw/xquartz/bundle/Makefile.am
+++ b/hw/xquartz/bundle/Makefile.am
@@ -7,9 +7,9 @@ x11app:
 
 install-data-hook:
 	xcodebuild install DSTROOT="/$(DESTDIR)" INSTALL_PATH="$(APPLE_APPLICATIONS_DIR)" DEPLOYMENT_LOCATION=YES SKIP_INSTALL=NO ARCHS="$(X11APP_ARCHS)"
+
 if LAUNCHD
-	$(MKDIR_P) "$(DESTDIR)/System/Library/LaunchAgents/"
-	$(INSTALL) org.x.X11.plist "$(DESTDIR)/System/Library/LaunchAgents/"
+launchagents_DATA = org.x.X11.plist
 endif
 
 clean-local:
commit fa3ccf4c2a7449895449765a5a9bf9b14ac1da26
Author: Ben Byer <bbyer at bbyer.apple.com>
Date:   Thu Dec 13 15:57:39 2007 -0800

    Modified X11 plist to use x11-exec
    (cherry picked from commit 7d9a11329e476f45e4d9f9aebcb43469321347c7)

diff --git a/.gitignore b/.gitignore
index 37f35f4..2e60d58 100644
--- a/.gitignore
+++ b/.gitignore
@@ -275,7 +275,6 @@ hw/xprint/doc/Xprt.1x
 hw/xprint/doc/Xprt.man
 hw/xprint/dpmsstubs-wrapper.c
 hw/xprint/miinitext-wrapper.c
-hw/xquartz/bundle/org.x.X11.plist
 include/dix-config.h
 include/kdrive-config.h
 include/xgl-config.h
diff --git a/hw/xquartz/bundle/org.x.X11.plist b/hw/xquartz/bundle/org.x.X11.plist
new file mode 100644
index 0000000..1e646ac
--- /dev/null
+++ b/hw/xquartz/bundle/org.x.X11.plist
@@ -0,0 +1,23 @@
+<?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>Label</key>
+		<string>org.x.X11</string>
+	<key>ProgramArguments</key>
+		<array>
+		<string>/usr/libexec/x11-exec</string>
+		<string>-launchd</string>
+		</array>
+	<key>Sockets</key>
+		<dict>
+		<key>:0</key>
+			<dict>
+			<key>SecureSocketWithKey</key>
+				<string>DISPLAY</string>
+			</dict>
+		</dict>
+	<key>ServiceIPC</key>
+		<true/>
+</dict>
+</plist>
diff --git a/hw/xquartz/bundle/org.x.X11.plist.in b/hw/xquartz/bundle/org.x.X11.plist.in
deleted file mode 100644
index 26eca96..0000000
--- a/hw/xquartz/bundle/org.x.X11.plist.in
+++ /dev/null
@@ -1,23 +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>Label</key>
-		<string>org.x.X11</string>
-	<key>ProgramArguments</key>
-		<array>
-		<string>@APPLE_APPLICATIONS_DIR@/X11.app/Contents/MacOS/X11</string>
-		<string>-launchd</string>
-		</array>
-	<key>Sockets</key>
-		<dict>
-		<key>:0</key>
-			<dict>
-			<key>SecureSocketWithKey</key>
-				<string>DISPLAY</string>
-			</dict>
-		</dict>
-	<key>ServiceIPC</key>
-		<true/>
-</dict>
-</plist>
commit eb141e05f38b268f5b578aae59ad355bc76b1214
Author: Ben Byer <bbyer at bbyer.apple.com>
Date:   Thu Dec 13 15:55:28 2007 -0800

    created x11-exec wrapper, which uses LaunchServices to find
    (and then exec) X11.app
    (cherry picked from commit fc04c9759b30d062111d4a7f3f411ed0f18cbde4)

diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am
index b026ee1..846beae 100644
--- a/hw/xquartz/Makefile.am
+++ b/hw/xquartz/Makefile.am
@@ -1,3 +1,7 @@
+libexec_PROGRAMS = x11-exec
+
+x11_exec_LDFLAGS = -framework ApplicationServices
+
 noinst_LTLIBRARIES = libXquartz.la
 AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
 AM_CPPFLAGS = \
diff --git a/hw/xquartz/x11-exec.c b/hw/xquartz/x11-exec.c
new file mode 100644
index 0000000..d0b5c49
--- /dev/null
+++ b/hw/xquartz/x11-exec.c
@@ -0,0 +1,74 @@
+/* x11-exec.c -- Find X11.app by bundle-id and exec it.  This is so launchd
+   can correctly find X11.app, even if the user moved it.
+
+ Copyright (c) 2007 Apple, Inc.
+ 
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation files
+ (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+ 
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT.  IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
+ HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ 
+ Except as contained in this notice, the name(s) of the above
+ copyright holders shall not be used in advertising or otherwise to
+ promote the sale, use or other dealings in this Software without
+ prior written authorization. */
+
+#include <ApplicationServices/ApplicationServices.h>
+#include <stdio.h>
+
+#define kX11AppBundleId "org.x.X11"
+#define kX11AppBundlePath "/Contents/MacOS/X11"
+
+int main(int argc, char **argv) {
+  char x11_path[PATH_MAX];
+  CFURLRef appURL = NULL;
+  OSStatus osstatus = 
+    LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(kX11AppBundleId), 
+			     nil, nil, &appURL);
+  
+  switch (osstatus) {
+  case noErr:
+    if (appURL == NULL) {
+      fprintf(stderr, "%s: Invalid response from LSFindApplicationForInfo(%s)\n", 
+	      argv[0], kX11AppBundleId);
+      exit(1);
+    }
+    if (!CFURLGetFileSystemRepresentation(appURL, true, (unsigned char *)x11_path, sizeof(x11_path))) {
+      fprintf(stderr, "%s: Error resolving URL for %s\n", argv[0], kX11AppBundleId);
+      exit(2);
+    }
+    strlcpy(argv[0], "X11", strlen(argv[0])+1);
+    strlcat(x11_path, kX11AppBundlePath, sizeof(x11_path));
+//  fprintf(stderr, "X11.app = %s\n", x11_path);
+    execv(x11_path, argv);
+    fprintf(stderr, "Error executing X11.app (%s):", x11_path);
+    perror(NULL);
+    exit(3);
+    break;
+  case kLSApplicationNotFoundErr:
+    fprintf(stderr, "%s: Unable to find application for %s\n", argv[0], kX11AppBundleId);
+    exit(4);
+  default:
+    fprintf(stderr, "%s: Unable to find application for %s, error code = %d\n", 
+	    argv[0], kX11AppBundleId, osstatus);
+    exit(5);
+  }
+  /* not reached */
+}
+
+    


More information about the xorg-commit mailing list