XQuartz: Move server bits into bundle and setup stub in /usr/X11/bin/Xquartz in prep for startup rewrite
(cherry picked from commit 453a982e63
)
This commit is contained in:
parent
d41d677ab4
commit
7295e54433
15
configure.ac
15
configure.ac
|
@ -562,9 +562,6 @@ AC_ARG_ENABLE(dmx, AS_HELP_STRING([--enable-dmx], [Build DMX server (d
|
|||
AC_ARG_ENABLE(xvfb, AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
|
||||
AC_ARG_ENABLE(xnest, AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
|
||||
AC_ARG_ENABLE(xquartz, AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
|
||||
AC_ARG_ENABLE(x11app, AS_HELP_STRING([--enable-x11app], [Build Apple's X11.app for Xquartz (default: auto)]), [X11APP=$enableval], [X11APP=auto])
|
||||
AC_ARG_WITH(x11app-archs, AS_HELP_STRING([--with-x11app-archs=ARCHS], [Architectures to build X11.app for, space delimeted (default: "ppc i386")]), [X11APP_ARCHS=$enableval], [X11APP_ARCHS="ppc i386"])
|
||||
AC_SUBST([X11APP_ARCHS])
|
||||
AC_ARG_ENABLE(xwin, AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
|
||||
AC_ARG_ENABLE(xprint, AS_HELP_STRING([--enable-xprint], [Build Xprint extension and server (default: no)]), [XPRINT=$enableval], [XPRINT=no])
|
||||
AC_ARG_ENABLE(xgl, AS_HELP_STRING([--enable-xgl], [Build Xgl server (default: no)]), [XGL=$enableval], [XGL=no])
|
||||
|
@ -1756,17 +1753,6 @@ AM_CONDITIONAL(HAVE_XPLUGIN, [test "x$ac_cv_lib_Xplugin_xp_init" = xyes])
|
|||
AM_CONDITIONAL(HAVE_AGL_FRAMEWORK, [test "x$xorg_cv_AGL_framework" = xyes])
|
||||
AM_CONDITIONAL(XQUARTZ, [test "x$XQUARTZ" = xyes])
|
||||
|
||||
if test "x$X11APP" = xauto; then
|
||||
AC_MSG_CHECKING([whether to build X11.app])
|
||||
if test "x$XQUARTZ" = xyes ; then
|
||||
X11APP=yes
|
||||
else
|
||||
X11APP=no
|
||||
fi
|
||||
AC_MSG_RESULT([$X11APP])
|
||||
fi
|
||||
AM_CONDITIONAL(X11APP,[test "X$X11APP" = Xyes])
|
||||
|
||||
if test "x$LAUNCHD" = "xauto"; then
|
||||
if test "x$XQUARTZ" = "xyes" ; then
|
||||
LAUNCHD=yes
|
||||
|
@ -2165,6 +2151,7 @@ hw/xwin/Makefile
|
|||
hw/xquartz/Makefile
|
||||
hw/xquartz/GL/Makefile
|
||||
hw/xquartz/bundle/Makefile
|
||||
hw/xquartz/stub/Makefile
|
||||
hw/xquartz/xpr/Makefile
|
||||
hw/kdrive/Makefile
|
||||
hw/kdrive/ati/Makefile
|
||||
|
|
|
@ -9,16 +9,12 @@ AM_CPPFLAGS = \
|
|||
-DXFree86Server \
|
||||
-I$(top_srcdir)/miext/rootless
|
||||
|
||||
if X11APP
|
||||
X11APP_SUBDIRS = bundle
|
||||
endif
|
||||
|
||||
SUBDIRS = . GL xpr $(X11APP_SUBDIRS)
|
||||
DIST_SUBDIRS = GL xpr bundle
|
||||
SUBDIRS = bundle . GL xpr stub
|
||||
|
||||
libXquartz_la_SOURCES = \
|
||||
$(top_srcdir)/fb/fbcmap_mi.c \
|
||||
$(top_srcdir)/mi/miinitext.c \
|
||||
bundle/bundle-main.c \
|
||||
X11Application.m \
|
||||
X11Controller.m \
|
||||
applewm.c \
|
||||
|
|
|
@ -1,20 +1,11 @@
|
|||
bin_SCRIPTS = x11app
|
||||
|
||||
.PHONY: x11app
|
||||
|
||||
x11app:
|
||||
xcodebuild CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ARCHS="$(X11APP_ARCHS)"
|
||||
|
||||
install-data-hook:
|
||||
xcodebuild install DSTROOT="/$(DESTDIR)" INSTALL_PATH="$(APPLE_APPLICATIONS_DIR)" DEPLOYMENT_LOCATION=YES SKIP_INSTALL=NO ARCHS="$(X11APP_ARCHS)"
|
||||
|
||||
clean-local:
|
||||
rm -rf build
|
||||
./mk_bundke.sh $(DESTDIR)$(APPLE_APPLICATIONS_DIR)/X11.app
|
||||
|
||||
resourcedir=$(libdir)/X11/xserver
|
||||
resource_DATA = Xquartz.plist
|
||||
|
||||
EXTRA_DIST = \
|
||||
mk_bundke.sh \
|
||||
$(resource_DATA) \
|
||||
Info.plist \
|
||||
X11.icns \
|
||||
|
|
|
@ -43,7 +43,9 @@
|
|||
static int execute(const char *command);
|
||||
static char *command_from_prefs(const char *key, const char *default_value);
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int server_main(int argc, char **argv, char **envp);
|
||||
|
||||
int main(int argc, char **argv, char **envp) {
|
||||
Display *display;
|
||||
const char *s;
|
||||
|
||||
|
@ -52,7 +54,12 @@ int main(int argc, char **argv) {
|
|||
for(i=0; i < argc; i++) {
|
||||
fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]);
|
||||
}
|
||||
|
||||
|
||||
/* Take care of the case where we're called like a normal DDX */
|
||||
if(argc > 1 && argv[1][0] == ':') {
|
||||
exit(server_main(argc, argv, envp));
|
||||
}
|
||||
|
||||
/* If we have a process serial number and it's our only arg, act as if
|
||||
* the user double clicked the app bundle: launch app_to_run if possible
|
||||
*/
|
||||
|
@ -73,7 +80,7 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
|
||||
/* Start the server */
|
||||
if(s = getenv("DISPLAY")) {
|
||||
if((s = getenv("DISPLAY"))) {
|
||||
fprintf(stderr, "X11.app: Could not connect to server (DISPLAY=\"%s\", unsetting). Starting X server.\n", s);
|
||||
unsetenv("DISPLAY");
|
||||
} else {
|
||||
|
|
|
@ -94,7 +94,7 @@ void QuartzInitServer(int argc, char **argv, char **envp) {
|
|||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv, char **envp) {
|
||||
int server_main(int argc, char **argv, char **envp) {
|
||||
int i;
|
||||
int fd[2];
|
||||
|
||||
|
|
11
hw/xquartz/stub/Makefile.am
Normal file
11
hw/xquartz/stub/Makefile.am
Normal file
|
@ -0,0 +1,11 @@
|
|||
AM_CPPFLAGS = \
|
||||
-DBUILD_DATE=\"$(BUILD_DATE)\" \
|
||||
-DXSERVER_VERSION=\"$(VERSION)\"
|
||||
|
||||
bin_PROGRAMS = Xquartz
|
||||
|
||||
Xquartz_SOURCES = \
|
||||
stub.c
|
||||
|
||||
Xquartz_LDFLAGS = \
|
||||
-framework CoreServices
|
96
hw/xquartz/stub/stub.c
Normal file
96
hw/xquartz/stub/stub.c
Normal file
|
@ -0,0 +1,96 @@
|
|||
/* Copyright (c) 2008 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 <CoreServices/CoreServices.h>
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define kX11AppBundleId "org.x.X11"
|
||||
#define kX11AppBundlePath "/Contents/MacOS/X11"
|
||||
|
||||
static char x11_path[PATH_MAX + 1];
|
||||
|
||||
static void set_x11_path() {
|
||||
CFURLRef appURL = NULL;
|
||||
OSStatus osstatus = LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(kX11AppBundleId), nil, nil, &appURL);
|
||||
|
||||
switch (osstatus) {
|
||||
case noErr:
|
||||
if (appURL == NULL) {
|
||||
fprintf(stderr, "xinit: Invalid response from LSFindApplicationForInfo(%s)\n",
|
||||
kX11AppBundleId);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!CFURLGetFileSystemRepresentation(appURL, true, (unsigned char *)x11_path, sizeof(x11_path))) {
|
||||
fprintf(stderr, "xinit: Error resolving URL for %s\n", kX11AppBundleId);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
strlcat(x11_path, kX11AppBundlePath, sizeof(x11_path));
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "XQuartz: X11.app = %s\n", x11_path);
|
||||
#endif
|
||||
break;
|
||||
case kLSApplicationNotFoundErr:
|
||||
fprintf(stderr, "XQuartz: Unable to find application for %s\n", kX11AppBundleId);
|
||||
exit(4);
|
||||
default:
|
||||
fprintf(stderr, "XQuartz: Unable to find application for %s, error code = %d\n",
|
||||
kX11AppBundleId, (int)osstatus);
|
||||
exit(5);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef BUILD_DATE
|
||||
#define BUILD_DATE "?"
|
||||
#endif
|
||||
#ifndef XSERVER_VERSION
|
||||
#define XSERVER_VERSION "?"
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
if(argc == 2 && !strcmp(argv[1], "-version")) {
|
||||
fprintf(stderr, "X.org Release 7.3\n");
|
||||
fprintf(stderr, "X.Org X Server %s\n", XSERVER_VERSION);
|
||||
fprintf(stderr, "Build Date: %s\n", BUILD_DATE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
set_x11_path();
|
||||
|
||||
argv[0] = x11_path;
|
||||
return execvp(x11_path, argv);
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
bin_PROGRAMS = Xquartz
|
||||
x11appdir = $(APPLE_APPLICATIONS_DIR)/X11.app/Contents/MacOS
|
||||
x11app_PROGRAMS = X11
|
||||
|
||||
AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
|
||||
AM_CPPFLAGS = \
|
||||
|
@ -6,7 +7,7 @@ AM_CPPFLAGS = \
|
|||
-I$(top_srcdir)/miext \
|
||||
-I$(top_srcdir)/miext/rootless
|
||||
|
||||
Xquartz_SOURCES = \
|
||||
X11_SOURCES = \
|
||||
appledri.c \
|
||||
dri.c \
|
||||
xprAppleWM.c \
|
||||
|
@ -18,13 +19,13 @@ Xquartz_SOURCES = \
|
|||
x-hook.c \
|
||||
x-list.c
|
||||
|
||||
Xquartz_LDADD = \
|
||||
X11_LDADD = \
|
||||
$(top_builddir)/hw/xquartz/libXquartz.la \
|
||||
$(top_builddir)/dix/dixfonts.lo \
|
||||
$(top_builddir)/miext/rootless/librootless.la \
|
||||
$(DARWIN_LIBS) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) -lXplugin
|
||||
$(DARWIN_LIBS) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) -lXplugin -lX11
|
||||
|
||||
Xquartz_LDFLAGS = \
|
||||
X11_LDFLAGS = \
|
||||
-XCClinker -Objc \
|
||||
-Wl,-u,_miDCInitialize \
|
||||
-Wl,-framework,Carbon \
|
||||
|
|
Loading…
Reference in New Issue
Block a user