xorg-server:

- big cleanup
- move xinitrc.d dir to /etc
This commit is contained in:
Stephan Raue 2009-10-27 02:57:30 +01:00
parent 727d3a1f1a
commit eddbabe67a
6 changed files with 33843 additions and 387 deletions

View File

@ -33,7 +33,7 @@ $SCRIPTS/build xf86bigfontproto
$SCRIPTS/build dbus
$SCRIPTS/build hal
if [ $XINERAMA = yes ]; then
if [ "$XINERAMA" = "yes" ]; then
$SCRIPTS/build libXinerama
XORG_CONFIG="$XORG_CONFIG --enable-xinerama"
else
@ -50,7 +50,7 @@ cd $PKG_BUILD
--disable-static \
--enable-shared \
--enable-shave \
--disable-werror \
--disable-strict-compilation \
--disable-debug \
--disable-builddocs \
--enable-largefile \
@ -114,7 +114,4 @@ cd $PKG_BUILD
make
$STRIP hw/xfree86/Xorg
$STRIP hw/xfree86/utils/gtf/gtf
make DESTDIR=$SYSROOT_PREFIX install

View File

@ -9,7 +9,4 @@
progress "starting Xorg"
mkdir -p /var/lib/xkb/
# xinit $XINITRC -- $XSERVERRC > /dev/null 2>&1
xinit > /dev/null 2>&1

View File

@ -24,11 +24,9 @@ XORG_DST="$INSTALL/$XORG_PATH_MODULES"
mkdir -p $INSTALL/usr/bin
cp $XORG_SRC/Xorg $INSTALL/usr/bin
cp $XORG_SRC/utils/gtf/gtf $INSTALL/usr/bin
cp -PR $PKG_DIR/scripts/xinit $INSTALL/usr/bin
#opt:
cp $XORG_SRC/utils/cvt/cvt $INSTALL/usr/bin
# cp $XORG_SRC/utils/cvt/cvt $INSTALL/usr/bin
mkdir -p $XORG_DST
cp $XORG_SRC/exa/.libs/libexa.so $XORG_DST
@ -64,7 +62,6 @@ cp $PKG_BUILD/config/xorg-server.conf $INSTALL/etc/dbus-1/system.d
mkdir -p $INSTALL/usr/share/hal/fdi/policy/10osvendor/
cp $PKG_BUILD/config/x11-input.fdi $INSTALL/usr/share/hal/fdi/policy/10osvendor/10-x11-input.fdi
#Fonts
$SCRIPTS/install encodings
$SCRIPTS/install font-xfree86-type1
@ -87,4 +84,5 @@ get_graphicdrivers
#Tools
$SCRIPTS/install openbox
$SCRIPTS/install xrandr
[ "$DEVTOOLS" = yes ] && $SCRIPTS/install mrxvt

View File

