3
0
Fork 0
forked from mirrors/nixpkgs

xquartz: fix build

Things done:

- use libGLU instead of mesa for darwin support
- move patches from local to github url
- fixup xquartz install

There may still be some issues at runtime. PRs welcome!

Fixes #40196
This commit is contained in:
Matthew Bauer 2018-05-11 16:01:40 -05:00
parent 92cf881675
commit c839771129
9 changed files with 28 additions and 805 deletions

View file

@ -1,41 +0,0 @@
From 91971455ee46b1059de75260ef0d1a45170d8b65 Mon Sep 17 00:00:00 2001
From: Jeremy Huddleston <jeremyhu@apple.com>
Date: Fri, 13 Jan 2012 12:00:57 -0800
Subject: [PATCH 2/6] sdksyms.sh: Use CPPFLAGS, not CFLAGS
CFLAGS can include flags which are not useful to the preprocessor
or can even cause it to fail. This fixes a build issue on darwin
when building for more than one architecture.
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
---
hw/xfree86/Makefile.am | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 27f2cc6..d898c43 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -48,8 +48,7 @@ DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \
bin_PROGRAMS = Xorg
nodist_Xorg_SOURCES = sdksyms.c
-AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
-AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/parser -I$(top_srcdir)/miext/cw \
+AM_CPPFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@ $(XORG_INCS) -I$(srcdir)/parser -I$(top_srcdir)/miext/cw \
-I$(srcdir)/ddc -I$(srcdir)/i2c -I$(srcdir)/modes -I$(srcdir)/ramdac \
-I$(srcdir)/dri -I$(srcdir)/dri2 -I$(top_srcdir)/dri3
@@ -135,7 +134,7 @@ CLEANFILES = sdksyms.c sdksyms.dep Xorg.sh
EXTRA_DIST += sdksyms.sh
sdksyms.dep sdksyms.c: sdksyms.sh
- $(AM_V_GEN)CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh $(top_srcdir) $(CFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS)
+ $(AM_V_GEN)CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh $(top_srcdir) $(CPPFLAGS) $(AM_CPPFLAGS)
SDKSYMS_DEP = sdksyms.dep
-include $(SDKSYMS_DEP)
--
2.3.2 (Apple Git-55)

View file