@ -1,367 +0,0 @@
diff -Naur xorg-server-20090727/configure xorg-server-20090727.patch/configure
--- xorg-server-20090727/configure 2009-07-27 02:52:50.000000000 +0200
+++ xorg-server-20090727.patch/configure 2009-08-08 20:52:06.226477656 +0200
@@ -2185,7 +2185,7 @@
Comma separated list of font dirs
--with-xkb-path=PATH Path to XKB base dir (default: ${datadir}/X11/xkb)
--with-xkb-output=PATH Path to XKB output dir (default:
- ${datadir}/X11/xkb/compiled)
+ ${localstatedir}/cache/xkb)
--with-default-xkb-rules=RULES
Keyboard ruleset (default: base/evdev)
--with-default-xkb-model=MODEL
@@ -19621,7 +19621,7 @@
if test "${with_xkb_output+set}" = set; then
withval=$with_xkb_output; XKBOUTPUT="$withval"
else
- XKBOUTPUT="compiled"
+ XKBOUTPUT="${localstatedir}/cache/xkb"
fi
@@ -23630,7 +23630,9 @@
XKBOUTPUT_FIRSTCHAR=`echo $XKBOUTPUT | cut -b 1`
if [ x$XKBOUTPUT_FIRSTCHAR != x/ ] ; then
- XKBOUTPUT="$XKB_BASE_DIRECTORY/$XKBOUTPUT"
+ { { $as_echo "$as_me:$LINENO: error: xkb-output must be an absolute path." >&5
+$as_echo "$as_me: error: xkb-output must be an absolute path." >&2;}
+ { (exit 1); exit 1; }; }
fi
diff -Naur xorg-server-20090727/configure.ac xorg-server-20090727.patch/configure.ac
--- xorg-server-20090727/configure.ac 2009-07-26 16:15:37.000000000 +0200
+++ xorg-server-20090727.patch/configure.ac 2009-08-08 20:28:07.100479376 +0200
@@ -488,9 +488,9 @@
AC_ARG_WITH(xkb-path, AS_HELP_STRING([--with-xkb-path=PATH], [Path to XKB base dir (default: ${datadir}/X11/xkb)]),
[ XKBPATH="$withval" ],
[ XKBPATH="${datadir}/X11/xkb" ])
-AC_ARG_WITH(xkb-output, AS_HELP_STRING([--with-xkb-output=PATH], [Path to XKB output dir (default: ${datadir}/X11/xkb/compiled)]),
+AC_ARG_WITH(xkb-output, AS_HELP_STRING([--with-xkb-output=PATH], [Path to XKB output dir (default: ${localstatedir}/cache/xkb)]),
[ XKBOUTPUT="$withval" ],
- [ XKBOUTPUT="compiled" ])
+ [ XKBOUTPUT="${localstatedir}/cache/xkb" ])
AC_ARG_WITH(default-xkb-rules, AS_HELP_STRING([--with-default-xkb-rules=RULES],
[Keyboard ruleset (default: base/evdev)]),
[ XKB_DFLT_RULES="$withval" ],
@@ -1042,7 +1042,7 @@
dnl Make sure XKM_OUTPUT_DIR is an absolute path
XKBOUTPUT_FIRSTCHAR=`echo $XKBOUTPUT | cut -b 1`
if [[ x$XKBOUTPUT_FIRSTCHAR != x/ ]] ; then
- XKBOUTPUT="$XKB_BASE_DIRECTORY/$XKBOUTPUT"
+ AC_MSG_ERROR([xkb-output must be an absolute path.])
fi
dnl XKM_OUTPUT_DIR (used in code) must end in / or file names get hosed
diff -Naur xorg-server-20090727/xkb/ddxLoad.c xorg-server-20090727.patch/xkb/ddxLoad.c
--- xorg-server-20090727/xkb/ddxLoad.c 2009-07-26 16:15:37.000000000 +0200
+++ xorg-server-20090727.patch/xkb/ddxLoad.c 2009-08-08 20:48:46.504353541 +0200
@@ -32,6 +32,13 @@
#include <xkb-config.h>
#endif
+#ifdef HAVE_SHA1_IN_LIBMD /* Use libmd for SHA1 */
+# include <sha1.h>
+#else /* Use OpenSSL's libcrypto */
+# include <stddef.h> /* buggy openssl/sha.h wants size_t */
+# include <openssl/sha.h>
+#endif
+
#include <stdio.h>
#include <ctype.h>
#include <X11/X.h>
@@ -45,24 +52,13 @@
#define XKBSRV_NEED_FILE_FUNCS
#include <xkbsrv.h>
#include <X11/extensions/XI.h>
+#include <errno.h>
#include "xkb.h"
#if defined(CSRG_BASED) || defined(linux) || defined(__GNU__)
#include <paths.h>
#endif
- /*
- * If XKM_OUTPUT_DIR specifies a path without a leading slash, it is
- * relative to the top-level XKB configuration directory.
- * Making the server write to a subdirectory of that directory
- * requires some work in the general case (install procedure
- * has to create links to /var or somesuch on many machines),
- * so we just compile into /usr/tmp for now.
- */
-#ifndef XKM_OUTPUT_DIR
-#define XKM_OUTPUT_DIR "compiled/"
-#endif
-
#define PRE_ERROR_MSG "\"The XKEYBOARD keymap compiler (xkbcomp) reports:\""
#define ERROR_PREFIX "\"> \""
#define POST_ERROR_MSG1 "\"Errors from xkbcomp are not fatal to the X server\""
@@ -178,6 +174,45 @@
}
static Bool
+Sha1Asc(char sha1Asc[SHA_DIGEST_LENGTH*2+1], const char * input)
+{
+ int i;
+ unsigned char sha1[SHA_DIGEST_LENGTH];
+
+#ifdef HAVE_SHA1_IN_LIBMD /* Use libmd for SHA1 */
+ SHA1_CTX ctx;
+
+ SHA1Init (&ctx);
+ SHA1Update (&ctx, input, strlen(input));
+ SHA1Final (sha1, &ctx);
+#else /* Use OpenSSL's libcrypto */
+ SHA_CTX ctx;
+ int success;
+
+ success = SHA1_Init (&ctx);
+ if (! success)
+ return BadAlloc;
+
+ success = SHA1_Update (&ctx, input, strlen(input));
+ if (! success)
+ return BadAlloc;
+
+ success = SHA1_Final (sha1, &ctx);
+ if (! success)
+ return BadAlloc;
+#endif
+
+ /* convert sha1 to sha1_asc */
+ for(i=0; i<SHA_DIGEST_LENGTH; ++i) {
+ sprintf(sha1Asc+i*2, "%02X", sha1[i]);
+ }
+
+ return Success;
+}
+
+/* call xkbcomp and compile XKB keymap, return xkm file name in
+ nameRtrn */
+static Bool
XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
XkbComponentNamesPtr names,
unsigned want,
@@ -186,7 +221,11 @@
int nameRtrnLen)
{
FILE * out;
- char *buf = NULL, keymap[PATH_MAX], xkm_output_dir[PATH_MAX];
+ char * buf = NULL, xkmfile[PATH_MAX], xkm_output_dir[PATH_MAX];
+ char * tmpXkmFile = NULL;
+ char * canonicalXkmFileName = NULL;
+ char sha1Asc[SHA_DIGEST_LENGTH*2+1], xkbKeyMapBuf[100*1024];
+ int ret, result;
const char *emptystring = "";
const char *xkbbasedirflag = emptystring;
@@ -197,15 +236,69 @@
/* WIN32 has no popen. The input must be stored in a file which is
used as input for xkbcomp. xkbcomp does not read from stdin. */
char tmpname[PATH_MAX];
- const char *xkmfile = tmpname;
+ const char *xkbfile = tmpname;
#else
- const char *xkmfile = "-";
+ const char *xkbfile = "-";
+#endif
+
+ /* Write keymap source (xkbfile) to memory buffer `xkbKeyMapBuf',
+ of which SHA1 is generated and used as result xkm file name */
+ memset(xkbKeyMapBuf, 0, sizeof(xkbKeyMapBuf));
+ out = fmemopen(xkbKeyMapBuf, sizeof(xkbKeyMapBuf), "w");
+ if (NULL == out) {
+ ErrorF("[xkb] Open xkbKeyMapBuf for writing failed\n");
+ return False;
+ }
+ ret = XkbWriteXKBKeymapForNames(out, names, xkb, want, need);
+ if (fclose(out) !=0)
+ {
+ ErrorF("[xkb] XkbWriteXKBKeymapForNames error, perhaps xkbKeyMapBuf is too small\n");
+ return False;
+ }
+#ifdef DEBUG
+ if (xkbDebugFlags) {
+ ErrorF("[xkb] XkbDDXCompileKeymapByNames compiling keymap:\n");
+ fputs(xkbKeyMapBuf, stderr);
+ }
#endif
+ if (!ret) {
+ ErrorF("[xkb] Generating XKB Keymap failed, giving up compiling keymap\n");
+ return False;
+ }
- snprintf(keymap, sizeof(keymap), "server-%s", display);
+ DebugF("[xkb] computing SHA1 of keymap\n");
+ if (Success == Sha1Asc(sha1Asc, xkbKeyMapBuf)) {
+ snprintf(xkmfile, sizeof(xkmfile), "server-%s", sha1Asc);
+ }
+ else {
+ ErrorF("[xkb] Computing SHA1 of keymap failed, "
+ "using display name instead as xkm file name\n");
+ snprintf(xkmfile, sizeof(xkmfile), "server-%s", display);
+ }
OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir));
+ /* set nameRtrn, fail if it's too small */
+ if ((strlen(xkmfile)+1 > nameRtrnLen) && nameRtrn) {
+ ErrorF("[xkb] nameRtrn too small to hold xkmfile name\n");
+ return False;
+ }
+ strncpy(nameRtrn, xkmfile, nameRtrnLen);
+
+ /* if the xkm file already exists, reuse it */
+ canonicalXkmFileName = Xprintf("%s%s.xkm", xkm_output_dir, xkmfile);
+ if (access(canonicalXkmFileName, R_OK) == 0) {
+ /* yes, we can reuse the old xkm file */
+ LogMessage(X_INFO, "XKB: reuse xkmfile %s\n", canonicalXkmFileName);
+ result = True;
+ goto _ret;
+ }
+ LogMessage(X_INFO, "XKB: generating xkmfile %s\n", canonicalXkmFileName);
+
+ /* continue to call xkbcomp to compile the keymap. to avoid race
+ condition, we compile it to a tmpfile then rename it to
+ xkmfile */
+
#ifdef WIN32
strcpy(tmpname, Win32TempDir());
strcat(tmpname, "\\xkb_XXXXXX");
@@ -228,19 +321,30 @@
}
}
+ if ( (tmpXkmFile = tempnam(xkm_output_dir, NULL)) == NULL ) {
+ ErrorF("[xkb] Can't generate temp xkm file name");
+ result = False;
+ goto _ret;
+ }
+
buf = Xprintf("\"%s%sxkbcomp\" -w %d %s -xkm \"%s\" "
- "-em1 %s -emp %s -eml %s \"%s%s.xkm\"",
+ "-em1 %s -emp %s -eml %s \"%s\"",
xkbbindir, xkbbindirsep,
( (xkbDebugFlags < 2) ? 1 :
((xkbDebugFlags > 10) ? 10 : (int)xkbDebugFlags) ),
- xkbbasedirflag, xkmfile,
+ xkbbasedirflag, xkbfile,
PRE_ERROR_MSG, ERROR_PREFIX, POST_ERROR_MSG1,
- xkm_output_dir, keymap);
+ tmpXkmFile);
if (xkbbasedirflag != emptystring) {
xfree(xkbbasedirflag);
}
+ /* there's a potential race condition between calling tempnam()
+ and invoking xkbcomp to write the result file (potential temp
+ file name conflicts), but since xkbcomp is a standalone
+ program, we have to live with this */
+
#ifndef WIN32
out= Popen(buf,"w");
#else
@@ -248,31 +352,43 @@
#endif
if (out!=NULL) {
-#ifdef DEBUG
- if (xkbDebugFlags) {
- ErrorF("[xkb] XkbDDXCompileKeymapByNames compiling keymap:\n");
- XkbWriteXKBKeymapForNames(stderr,names,xkb,want,need);
+ /* write XKBKeyMapBuf to xkbcomp */
+ if (EOF==fputs(xkbKeyMapBuf, out))
+ {
+ ErrorF("[xkb] Sending keymap to xkbcomp failed\n");
+ result = False;
+ goto _ret;
}
-#endif
- XkbWriteXKBKeymapForNames(out,names,xkb,want,need);
#ifndef WIN32
if (Pclose(out)==0)
#else
if (fclose(out)==0 && System(buf) >= 0)
#endif
{
+ /* xkbcomp success */
if (xkbDebugFlags)
DebugF("[xkb] xkb executes: %s\n",buf);
- if (nameRtrn) {
- strncpy(nameRtrn,keymap,nameRtrnLen);
- nameRtrn[nameRtrnLen-1]= '\0';
+
+ /* if canonicalXkmFileName already exists now, we simply
+ overwrite it, this is OK */
+ ret = rename(tmpXkmFile, canonicalXkmFileName);
+ if (0 != ret) {
+ ErrorF("[xkb] Can't rename %s to %s, error: %s\n",
+ tmpXkmFile, canonicalXkmFileName,
+ strerror(errno));
+
+ /* in case of error, don't unlink tmpXkmFile, leave it
+ for debugging */
+
+ result = False;
+ goto _ret;
}
- if (buf != NULL)
- xfree (buf);
- return True;
+
+ result = True;
+ goto _ret;
}
else
- LogMessage(X_ERROR, "Error compiling keymap (%s)\n", keymap);
+ LogMessage(X_ERROR, "Error compiling keymap (%s)\n", xkbfile);
#ifdef WIN32
/* remove the temporary file */
unlink(tmpname);
@@ -287,9 +403,17 @@
}
if (nameRtrn)
nameRtrn[0]= '\0';
+ result = False;
+
+_ret:
+ if (tmpXkmFile)
+ free(tmpXkmFile);
+ if (canonicalXkmFileName)
+ xfree(canonicalXkmFileName);
if (buf != NULL)
xfree (buf);
- return False;
+
+ return result;
}
static FILE *
@@ -373,7 +497,6 @@
DebugF("Loaded XKB keymap %s, defined=0x%x\n",fileName,(*xkbRtrn)->defined);
}
fclose(file);
- (void) unlink (fileName);
return (need|want)&(~missing);
}
diff -Naur xorg-server-20090727/xkb/README.compiled xorg-server-20090727.patch/xkb/README.compiled
--- xorg-server-20090727/xkb/README.compiled 2009-07-26 16:15:37.000000000 +0200
+++ xorg-server-20090727.patch/xkb/README.compiled 2009-08-08 20:29:17.059354234 +0200
@@ -4,10 +4,10 @@
or some other tool might destroy or replace the files in this directory,
so it is not a safe place to store compiled keymaps for long periods of
time. The default keymap for any server is usually stored in:
- X<num>-default.xkm
-where <num> is the display number of the server in question, which makes
-it possible for several servers *on the same host* to share the same
-directory.
+ server-<SHA1>.xkm
+
+where <SHA1> is the SHA1 hash of keymap source, so that compiled
+keymap of different keymap sources are stored in different files.
Unless the X server is modified, sharing this directory between servers on
different hosts could cause problems.

View File

@ -2,22 +2,15 @@
. /etc/sysconfig
# 'vt02' starts X on virtual terminal 2.
# '-logverbose 6' enables useful troubleshooting output in /var/log/Xorg.0.0.log.
args="-s 0 -br -noreset -allowMouseOpenFail "
if /usr/bin/test "${MOOVIDA_DEBUG}" = "yes" ; then
args="${args} -logverbose 6 -verbose 0"
fi
mkdir -p /var/cache/xkb
exec /usr/bin/Xorg :0.0 vt$TTY ${args} > /dev/null 2>&1 &
while true; do
if [ -f /tmp/.X0-lock ]; then
for file in /usr/etc/xinitrc.d/* ; do
for file in /etc/xinitrc.d/* ; do
. ${file}
done
break