@ -1,297 +0,0 @@
From b229a04bde765424542eeba17a7e2bc25785a890 Mon Sep 17 00:00:00 2001
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Date: Sat, 2 Nov 2013 11:00:23 -0700
Subject: [PATCH 4/6] Use old miTrapezoids and miTriangles routines
Reverts commits:
788ccb9a8bcf6a4fb4054c507111eec3338fb969
566f1931ee2916269e164e114bffaf2da1d039d1
http://xquartz.macosforge.org/trac/ticket/525
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
---
fb/fbpict.c | 2 -
render/mipict.c | 4 +-
render/mipict.h | 27 ++++++++++++++
render/mitrap.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
render/mitri.c | 61 +++++++++++++++++++++++++++++++
5 files changed, 201 insertions(+), 4 deletions(-)
diff --git a/fb/fbpict.c b/fb/fbpict.c
index c8378ad..cafb027 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -499,10 +499,8 @@ fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
ps->UnrealizeGlyph = fbUnrealizeGlyph;
ps->CompositeRects = miCompositeRects;
ps->RasterizeTrapezoid = fbRasterizeTrapezoid;
- ps->Trapezoids = fbTrapezoids;
ps->AddTraps = fbAddTraps;
ps->AddTriangles = fbAddTriangles;
- ps->Triangles = fbTriangles;
return TRUE;
}
diff --git a/render/mipict.c b/render/mipict.c
index a725104..e14293a 100644
--- a/render/mipict.c
+++ b/render/mipict.c
@@ -575,8 +575,8 @@ miPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
ps->Composite = 0; /* requires DDX support */
ps->Glyphs = miGlyphs;
ps->CompositeRects = miCompositeRects;
- ps->Trapezoids = 0;
- ps->Triangles = 0;
+ ps->Trapezoids = miTrapezoids;
+ ps->Triangles = miTriangles;
ps->RasterizeTrapezoid = 0; /* requires DDX support */
ps->AddTraps = 0; /* requires DDX support */
diff --git a/render/mipict.h b/render/mipict.h
index 23ce9e8..e0f1d4c 100644
--- a/render/mipict.h
+++ b/render/mipict.h
@@ -122,6 +122,16 @@ miCompositeRects(CARD8 op,
xRenderColor * color, int nRect, xRectangle *rects);
extern _X_EXPORT void
+miTriangles (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int ntri,
+ xTriangle *tris);
+
+extern _X_EXPORT void
miTriStrip(CARD8 op,
PicturePtr pSrc,
@@ -137,10 +147,27 @@ miTriFan(CARD8 op,
PictFormatPtr maskFormat,
INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points);
+extern _X_EXPORT PicturePtr
+miCreateAlphaPicture (ScreenPtr pScreen,
+ PicturePtr pDst,
+ PictFormatPtr pPictFormat,
+ CARD16 width,
+ CARD16 height);
+
extern _X_EXPORT void
miTrapezoidBounds(int ntrap, xTrapezoid * traps, BoxPtr box);
extern _X_EXPORT void
+miTrapezoids (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int ntrap,
+ xTrapezoid *traps);
+
+extern _X_EXPORT void
miPointFixedBounds(int npoint, xPointFixed * points, BoxPtr bounds);
extern _X_EXPORT void
diff --git a/render/mitrap.c b/render/mitrap.c
index 17b6dcd..71c1857 100644
--- a/render/mitrap.c
+++ b/render/mitrap.c
@@ -34,6 +34,55 @@
#include "picturestr.h"
#include "mipict.h"
+PicturePtr
+miCreateAlphaPicture (ScreenPtr pScreen,
+ PicturePtr pDst,
+ PictFormatPtr pPictFormat,
+ CARD16 width,
+ CARD16 height)
+{
+ PixmapPtr pPixmap;
+ PicturePtr pPicture;
+ GCPtr pGC;
+ int error;
+ xRectangle rect;
+
+ if (width > 32767 || height > 32767)
+ return 0;
+
+ if (!pPictFormat)
+ {
+ if (pDst->polyEdge == PolyEdgeSharp)
+ pPictFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
+ else
+ pPictFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
+ if (!pPictFormat)
+ return 0;
+ }
+
+ pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
+ pPictFormat->depth, 0);
+ if (!pPixmap)
+ return 0;
+ pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
+ if (!pGC)
+ {
+ (*pScreen->DestroyPixmap) (pPixmap);
+ return 0;
+ }
+ ValidateGC (&pPixmap->drawable, pGC);
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = width;
+ rect.height = height;
+ (*pGC->ops->PolyFillRect)(&pPixmap->drawable, pGC, 1, &rect);
+ FreeScratchGC (pGC);
+ pPicture = CreatePicture (0, &pPixmap->drawable, pPictFormat,
+ 0, 0, serverClient, &error);
+ (*pScreen->DestroyPixmap) (pPixmap);
+ return pPicture;
+}
+
static xFixed
miLineFixedX(xLineFixed * l, xFixed y, Bool ceil)
{
@@ -79,3 +128,65 @@ miTrapezoidBounds(int ntrap, xTrapezoid * traps, BoxPtr box)
box->x2 = x2;
}
}
+
+
+void
+miTrapezoids (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int ntrap,
+ xTrapezoid *traps)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+
+ /*
+ * Check for solid alpha add
+ */
+ if (op == PictOpAdd && miIsSolidAlpha (pSrc))
+ {
+ for (; ntrap; ntrap--, traps++)
+ (*ps->RasterizeTrapezoid) (pDst, traps, 0, 0);
+ }
+ else if (maskFormat)
+ {
+ PicturePtr pPicture;
+ BoxRec bounds;
+ INT16 xDst, yDst;
+ INT16 xRel, yRel;
+
+ xDst = traps[0].left.p1.x >> 16;
+ yDst = traps[0].left.p1.y >> 16;
+
+ miTrapezoidBounds (ntrap, traps, &bounds);
+ if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
+ return;
+ pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat,
+ bounds.x2 - bounds.x1,
+ bounds.y2 - bounds.y1);
+ if (!pPicture)
+ return;
+ for (; ntrap; ntrap--, traps++)
+ (*ps->RasterizeTrapezoid) (pPicture, traps,
+ -bounds.x1, -bounds.y1);
+ xRel = bounds.x1 + xSrc - xDst;
+ yRel = bounds.y1 + ySrc - yDst;
+ CompositePicture (op, pSrc, pPicture, pDst,
+ xRel, yRel, 0, 0, bounds.x1, bounds.y1,
+ bounds.x2 - bounds.x1,
+ bounds.y2 - bounds.y1);
+ FreePicture (pPicture, 0);
+ }
+ else
+ {
+ if (pDst->polyEdge == PolyEdgeSharp)
+ maskFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
+ else
+ maskFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
+ for (; ntrap; ntrap--, traps++)
+ miTrapezoids (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, traps);
+ }
+}
diff --git a/render/mitri.c b/render/mitri.c
index 922f22a..bdca9ca 100644
--- a/render/mitri.c
+++ b/render/mitri.c
@@ -65,3 +65,64 @@ miTriangleBounds(int ntri, xTriangle * tris, BoxPtr bounds)
{
miPointFixedBounds(ntri * 3, (xPointFixed *) tris, bounds);
}
+
+
+void
+miTriangles (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int ntri,
+ xTriangle *tris)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+
+ /*
+ * Check for solid alpha add
+ */
+ if (op == PictOpAdd && miIsSolidAlpha (pSrc))
+ {
+ (*ps->AddTriangles) (pDst, 0, 0, ntri, tris);
+ }
+ else if (maskFormat)
+ {
+ BoxRec bounds;
+ PicturePtr pPicture;
+ INT16 xDst, yDst;
+ INT16 xRel, yRel;
+
+ xDst = tris[0].p1.x >> 16;
+ yDst = tris[0].p1.y >> 16;
+
+ miTriangleBounds (ntri, tris, &bounds);
+ if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1)
+ return;
+ pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat,
+ bounds.x2 - bounds.x1,
+ bounds.y2 - bounds.y1);
+ if (!pPicture)
+ return;
+ (*ps->AddTriangles) (pPicture, -bounds.x1, -bounds.y1, ntri, tris);
+
+ xRel = bounds.x1 + xSrc - xDst;
+ yRel = bounds.y1 + ySrc - yDst;
+ CompositePicture (op, pSrc, pPicture, pDst,
+ xRel, yRel, 0, 0, bounds.x1, bounds.y1,
+ bounds.x2 - bounds.x1, bounds.y2 - bounds.y1);
+ FreePicture (pPicture, 0);
+ }
+ else
+ {
+ if (pDst->polyEdge == PolyEdgeSharp)
+ maskFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
+ else
+ maskFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
+
+ for (; ntri; ntri--, tris++)
+ miTriangles (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, tris);
+ }
+}
+
--
2.3.2 (Apple Git-55)

View file

@ -1,243 +0,0 @@
From 4c7572abafeac9b2dcd884c444c5a5bae5b302c3 Mon Sep 17 00:00:00 2001
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Date: Sat, 31 May 2014 13:14:20 -0700
Subject: [PATCH 6/6] fb: Revert fb changes that broke XQuartz
http://bugs.freedesktop.org/show_bug.cgi?id=26124
Revert "Use new pixman_glyph_cache_t API that will be in pixman 0.28.0"
Revert "fb: Fix origin of source picture in fbGlyphs"
Revert "fb: Publish fbGlyphs and fbUnrealizeGlyph"
This reverts commit 9cbcb5bd6a5360a128d15b77a02d8d3351f74366.
This reverts commit 983e30361f49a67252d0b5d82630e70724d69dbf.
This reverts commit 3c2c59eed3c68c0e5a93c38cf01eedad015e3157.
---
fb/fb.h | 3 --
fb/fbpict.c | 149 +---------------------------------------------------------
fb/fbpict.h | 11 +----
fb/fbscreen.c | 1 -
4 files changed, 2 insertions(+), 162 deletions(-)
diff --git a/fb/fb.h b/fb/fb.h
index 59eaac3..046b948 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -1116,9 +1116,6 @@ extern _X_EXPORT void
extern _X_EXPORT Bool
fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats);
-extern _X_EXPORT void
-fbDestroyGlyphCache(void);
-
/*
* fbpixmap.c
*/
diff --git a/fb/fbpict.c b/fb/fbpict.c
index 6ee63e9..9c4cc42 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -65,152 +65,6 @@ fbComposite(CARD8 op,
free_pixman_pict(pDst, dest);
}
-static pixman_glyph_cache_t *glyphCache;
-
-void
-fbDestroyGlyphCache(void)
-{
- if (glyphCache)
- {
- pixman_glyph_cache_destroy (glyphCache);
- glyphCache = NULL;
- }
-}
-
-static void
-fbUnrealizeGlyph(ScreenPtr pScreen,
- GlyphPtr pGlyph)
-{
- if (glyphCache)
- pixman_glyph_cache_remove (glyphCache, pGlyph, NULL);
-}
-
-void
-fbGlyphs(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc, int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs)
-{
-#define N_STACK_GLYPHS 512
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- pixman_glyph_t stack_glyphs[N_STACK_GLYPHS];
- pixman_glyph_t *pglyphs = stack_glyphs;
- pixman_image_t *srcImage, *dstImage;
- int srcXoff, srcYoff, dstXoff, dstYoff;
- GlyphPtr glyph;
- int n_glyphs;
- int x, y;
- int i, n;
- int xDst = list->xOff, yDst = list->yOff;
-
- miCompositeSourceValidate(pSrc);
-
- n_glyphs = 0;
- for (i = 0; i < nlist; ++i)
- n_glyphs += list[i].len;
-
- if (!glyphCache)
- glyphCache = pixman_glyph_cache_create();
-
- pixman_glyph_cache_freeze (glyphCache);
-
- if (n_glyphs > N_STACK_GLYPHS) {
- if (!(pglyphs = malloc (n_glyphs * sizeof (pixman_glyph_t))))
- goto out;
- }
-
- i = 0;
- x = y = 0;
- while (nlist--) {
- x += list->xOff;
- y += list->yOff;
- n = list->len;
- while (n--) {
- const void *g;
-
- glyph = *glyphs++;
-
- if (!(g = pixman_glyph_cache_lookup (glyphCache, glyph, NULL))) {
- pixman_image_t *glyphImage;
- PicturePtr pPicture;
- int xoff, yoff;
-
- pPicture = GetGlyphPicture(glyph, pScreen);
- if (!pPicture) {
- n_glyphs--;
- goto next;
- }
-
- if (!(glyphImage = image_from_pict(pPicture, FALSE, &xoff, &yoff)))
- goto out;
-
- g = pixman_glyph_cache_insert(glyphCache, glyph, NULL,
- glyph->info.x,
- glyph->info.y,
- glyphImage);
-
- free_pixman_pict(pPicture, glyphImage);
-
- if (!g)
- goto out;
- }
-
- pglyphs[i].x = x;
- pglyphs[i].y = y;
- pglyphs[i].glyph = g;
- i++;
-
- next:
- x += glyph->info.xOff;
- y += glyph->info.yOff;
- }
- list++;
- }
-
- if (!(srcImage = image_from_pict(pSrc, FALSE, &srcXoff, &srcYoff)))
- goto out;
-
- if (!(dstImage = image_from_pict(pDst, TRUE, &dstXoff, &dstYoff)))
- goto out_free_src;
-
- if (maskFormat) {
- pixman_format_code_t format;
- pixman_box32_t extents;
-
- format = maskFormat->format | (maskFormat->depth << 24);
-
- pixman_glyph_get_extents(glyphCache, n_glyphs, pglyphs, &extents);
-
- pixman_composite_glyphs(op, srcImage, dstImage, format,
- xSrc + srcXoff + extents.x1 - xDst, ySrc + srcYoff + extents.y1 - yDst,
- extents.x1, extents.y1,
- extents.x1 + dstXoff, extents.y1 + dstYoff,
- extents.x2 - extents.x1,
- extents.y2 - extents.y1,
- glyphCache, n_glyphs, pglyphs);
- }
- else {
- pixman_composite_glyphs_no_mask(op, srcImage, dstImage,
- xSrc + srcXoff - xDst, ySrc + srcYoff - yDst,
- dstXoff, dstYoff,
- glyphCache, n_glyphs, pglyphs);
- }
-
- free_pixman_pict(pDst, dstImage);
-
-out_free_src:
- free_pixman_pict(pSrc, srcImage);
-
-out:
- pixman_glyph_cache_thaw(glyphCache);
- if (pglyphs != stack_glyphs)
- free(pglyphs);
-}
-
static pixman_image_t *
create_solid_fill_image(PicturePtr pict)
{
@@ -461,8 +315,7 @@ fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
return FALSE;
ps = GetPictureScreen(pScreen);
ps->Composite = fbComposite;
- ps->Glyphs = fbGlyphs;
- ps->UnrealizeGlyph = fbUnrealizeGlyph;
+ ps->Glyphs = miGlyphs;
ps->CompositeRects = miCompositeRects;
ps->RasterizeTrapezoid = fbRasterizeTrapezoid;
ps->AddTraps = fbAddTraps;
diff --git a/fb/fbpict.h b/fb/fbpict.h
index 5cb8663..110f32d 100644
--- a/fb/fbpict.h
+++ b/fb/fbpict.h
@@ -65,20 +65,11 @@ fbTrapezoids(CARD8 op,
INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps);
extern _X_EXPORT void
+
fbTriangles(CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,
PictFormatPtr maskFormat,
INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris);
-extern _X_EXPORT void
-fbGlyphs(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc, int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs);
-
#endif /* _FBPICT_H_ */
diff --git a/fb/fbscreen.c b/fb/fbscreen.c
index 71bcc5d..55330fc 100644
--- a/fb/fbscreen.c
+++ b/fb/fbscreen.c
@@ -32,7 +32,6 @@ fbCloseScreen(ScreenPtr pScreen)
int d;
DepthPtr depths = pScreen->allowedDepths;
- fbDestroyGlyphCache();
for (d = 0; d < pScreen->numDepths; d++)
free(depths[d].vids);
free(depths);
--
2.3.2 (Apple Git-55)

View file

@ -1,118 +0,0 @@
cstrahan:
This patch makes it possible (and necessary) to specify the default
shell, xterm client, and startx script from environment variables. These
defaults are used when launching the XQuartz.app, which in turn needs to know
how to start the X server. I've patched `command_from_prefs' so that it ignores
the preferences settings and immediately sets them to whatever the environment
variables are.
When developing an installable package for XQuartz/XQuartz.app, we'll need to
set an `LSEnvironment' entry in the plist for the XQuartz.app, we'll also need
to wrap the XQuartz.app/Contents/MacOS/X11 script (the Xquartz server will
invoke this script during initialization. See stub.patch for more details.).
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index b403662..b1e2070 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -77,13 +77,7 @@ FatalError(const char *f, ...) _X_ATTRIBUTE_PRINTF(1, 2) _X_NORETURN;
extern int noPanoramiXExtension;
-#define DEFAULT_CLIENT X11BINDIR "/xterm"
-#define DEFAULT_STARTX X11BINDIR "/startx -- " X11BINDIR "/Xquartz"
-#define DEFAULT_SHELL "/bin/sh"
-
-#ifndef BUILD_DATE
#define BUILD_DATE ""
-#endif
#ifndef XSERVER_VERSION
#define XSERVER_VERSION "?"
#endif
@@ -718,14 +712,14 @@ main(int argc, char **argv, char **envp)
pid_t child1, child2;
int status;
- pref_app_to_run = command_from_prefs("app_to_run", DEFAULT_CLIENT);
+ pref_app_to_run = command_from_prefs("app_to_run", getenv("XQUARTZ_DEFAULT_CLIENT"));
assert(pref_app_to_run);
- pref_login_shell = command_from_prefs("login_shell", DEFAULT_SHELL);
+ pref_login_shell = command_from_prefs("login_shell", getenv("XQUARTZ_DEFAULT_SHELL"));
assert(pref_login_shell);
pref_startx_script = command_from_prefs("startx_script",
- DEFAULT_STARTX);
+ getenv("XQUARTZ_DEFAULT_STARTX"));
assert(pref_startx_script);
/* Do the fork-twice trick to avoid having to reap zombies */
@@ -804,10 +798,12 @@ execute(const char *command)
static char *
command_from_prefs(const char *key, const char *default_value)
{
+ if (default_value == NULL)
+ return NULL;
+
char *command = NULL;
CFStringRef cfKey;
- CFPropertyListRef PlistRef;
if (!key)
return NULL;
@@ -817,40 +813,24 @@ command_from_prefs(const char *key, const char *default_value)
if (!cfKey)
return NULL;
- PlistRef = CFPreferencesCopyAppValue(cfKey,
- kCFPreferencesCurrentApplication);
+ CFStringRef cfDefaultValue = CFStringCreateWithCString(
+ NULL, default_value, kCFStringEncodingASCII);
+ int len = strlen(default_value) + 1;
- if ((PlistRef == NULL) ||
- (CFGetTypeID(PlistRef) != CFStringGetTypeID())) {
- CFStringRef cfDefaultValue = CFStringCreateWithCString(
- NULL, default_value, kCFStringEncodingASCII);
- int len = strlen(default_value) + 1;
+ if (!cfDefaultValue)
+ goto command_from_prefs_out;
- if (!cfDefaultValue)
- goto command_from_prefs_out;
+ CFPreferencesSetAppValue(cfKey, cfDefaultValue,
+ kCFPreferencesCurrentApplication);
+ CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
+ CFRelease(cfDefaultValue);
- CFPreferencesSetAppValue(cfKey, cfDefaultValue,
- kCFPreferencesCurrentApplication);
- CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
- CFRelease(cfDefaultValue);
-
- command = (char *)malloc(len * sizeof(char));
- if (!command)
- goto command_from_prefs_out;
- strcpy(command, default_value);
- }
- else {
- int len = CFStringGetLength((CFStringRef)PlistRef) + 1;
- command = (char *)malloc(len * sizeof(char));
- if (!command)
- goto command_from_prefs_out;
- CFStringGetCString((CFStringRef)PlistRef, command, len,
- kCFStringEncodingASCII);
- }
+ command = (char *)malloc(len * sizeof(char));
+ if (!command)
+ goto command_from_prefs_out;
+ strcpy(command, default_value);
command_from_prefs_out:
- if (PlistRef)
- CFRelease(PlistRef);
if (cfKey)
CFRelease(cfKey);
return command;

View file

@ -1,12 +0,0 @@
diff --git a/hw/xquartz/xpr/x-list.new.h b/hw/xquartz/xpr/x-list.h
index 28385fd..71f9d26 100644
--- a/hw/xquartz/xpr/x-list.new.h
+++ b/hw/xquartz/xpr/x-list.h
@@ -45,6 +45,7 @@ struct x_list_struct {
#endif
#ifndef X_EXTERN
+#define __private_extern__ extern
#define X_EXTERN __private_extern__
#endif

View file

@ -1,80 +0,0 @@
cstrahan:
When the X / Xquartz server initiallizes, it starts the XQuartz.app and
hands-off the display FD. To start the XQuartz.app, Xquartz normally uses some
system calls to get the path of the application by app bundle id, and then
executes the Contents/MacOS/X11 script contained inside, which in turn executes
Contents/MacOS/X11.bin (the actual app).
This patch replaces that discovery technique with a simple call to
`getenv'. In order to make Xquartz actually work, we'll need another wrapper
that sets the `XQUARTZ_X11' environment variable to point to the `X11' script.
diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c
index 756e4ef..3313a55 100644
--- a/hw/xquartz/mach-startup/stub.c
+++ b/hw/xquartz/mach-startup/stub.c
@@ -61,54 +61,16 @@ aslclient aslc;
static void
set_x11_path(void)
{
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
-
- CFURLRef appURL = NULL;
- OSStatus osstatus =
- LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(
- kX11AppBundleId), nil, nil, &appURL);
-
- switch (osstatus) {
- case noErr:
- if (appURL == NULL) {
- asl_log(
- aslc, NULL, ASL_LEVEL_ERR,
- "Xquartz: Invalid response from LSFindApplicationForInfo(%s)",
- kX11AppBundleId);
- exit(1);
- }
-
- if (!CFURLGetFileSystemRepresentation(appURL, true,
- (unsigned char *)x11_path,
- sizeof(x11_path))) {
- asl_log(aslc, NULL, ASL_LEVEL_ERR,
- "Xquartz: Error resolving URL for %s",
- kX11AppBundleId);
- exit(3);
- }
-
- strlcat(x11_path, kX11AppBundlePath, sizeof(x11_path));
- asl_log(aslc, NULL, ASL_LEVEL_INFO, "Xquartz: X11.app = %s", x11_path);
- break;
-
- case kLSApplicationNotFoundErr:
- asl_log(aslc, NULL, ASL_LEVEL_ERR,
- "Xquartz: Unable to find application for %s",
- kX11AppBundleId);
- exit(10);
-
- default:
- asl_log(aslc, NULL, ASL_LEVEL_ERR,
- "Xquartz: Unable to find application for %s, error code = %d",
- kX11AppBundleId,
- (int)osstatus);
- exit(11);
+ char *xquartzX11 = getenv("XQUARTZ_X11");
+ if (xquartzX11) {
+ strlcpy(x11_path, xquartzX11,
+ sizeof(x11_path));
+ } else {
+ asl_log(
+ aslc, NULL, ASL_LEVEL_ERR,
+ "Xquartz: XQUARTZ_X11 environment variable not set");
+ exit(1);
}
-#else
- /* TODO: Make Tiger smarter... but TBH, this should never get called on Tiger... */
- strlcpy(x11_path, "/Applications/Utilities/X11.app/Contents/MacOS/X11",
- sizeof(x11_path));
-#endif
}
static int

View file

@ -456,7 +456,7 @@ in
};
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ dri2proto dri3proto renderproto libdrm openssl libX11 libXau libXaw libxcb xcbutil xcbutilwm xcbutilimage xcbutilkeysyms xcbutilrenderutil libXdmcp libXfixes libxkbfile libXmu libXpm libXrender libXres libXt ];
postPatch = "sed '1i#include <malloc.h>' -i include/os.h";
postPatch = stdenv.lib.optionalString stdenv.isLinux "sed '1i#include <malloc.h>' -i include/os.h";
meta.platforms = stdenv.lib.platforms.unix;
} else throw "unsupported xorg abiCompat ${args.abiCompat} for ${attrs_passed.name}";
@ -465,7 +465,7 @@ in
version = (builtins.parseDrvName attrs.name).version;
commonBuildInputs = attrs.buildInputs ++ [ xtrans ];
commonPropagatedBuildInputs = [
args.zlib args.libGL args.mesa_noglu args.dbus
args.zlib args.libGL args.libGLU args.dbus
xf86bigfontproto glproto xf86driproto
compositeproto scrnsaverproto resourceproto
xf86dgaproto
@ -526,6 +526,7 @@ in
'';
passthru.version = version; # needed by virtualbox guest additions
} else {
nativeBuildInputs = attrs.nativeBuildInputs ++ [ args.autoreconfHook xorg.utilmacros xorg.fontutil ];
buildInputs = commonBuildInputs ++ [
args.bootstrap_cmds args.automake args.autoconf
args.apple_sdk.libs.Xplugin
@ -535,16 +536,31 @@ in
propagatedBuildInputs = commonPropagatedBuildInputs ++ [
libAppleWM applewmproto
];
# Patches can be pulled from the server-*-apple branches of:
# http://cgit.freedesktop.org/~jeremyhu/xserver/
# XQuartz patchset
patches = commonPatches ++ [
./darwin/0002-sdksyms.sh-Use-CPPFLAGS-not-CFLAGS.patch
./darwin/0004-Use-old-miTrapezoids-and-miTriangles-routines.patch
./darwin/0006-fb-Revert-fb-changes-that-broke-XQuartz.patch
./darwin/private-extern.patch
./darwin/bundle_main.patch
./darwin/stub.patch
(args.fetchpatch {
url = "https://github.com/XQuartz/xorg-server/commit/e88fd6d785d5be477d5598e70d105ffb804771aa.patch";
sha256 = "1q0a30m1qj6ai924afz490xhack7rg4q3iig2gxsjjh98snikr1k";
name = "use-cppflags-not-cflags.patch";
})
(args.fetchpatch {
url = "https://github.com/XQuartz/xorg-server/commit/75ee9649bcfe937ac08e03e82fd45d9e18110ef4.patch";
sha256 = "1vlfylm011y00j8mig9zy6gk9bw2b4ilw2qlsc6la49zi3k0i9fg";
name = "use-old-mitrapezoids-and-mitriangles-routines.patch";
})
(args.fetchpatch {
url = "https://github.com/XQuartz/xorg-server/commit/c58f47415be79a6564a9b1b2a62c2bf866141e73.patch";
sha256 = "19sisqzw8x2ml4lfrwfvavc2jfyq2bj5xcf83z89jdxg8g1gdd1i";
name = "revert-fb-changes-1.patch";
})
(args.fetchpatch {
url = "https://github.com/XQuartz/xorg-server/commit/56e6f1f099d2821e5002b9b05b715e7b251c0c97.patch";
sha256 = "0zm9g0g1jvy79sgkvy0rjm6ywrdba2xjd1nsnjbxjccckbr6i396";
name = "revert-fb-changes-2.patch";
})
];
configureFlags = [
# note: --enable-xquartz is auto
"CPPFLAGS=-I${./darwin/dri}"

View file

@ -26,9 +26,7 @@ stdenv.mkDerivation {
fi;
done;
cd $out/share/X11-fonts/
rm fonts.dir
rm fonts.scale
rm fonts.alias
rm -f fonts.dir fonts.scale fonts.alias
mkfontdir
mkfontscale
cat $( find ${xorg.fontalias}/ -name fonts.alias) >fonts.alias

View file

@ -13043,7 +13043,7 @@ with pkgs;
inherit clangStdenv fetchurl fetchgit fetchpatch stdenv intltool freetype fontconfig
libxslt expat libpng zlib perl mesa_drivers spice-protocol libunwind
dbus libuuid openssl gperf m4 libevdev tradcpp libinput mcpp makeWrapper autoreconfHook
autoconf automake libtool mtdev pixman libGL
autoconf automake libtool mtdev pixman libGL libGLU
cairo epoxy;
inherit (buildPackages) pkgconfig xmlto asciidoc flex bison;
inherit (darwin) apple_sdk cf-private libobjc;