rechange location of database packages

This commit is contained in:
Stephan Raue 2009-04-06 13:29:18 +02:00
parent 2b7efd8ffa
commit 8347a74046
30 changed files with 1302 additions and 0 deletions

36
packages/databases/sqlite/build Executable file
View File

@ -0,0 +1,36 @@
#!/bin/sh
. config/options
$SCRIPTS/build toolchain
$SCRIPTS/build readline
$SCRIPTS/build ncurses
export config_BUILD_CC="$HOST_CC"
export config_BUILD_CFLAGS="$HOST_CFLAGS"
export config_BUILD_LIBS="$HOST_LDFLAGS"
export config_TARGET_CC="$CC"
export config_TARGET_LINK="$LD"
export config_TARGET_CFLAGS="$CFLAGS"
export config_TARGET_LFLAGS="$LDFLAGS"
export config_TARGET_LIBS="-lncurses"
export config_TARGET_READLINE_LIBS="-L$SYSROOT_PREFIX/usr/lib"
export config_TARGET_READLINE_INC="-I$SYSROOT_PREFIX/usr/include/readline -lreadline"
cd $BUILD/$1*
./configure --host=$TARGET_NAME \
--build=$HOST_NAME \
--prefix=/usr \
--sysconfdir=/etc \
--disable-static \
--enable-shared \
--disable-tcl \
--enable-threadsafe
make
$STRIP .libs/*.so*
$STRIP .libs/sqlite3
$MAKEINSTALL

View File

@ -0,0 +1,7 @@
#!/bin/sh
. config/options
mkdir -p $INSTALL/usr/lib
cp -PR $BUILD/$1*/.libs/*.so* $INSTALL/usr/lib
cp $BUILD/$1*/.libs/sqlite3 $INSTALL/usr/bin

View File

@ -0,0 +1,92 @@
--- sqlite-3.3.7/configure.ac.orig 2006-08-21 00:20:50.000000000 +0200
+++ sqlite-3.3.7/configure.ac 2006-08-21 00:22:35.000000000 +0200
@@ -187,10 +187,11 @@
default_build_cflags="-g"
if test "$config_BUILD_CC" = ""; then
AC_PROG_CC
- if test "$cross_compiling" = "yes"; then
- AC_MSG_ERROR([unable to find a compiler for building build tools])
- fi
- BUILD_CC=$CC
+# if test "$cross_compiling" = "yes"; then
+# AC_MSG_ERROR([unable to find a compiler for building build tools])
+# fi
+# BUILD_CC=$CC
+BUILD_CC=gcc
default_build_cflags=$CFLAGS
else
BUILD_CC=$config_BUILD_CC
@@ -238,6 +239,12 @@
TARGET_LINK=$config_TARGET_LINK
fi
AC_MSG_RESULT($TARGET_LINK)
+if test "$config_TARGET_LFLAGS" != ""; then
+ TARGET_LFLAGS=$config_TARGET_LFLAGS
+ else
+ TARGET_LFLAGS=$BUILD_LFLAGS
+ fi
+AC_MSG_RESULT($TARGET_LFLAGS)
AC_MSG_CHECKING([switches on the target compiler])
if test "$config_TARGET_TFLAGS" != ""; then
TARGET_TFLAGS=$config_TARGET_TFLAGS
@@ -592,15 +599,7 @@
# Figure out what C libraries are required to compile programs
# that use "readline()" library.
#
-if test "$config_TARGET_READLINE_LIBS" != ""; then
- TARGET_READLINE_LIBS="$config_TARGET_READLINE_LIBS"
-else
- CC=$TARGET_CC
- LIBS=""
- AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap])
- AC_CHECK_LIB([readline], [readline])
- TARGET_READLINE_LIBS="$LIBS"
-fi
+TARGET_READLINE_LIBS="-lreadline"
AC_SUBST(TARGET_READLINE_LIBS)
##########
@@ -615,41 +614,8 @@
##########
# Figure out where to get the READLINE header files.
#
-AC_MSG_CHECKING([readline header files])
-found=no
-if test "$config_TARGET_READLINE_INC" != ""; then
- TARGET_READLINE_INC=$config_TARGET_READLINE_INC
- found=yes
-fi
-if test "$found" = "yes"; then
- AC_MSG_RESULT($TARGET_READLINE_INC)
-else
- AC_MSG_RESULT(not specified: still searching...)
- AC_CHECK_HEADER(readline.h, [found=yes])
-fi
-if test "$found" = "no"; then
- for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
- AC_CHECK_FILE($dir/include/readline.h, found=yes)
- if test "$found" = "yes"; then
- TARGET_READLINE_INC="-I$dir/include"
- break
- fi
- AC_CHECK_FILE($dir/include/readline/readline.h, found=yes)
- if test "$found" = "yes"; then
- TARGET_READLINE_INC="-I$dir/include/readline"
- break
- fi
- done
-fi
-if test "$found" = "yes"; then
- if test "$TARGET_READLINE_LIBS" = ""; then
- TARGET_HAVE_READLINE=0
- else
- TARGET_HAVE_READLINE=1
- fi
-else
- TARGET_HAVE_READLINE=0
-fi
+TARGET_READLINE_INC=""
+TARGET_HAVE_READLINE=1
AC_SUBST(TARGET_READLINE_INC)
AC_SUBST(TARGET_HAVE_READLINE)

View File

@ -0,0 +1,25 @@
Index: sqlite-3.2.1/Makefile.in
===================================================================
--- sqlite-3.2.1.orig/Makefile.in 2005-03-23 17:09:39.000000000 +0100
+++ sqlite-3.2.1/Makefile.in 2005-04-25 23:11:20.000000000 +0200
@@ -15,7 +15,10 @@
# The toplevel directory of the source tree. This is the directory
# that contains this "Makefile.in" and the "configure.in" script.
#
-TOP = @srcdir@
+TOP = $(srcdir)
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+top_builddir = .
# C Compiler and options for use in building executables that
# will run on the platform that is doing the build.
@@ -96,7 +99,7 @@
exec_prefix = @exec_prefix@
libdir = @libdir@
INSTALL = @INSTALL@
-LIBTOOL = ./libtool
+LIBTOOL = @LIBTOOL@
ALLOWRELEASE = @ALLOWRELEASE@
# libtool compile/link/install

View File

@ -0,0 +1,67 @@
--- sqlite-3.3.7/Makefile.in.orig 2006-08-20 23:05:36.000000000 +0200
+++ sqlite-3.3.7/Makefile.in 2006-08-20 23:42:49.000000000 +0200
@@ -31,6 +31,10 @@
#
TCC = @TARGET_CC@ @TARGET_CFLAGS@ -I. -I${TOP}/src
+# OE overrides
+#
+TARGET_LFLAGS = @TARGET_LFLAGS@
+
# Define -DNDEBUG to compile without debugging (i.e., for production usage)
# Omitting the define will cause extra debugging code to be inserted and
# includes extra comments when "EXPLAIN stmt" is used.
@@ -257,17 +261,17 @@
| $(NAWK) '{print $$5,$$6}' >last_change
libsqlite3.la: $(LIBOBJ)
- $(LTLINK) -o libsqlite3.la $(LIBOBJ) $(LIBPTHREAD) \
+ $(LTLINK) -o libsqlite3.la $(LIBOBJ) $(TARGET_LFLAGS) $(LIBPTHREAD) \
${ALLOWRELEASE} -rpath $(libdir) -version-info "8:6:8"
libtclsqlite3.la: tclsqlite.lo libsqlite3.la
$(LTLINK) -o libtclsqlite3.la tclsqlite.lo \
- $(LIBOBJ) @TCL_STUB_LIB_SPEC@ $(LIBPTHREAD) \
+ $(LIBOBJ) @TCL_STUB_LIB_SPEC@ $(TARGET_LFLAGS) $(LIBPTHREAD) \
-rpath $(libdir)/sqlite \
-version-info "8:6:8"
sqlite3$(TEXE): $(TOP)/src/shell.c libsqlite3.la sqlite3.h
- $(LTLINK) $(READLINE_FLAGS) $(LIBPTHREAD) \
+ $(LTLINK) $(TARGET_LFLAGS) $(READLINE_FLAGS) $(LIBPTHREAD) \
-o $@ $(TOP)/src/shell.c libsqlite3.la \
$(LIBREADLINE) $(TLIBS)
@@ -456,12 +460,12 @@
tclsqlite3: tclsqlite-shell.lo libsqlite3.la
$(LTLINK) -o tclsqlite3 tclsqlite-shell.lo \
- libsqlite3.la $(LIBTCL)
+ libsqlite3.la $(TARGET_LFLAGS) $(LIBTCL)
testfixture$(TEXE): $(TOP)/src/tclsqlite.c libsqlite3.la $(TESTSRC)
$(LTLINK) -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 \
$(TEMP_STORE) -o testfixture $(TESTSRC) $(TOP)/src/tclsqlite.c \
- libsqlite3.la $(LIBTCL)
+ libsqlite3.la $(TARGET_LFLAGS) $(LIBTCL)
fulltest: testfixture$(TEXE) sqlite3$(TEXE)
@@ -471,7 +475,7 @@
./testfixture $(TOP)/test/quick.test
sqlite3_analyzer$(TEXE): $(TOP)/src/tclsqlite.c libtclsqlite3.la \
- $(TESTSRC) $(TOP)/tool/spaceanal.tcl
+ $(TARGET_LFLAGS) $(TESTSRC) $(TOP)/tool/spaceanal.tcl
sed \
-e '/^#/d' \
-e 's,\\,\\\\,g' \
@@ -481,7 +485,7 @@
$(TOP)/tool/spaceanal.tcl >spaceanal_tcl.h
$(LTLINK) -DTCLSH=2 -DSQLITE_TEST=1 $(TEMP_STORE)\
-o sqlite3_analyzer$(EXE) $(TESTSRC) $(TOP)/src/tclsqlite.c \
- libtclsqlite3.la $(LIBTCL)
+ libtclsqlite3.la $(TARGET_LFLAGS) $(LIBTCL)
# Rules used to build documentation
#

View File

@ -0,0 +1,21 @@
diff -Naur sqlite-3.3.7.orig/configure sqlite-3.3.7/configure
--- sqlite-3.3.7.orig/configure 2006-11-21 23:49:30.000000000 +0100
+++ sqlite-3.3.7/configure 2006-11-21 23:49:38.000000000 +0100
@@ -20414,7 +20414,7 @@
if eval "test \"\${$as_ac_File+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- test "$cross_compiling" = yes &&
+ test "$cross_compiling" = no &&
{ { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
{ (exit 1); exit 1; }; }
@@ -20440,7 +20440,7 @@
if eval "test \"\${$as_ac_File+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- test "$cross_compiling" = yes &&
+ test "$cross_compiling" = no &&
{ { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
{ (exit 1); exit 1; }; }

View File

@ -0,0 +1 @@
http://www.hwaci.com/sw/sqlite/sqlite-3.3.7.tar.gz

105
packages/emulators/SDL/build Executable file
View File

@ -0,0 +1,105 @@
#!/bin/sh
. config/options
$SCRIPTS/build toolchain
$SCRIPTS/build alsa-lib
$SCRIPTS/build libX11
$SCRIPTS/build libXrandr
$SCRIPTS/build $MESA
cd $BUILD/$1*
./configure --host=$TARGET_NAME \
--build=$HOST_NAME \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--enable-shared \
--disable-static \
--enable-libc \
--enable-audio \
--enable-video \
--enable-events \
--enable-joystick \
--enable-cdrom \
--enable-threads \
--enable-timers \
--enable-file \
--enable-loadso \
--enable-cpuinfo \
--enable-assembly \
--disable-oss \
--enable-alsa \
--disable-alsatest \
--enable-alsa-shared \
--disable-esd \
--disable-esdtest \
--disable-esd-shared \
--disable-arts \
--disable-arts-shared \
--disable-nas \
--disable-diskaudio \
--disable-dummyaudio \
--disable-mintaudio \
--enable-nasm \
--disable-altivec \
--disable-ipod \
--disable-video-nanox \
--disable-nanox-debug \
--disable-nanox-share-memory \
--disable-nanox-direct-fb \
--disable-x11-shared \
--disable-dga \
--disable-video-dga \
--disable-video-x11-dgamouse \
--disable-video-x11-xinerama \
--disable-video-x11-xme \
--enable-video-x11-xrandr \
--disable-video-x11-dpms \
--disable-video-photon \
--disable-video-carbon \
--disable-video-cocoa \
--enable-video-fbcon \
--disable-video-directfb \
--disable-video-ps2gs \
--disable-video-ggi \
--disable-video-svga \
--disable-video-vgl \
--disable-video-wscons \
--disable-video-aalib \
--disable-video-qtopia \
--disable-video-picogui \
--disable-video-xbios \
--disable-video-gem \
--disable-video-dummy \
--enable-video-opengl \
--disable-osmesa-shared \
--enable-input-events \
--disable-input-tslib \
--disable-pth \
--enable-pthreads \
--enable-pthread-sem \
--disable-stdio-redirect \
--disable-directx \
--enable-sdl-dlopen \
--disable-atari-ldg \
--disable-clock_gettime \
--enable-video-x11 \
--enable-video-x11-vm \
--enable-video-x11-xv \
--with-x
make
$STRIP build/.libs/*.so*
$MAKEINSTALL
cp sdl-config $ROOT/$TOOLCHAIN/bin
chmod 755 $ROOT/$TOOLCHAIN/bin/sdl-config
$SED "s:\(['= ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" \
$ROOT/$TOOLCHAIN/bin/sdl-config
#mkdir -p $ROOT/$TOOLCHAIN/include
#ln -snf `echo $ROOT/$BUILD/$1*/include` $ROOT/$TOOLCHAIN/include/SDL

11
packages/emulators/SDL/install Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
. config/options
$SCRIPTS/install alsa-lib
$SCRIPTS/install libX11
$SCRIPTS/install libXrandr
$SCRIPTS/install $MESA
mkdir -p $INSTALL/usr/lib
cp -P $BUILD/$1*/build/.libs/*.so* $INSTALL/usr/lib

View File

@ -0,0 +1 @@
http://www.libsdl.org/release/SDL-1.2.13.tar.gz

6
packages/emulators/install Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
. config/options
$SCRIPTS/install zsnes
$SCRIPTS/install scummvm

View File

@ -0,0 +1,29 @@
#!/bin/sh
. config/options
$SCRIPTS/build toolchain
$SCRIPTS/build SDL
$SCRIPTS/build alsa-lib
$SCRIPTS/build zlib
# for debug (will be removed)
#export CFLAGS="-O -g3 -Wall -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
#export CXXFLAGS="-O -g3 -Wall -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
cd $BUILD/$1*
./configure --host=openelec-$TARGET_ARCH \
--prefix=/usr \
--backend=sdl \
--enable-debug \
--enable-alsa \
--disable-mt32emu \
--disable-vorbis \
--disable-tremor \
--disable-mad \
--disable-flac \
--enable-zlib \
--disable-mpeg2 \
--disable-fluidsynth \
--disable-nasm
make

View File

@ -0,0 +1,9 @@
[Desktop Entry]
Name=ScummVM
Comment=Interpreter for several adventure games
Exec=/usr/bin/scummvm
Icon=/usr/share/scummvm/scummvm.xpm
Terminal=false
Type=Application
Categories=Game;AdventureGame;
StartupNotify=false

View File

@ -0,0 +1,16 @@
#!/bin/sh
. config/options
$SCRIPTS/install SDL
$SCRIPTS/install alsa-lib
mkdir -p $INSTALL/usr/bin
cp $BUILD/$1*/scummvm $INSTALL/usr/bin
#mkdir -p $INSTALL/usr/share/applications
#cp $PACKAGES/$1*/config/$1.desktop $INSTALL/usr/share/applications
mkdir -p $INSTALL/usr/share/scummvm
cp $BUILD/$1*/dists/engine-data/* $INSTALL/usr/share/scummvm
cp $BUILD/$1*/icons/scummvm.xpm $INSTALL/usr/share/scummvm

View File

@ -0,0 +1,27 @@
diff -Naur scummvm-0.9.1.orig/configure scummvm-0.9.1/configure
--- scummvm-0.9.1.orig/configure 2007-01-13 13:45:19.000000000 +0100
+++ scummvm-0.9.1/configure 2007-01-13 13:45:42.000000000 +0100
@@ -753,6 +753,23 @@
if test -n "$_host"; then
# Cross-compiling mode - add your target here if needed
case "$_host" in
+ openelec-i386)
+ echo "Cross-compiling to $_host, forcing endianness and type sizes"
+ DEFINES="$DEFINES -DUNIX"
+ _def_endianness='#define SCUMM_LITTLE_ENDIAN'
+ type_1_byte='char'
+ type_2_byte='short'
+ type_4_byte='int'
+ ;;
+ openelec-powerpc)
+ echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
+ DEFINES="$DEFINES -DUNIX"
+ _def_endianness='#define SCUMM_BIG_ENDIAN'
+ _def_align='#define SCUMM_NEED_ALIGNMENT'
+ type_1_byte='char'
+ type_2_byte='short'
+ type_4_byte='int'
+ ;;
linupy|arm-riscos)
echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
DEFINES="$DEFINES -DUNIX"

View File

@ -0,0 +1 @@
http://prdownloads.sourceforge.net/scummvm/scummvm-0.13.0.tar.bz2

View File

@ -0,0 +1 @@
i386

30
packages/emulators/zsnes/build Executable file
View File

@ -0,0 +1,30 @@
#!/bin/sh
. config/options
$SCRIPTS/build toolchain
$SCRIPTS/build SDL
$SCRIPTS/build zlib
$SCRIPTS/build libpng
$SCRIPTS/build $MESA
export HOST_CXX
export HOST_CXXFLAGS
cd $BUILD/$1*/src
./configure --host=$TARGET_NAME \
--build=$HOST_NAME \
--prefix=/usr \
--sysconfdir=/etc \
--disable-release \
--disable-debug \
--disable-debugger \
--disable-cpucheck force_arch=$TARGET_ARCH \
--enable-opengl \
--with-opengl-prefix=$SYSROOT_PREFIX/usr \
--disable-jma \
--enable-libpng \
--with-libpng-prefix=$SYSROOT_PREFIX/usr \
--with-x \
make

View File

@ -0,0 +1,9 @@
[Desktop Entry]
Name=zsnes
Comment=SNES emulator
Exec=/usr/bin/zsnes
Icon=/usr/share/zsnes/zsnes.png
Terminal=false
Type=Application
Categories=Game;
StartupNotify=false

View File

@ -0,0 +1,19 @@
#!/bin/sh
. config/options
$SCRIPTS/install SDL
$SCRIPTS/install zlib
$SCRIPTS/install libpng
$SCRIPTS/install $MESA
mkdir -p $INSTALL/etc/zsnes
mkdir -p $INSTALL/usr/bin
cp $BUILD/$1*/src/zsnes $INSTALL/usr/bin
#mkdir -p $INSTALL/usr/share/applications
#cp $PACKAGES/$1*/config/$1.desktop $INSTALL/usr/share/applications
#mkdir -p $INSTALL/usr/share/zsnes
#cp $BUILD/$1*/src/icons/64x64x32.png $INSTALL/usr/share/zsnes/zsnes.png

View File

@ -0,0 +1,33 @@
--- zsnes-1.5-RC1-svn/src/configure.orig 2006-12-07 10:16:09.000000000 +0100
+++ zsnes-1.5-RC1-svn/src/configure 2006-12-07 10:39:59.000000000 +0100
@@ -1742,9 +1742,9 @@
VERSION=pre1.43
-CFLAGS="$CFLAGS -pipe -I. -I/usr/local/include -I/usr/include"
+CFLAGS="$CFLAGS -pipe -I."
-LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/lib"
+LDFLAGS="$LDFLAGS"
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
@@ -4026,17 +4026,7 @@
{ echo "$as_me:$LINENO: result: $with_zlib" >&5
echo "${ECHO_T}$with_zlib" >&6; }
fi
-if test x$with_zlib = xyes; then
- ZLIB_VERSION=$(<conf.zlibtest)
- :
-else
- ZLIB_CFLAGS=""
- ZLIB_LIBS=""
- ZLIB_VERSION=""
- { { echo "$as_me:$LINENO: error: zlib >= 1.2.3 is required" >&5
-echo "$as_me: error: zlib >= 1.2.3 is required" >&2;}
- { (exit 1); exit 1; }; }
-fi
+ZLIB_VERSION=1.2.3
LIBS="$tempLIBS"
CFLAGS="$tempCFLAGS"
rm conf.zlibtest

View File

@ -0,0 +1,51 @@
diff -Naur zsnes_1_51b/src/Makefile.in zsnes_1_51ba/src/Makefile.in
--- zsnes_1_51b/src/Makefile.in 2007-01-24 21:54:12.000000000 +0100
+++ zsnes_1_51ba/src/Makefile.in 2009-01-06 18:04:23.000000000 +0100
@@ -104,32 +104,36 @@
rm -f version.o
$(PSR): parsegen.cpp
- @CXX@ @CXXFLAGS@ -o $@ $< -lz
+ $(HOST_CXX) $(HOST_CXXFLAGS) -o $@ $< -lz
TOOLSEXE=$(TOOL_D)/archopt $(TOOL_D)/cutrtype $(TOOL_D)/extraext\
$(TOOL_D)/macroll $(TOOL_D)/minwhite $(TOOL_D)/nreplace\
$(TOOL_D)/sec-test $(TOOL_D)/srccount $(TOOL_D)/varrep
tools: $(TOOLSEXE) $(TOOL_D)/depbuild
+$(TOOL_D)/fileutil.o: $(TOOL_D)/fileutil.cpp
+ $(HOST_CXX) $(HOST_CXXFLAGS) -o $@ -c $<
+$(TOOL_D)/strutil.o: $(TOOL_D)/strutil.cpp
+ $(HOST_CXX) $(HOST_CXXFLAGS) -o $@ -c $<
$(TOOL_D)/archopt: $(TOOL_D)/archopt.c
- @CC@ @CFLAGS@ -m32 -o $@ $@.c
+ $(HOST_CXX) $(HOST_CXXFLAGS) -m32 -o $@ $@.c
$(TOOL_D)/cutrtype: $(TOOL_D)/cutrtype.cpp $(TOOL_O)
- @CXX@ @CXXFLAGS@ -o $@ $@.cpp $(TOOL_O)
+ $(HOST_CXX) $(HOST_CXXFLAGS) -o $@ $@.cpp $(TOOL_O)
$(TOOL_D)/depbuild: $(TOOL_D)/depbuild.cpp $(TOOL_O)
- @CXX@ @CXXFLAGS@ -o $@ $@.cpp $(TOOL_O)
+ $(HOST_CXX) $(HOST_CXXFLAGS) -o $@ $@.cpp $(TOOL_O)
$(TOOL_D)/extraext: $(TOOL_D)/extraext.cpp $(TOOL_O)
- @CXX@ @CXXFLAGS@ -o $@ $@.cpp $(TOOL_O)
+ $(HOST_CXX) $(HOST_CXXFLAGS) -o $@ $@.cpp $(TOOL_O)
$(TOOL_D)/macroll: $(TOOL_D)/macroll.cpp $(TOOL_O)
- @CXX@ @CXXFLAGS@ -o $@ $@.cpp $(TOOL_O)
+ $(HOST_CXX) $(HOST_CXXFLAGS) -o $@ $@.cpp $(TOOL_O)
$(TOOL_D)/minwhite: $(TOOL_D)/minwhite.cpp $(TOOL_O)
- @CXX@ @CXXFLAGS@ -o $@ $@.cpp $(TOOL_D)/fileutil.o
+ $(HOST_CXX) $(HOST_CXXFLAGS) -o $@ $@.cpp $(TOOL_D)/fileutil.o
$(TOOL_D)/nreplace: $(TOOL_D)/nreplace.cpp $(TOOL_O)
- @CXX@ @CXXFLAGS@ -o $@ $@.cpp $(TOOL_D)/fileutil.o
+ $(HOST_CXX) $(HOST_CXXFLAGS) -o $@ $@.cpp $(TOOL_D)/fileutil.o
$(TOOL_D)/sec-test: $(TOOL_D)/sec-test.cpp $(TOOL_O)
- @CXX@ @CXXFLAGS@ -o $@ $@.cpp $(TOOL_O)
+ $(HOST_CXX) $(HOST_CXXFLAGS) -o $@ $@.cpp $(TOOL_O)
$(TOOL_D)/srccount: $(TOOL_D)/srccount.cpp $(TOOL_O)
- @CXX@ @CXXFLAGS@ -o $@ $@.cpp $(TOOL_D)/fileutil.o
+ $(HOST_CXX) $(HOST_CXXFLAGS) -o $@ $@.cpp $(TOOL_D)/fileutil.o
$(TOOL_D)/varrep: $(TOOL_D)/varrep.cpp $(TOOL_O)
- @CXX@ @CXXFLAGS@ -o $@ $@.cpp $(TOOL_O)
+ $(HOST_CXX) $(HOST_CXXFLAGS) -o $@ $@.cpp $(TOOL_O)
include makefile.dep
makefile.dep: $(TOOL_D)/depbuild Makefile

View File

@ -0,0 +1,11 @@
diff -Naur zsnes-1.5-RC1-svn.orig/src/mmlib/linux.c zsnes-1.5-RC1-svn/src/mmlib/linux.c
--- zsnes-1.5-RC1-svn.orig/src/mmlib/linux.c 2006-12-01 13:21:42.000000000 +0100
+++ zsnes-1.5-RC1-svn/src/mmlib/linux.c 2006-12-13 20:08:12.000000000 +0100
@@ -41,6 +41,7 @@
#include <sys/stat.h>
#include <fcntl.h>
+#include <linux/joystick.h>
#include <linux/input.h> /* evdev interface... */
#define test_bit(array, bit) (array[bit/8] & (1<<(bit%8)))

View File

@ -0,0 +1,11 @@
diff -Naur zsnes-1.5-RC1-svn.orig/src/zpath.c zsnes-1.5-RC1-svn/src/zpath.c
--- zsnes-1.5-RC1-svn.orig/src/zpath.c 2006-12-01 13:22:21.000000000 +0100
+++ zsnes-1.5-RC1-svn/src/zpath.c 2006-12-13 20:36:29.000000000 +0100
@@ -99,6 +99,7 @@
}
else
{
+ ZStartPath = strdup ("/etc/zsnes/");
ZCfgPath = ZStartPath;
}
}

View File

@ -0,0 +1,5 @@
#!/bin/sh
. config/options
sed -i -e "s:return(string(string(\"gcc \")+cflags+(\" -o \")+obj+string(\" -c \")+c));:return(string(string(\"$TARGET_CC \")+cflags+(\" -o \")+obj+string(\" -c \")+c));:" $BUILD/$1*/src/parsegen.cpp

View File

@ -0,0 +1 @@
http://zsnes.sf.net/zsnes151bsrc.tar.bz2

View File

@ -0,0 +1,30 @@
diff -Naur uClibc-0.9.30.1/extra/scripts/unifdef.c uClibc-0.9.30.1.patch/extra/scripts/unifdef.c
--- uClibc-0.9.30.1/extra/scripts/unifdef.c 2008-04-28 01:10:00.000000000 +0200
+++ uClibc-0.9.30.1.patch/extra/scripts/unifdef.c 2009-04-06 13:19:01.225263004 +0200
@@ -206,7 +206,7 @@
static void error(const char *);
static int findsym(const char *);
static void flushline(bool);
-static Linetype getline(void);
+static Linetype get_line(void);
static Linetype ifeval(const char **);
static void ignoreoff(void);
static void ignoreon(void);
@@ -512,7 +512,7 @@
for (;;) {
linenum++;
- lineval = getline();
+ lineval = get_line();
trans_table[ifstate[depth]][lineval]();
debug("process %s -> %s depth %d",
linetype_name[lineval],
@@ -526,7 +526,7 @@
* help from skipcomment().
*/
static Linetype
-getline(void)
+get_line(void)
{
const char *cp;
int cursym;

View File

@ -0,0 +1,30 @@
diff -Naur uClibc-0.9.30.1/extra/scripts/unifdef.c uClibc-0.9.30.1.patch/extra/scripts/unifdef.c
--- uClibc-0.9.30.1/extra/scripts/unifdef.c 2008-04-28 01:10:00.000000000 +0200
+++ uClibc-0.9.30.1.patch/extra/scripts/unifdef.c 2009-04-03 23:40:08.502998983 +0200
@@ -206,7 +206,7 @@
static void error(const char *);
static int findsym(const char *);
static void flushline(bool);
-static Linetype getline(void);
+static Linetype parseline(void);
static Linetype ifeval(const char **);
static void ignoreoff(void);
static void ignoreon(void);
@@ -512,7 +512,7 @@
for (;;) {
linenum++;
- lineval = getline();
+ lineval = parseline();
trans_table[ifstate[depth]][lineval]();
debug("process %s -> %s depth %d",
linetype_name[lineval],
@@ -526,7 +526,7 @@
* help from skipcomment().
*/
static Linetype
-getline(void)
+parseline(void)
{
const char *cp;
int cursym;

View File

@ -0,0 +1,340 @@
From e7046c26d7ac970bfd75cae16262845bef72423b Mon Sep 17 00:00:00 2001
From: Yan Li <yan.i.li@intel.com>
Date: Tue, 24 Mar 2009 17:43:12 +0800
Subject: [PATCH] Cache xkbcomp output for fast start-up
xkbcomp outputs will be cached in files with hashed keymap as
names. This saves boot time for around 1s on commodity netbooks.
Signed-off-by: Yan Li <yan.i.li@intel.com>
---
xkb/ddxLoad.c | 188 +++++++++++++++++++++++++++++++++++++++++---------------
xkb/xkbfmisc.c | 18 +++++-
2 files changed, 153 insertions(+), 53 deletions(-)
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index 4d5dfb6..799622d 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -32,6 +32,12 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#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>
#define NEED_EVENTS 1
@@ -159,25 +165,61 @@ OutputDirectory(
size_t size)
{
#ifndef WIN32
- if (getuid() == 0 && (strlen(XKM_OUTPUT_DIR) < size))
- {
- /* if server running as root it *may* be able to write */
- /* FIXME: check whether directory is writable at all */
- (void) strcpy (outdir, XKM_OUTPUT_DIR);
+ if (getuid() == 0 && (strlen(XKM_OUTPUT_DIR) < size)) {
+ /* if server running as root it *may* be able to write */
+ /* FIXME: check whether directory is writable at all */
+ (void) strcpy (outdir, XKM_OUTPUT_DIR);
} else
#else
- if (strlen(Win32TempDir()) + 1 < size)
- {
- (void) strcpy(outdir, Win32TempDir());
- (void) strcat(outdir, "\\");
+ if (strlen(Win32TempDir()) + 1 < size) {
+ (void) strcpy(outdir, Win32TempDir());
+ (void) strcat(outdir, "\\");
} else
#endif
- if (strlen("/tmp/") < size)
- {
- (void) strcpy (outdir, "/tmp/");
+ if (strlen("/tmp/") < size) {
+ (void) strcpy (outdir, "/tmp/");
+ }
+}
+
+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,
@@ -187,7 +229,9 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
int nameRtrnLen)
{
FILE * out;
- char *buf = NULL, keymap[PATH_MAX], xkm_output_dir[PATH_MAX];
+ char * buf = NULL, xkmfile[PATH_MAX], xkmOutputDir[PATH_MAX];
+ char sha1Asc[SHA_DIGEST_LENGTH*2+1], xkbKeyMapBuf[1024];
+ int ret;
const char *emptystring = "";
const char *xkbbasedirflag = emptystring;
@@ -198,15 +242,58 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
/* 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
+ char * canonicalXkmfileName;
+
+ /* Write XKBKeyMap (xkbfile contents) to xkbKeyMapBuf, of which
+ SHA1 is generated as XKB file name */
+ memset(xkbKeyMapBuf, 0, sizeof(xkbKeyMapBuf));
+ out = fmemopen(xkbKeyMapBuf, sizeof(xkbKeyMapBuf), "w");
+ if (NULL == out) {
+ ErrorF("[xkb] open xkbKeyMapBuf for writting\n");
+ return False;
+ }
+ ret = XkbWriteXKBKeymapForNames(out, names, xkb, want, need);
+ fclose(out);
+ if (!ret) {
+ ErrorF("[xkb] generating XKB Keymap, giving up compiling Keymap\n");
+ return False;
+ }
+ 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, using display name instead\n");
+ snprintf(xkmfile, sizeof(xkmfile), "server-%s", display);
+ }
- snprintf(keymap, sizeof(keymap), "server-%s", display);
+ XkbEnsureSafeMapName(xkmfile);
+ OutputDirectory(xkmOutputDir, sizeof(xkmOutputDir));
+
+ /* 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 xkb file already exists, reuse it */
+ canonicalXkmfileName = Xprintf("%s%s.xkm", xkmOutputDir, xkmfile);
+ LogMessage(X_INFO, "[xkb] xkmfile %s ", canonicalXkmfileName);
+ if (access(canonicalXkmfileName, R_OK) == 0) {
+ /* yes, we can reuse old xkb file */
+ LogMessage(X_INFO, "reused\n");
+ xfree(canonicalXkmfileName);
+ return True;
+ }
+ LogMessage(X_INFO, "is being compiled\n");
+ xfree(canonicalXkmfileName);
- XkbEnsureSafeMapName(keymap);
- OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir));
+ /* continue to call xkbcomp to compile the keymap */
#ifdef WIN32
strcpy(tmpname, Win32TempDir());
@@ -215,19 +302,19 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
#endif
if (XkbBaseDirectory != NULL) {
- xkbbasedirflag = Xprintf("\"-R%s\"", XkbBaseDirectory);
+ xkbbasedirflag = Xprintf("\"-R%s\"", XkbBaseDirectory);
}
if (XkbBinDirectory != NULL) {
- int ld = strlen(XkbBinDirectory);
- int lps = strlen(PATHSEPARATOR);
+ int ld = strlen(XkbBinDirectory);
+ int lps = strlen(PATHSEPARATOR);
- xkbbindir = XkbBinDirectory;
+ xkbbindir = XkbBinDirectory;
- if ((ld >= lps) &&
- (strcmp(xkbbindir + ld - lps, PATHSEPARATOR) != 0)) {
- xkbbindirsep = PATHSEPARATOR;
- }
+ if ((ld >= lps) &&
+ (strcmp(xkbbindir + ld - lps, PATHSEPARATOR) != 0)) {
+ xkbbindirsep = PATHSEPARATOR;
+ }
}
buf = Xprintf("\"%s%sxkbcomp\" -w %d %s -xkm \"%s\" "
@@ -235,12 +322,12 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
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);
+ xkmOutputDir, xkmfile);
if (xkbbasedirflag != emptystring) {
- xfree(xkbbasedirflag);
+ xfree(xkbbasedirflag);
}
#ifndef WIN32
@@ -248,33 +335,34 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
#else
out= fopen(tmpname, "w");
#endif
-
+
if (out!=NULL) {
#ifdef DEBUG
- if (xkbDebugFlags) {
- ErrorF("[xkb] XkbDDXCompileKeymapByNames compiling keymap:\n");
- XkbWriteXKBKeymapForNames(stderr,names,xkb,want,need);
- }
+ if (xkbDebugFlags) {
+ ErrorF("[xkb] XkbDDXCompileKeymapByNames compiling keymap:\n");
+ XkbWriteXKBKeymapForNames(stderr,names,xkb,want,need);
+ }
#endif
- XkbWriteXKBKeymapForNames(out,names,xkb,want,need);
+ /* write XKBKeyMapBuf to xkbcomp */
+ if (EOF==fputs(xkbKeyMapBuf, out))
+ {
+ ErrorF("[xkb] sending keymap to xkbcomp\n");
+ return False;
+ }
#ifndef WIN32
- if (Pclose(out)==0)
+ if (Pclose(out)==0) {
#else
- if (fclose(out)==0 && System(buf) >= 0)
+ if (fclose(out)==0 && System(buf) >= 0) {
#endif
- {
if (xkbDebugFlags)
DebugF("[xkb] xkb executes: %s\n",buf);
- if (nameRtrn) {
- strncpy(nameRtrn,keymap,nameRtrnLen);
- nameRtrn[nameRtrnLen-1]= '\0';
- }
if (buf != NULL)
xfree (buf);
- return True;
- }
- else
- LogMessage(X_ERROR, "Error compiling keymap (%s)\n", keymap);
+ return True;
+ }
+ else
+ LogMessage(X_ERROR, "Error compiling keymap (%s)\n", xkbfile);
+
#ifdef WIN32
/* remove the temporary file */
unlink(tmpname);
@@ -282,13 +370,14 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
}
else {
#ifndef WIN32
- LogMessage(X_ERROR, "XKB: Could not invoke xkbcomp\n");
+ LogMessage(X_ERROR, "XKB: Could not invoke xkbcomp\n");
#else
- LogMessage(X_ERROR, "Could not open file %s\n", tmpname);
+ LogMessage(X_ERROR, "Could not open file %s\n", tmpname);
#endif
}
+
if (nameRtrn)
- nameRtrn[0]= '\0';
+ nameRtrn[0]= '\0';
if (buf != NULL)
xfree (buf);
return False;
@@ -375,7 +464,6 @@ unsigned missing;
DebugF("Loaded XKB keymap %s, defined=0x%x\n",fileName,(*xkbRtrn)->defined);
}
fclose(file);
- (void) unlink (fileName);
return (need|want)&(~missing);
}
diff --git a/xkb/xkbfmisc.c b/xkb/xkbfmisc.c
index ae752e9..5abf3c7 100644
--- a/xkb/xkbfmisc.c
+++ b/xkb/xkbfmisc.c
@@ -293,15 +293,27 @@ unsigned wantNames,wantConfig,wantDflts;
multi_section= 1;
if (((complete&XkmKeymapRequired)==XkmKeymapRequired)&&
((complete&(~XkmKeymapLegal))==0)) {
- fprintf(file,"xkb_keymap \"%s\" {\n",name);
+ if (fprintf(file,"xkb_keymap \"%s\" {\n",name) <= 0)
+ {
+ ErrorF("[xkb] writting XKB Keymap\n");
+ return False;
+ }
}
else if (((complete&XkmSemanticsRequired)==XkmSemanticsRequired)&&
((complete&(~XkmSemanticsLegal))==0)) {
- fprintf(file,"xkb_semantics \"%s\" {\n",name);
+ if (fprintf(file,"xkb_semantics \"%s\" {\n",name)<=0)
+ {
+ ErrorF("[xkb] writting XKB Keymap\n");
+ return False;
+ }
}
else if (((complete&XkmLayoutRequired)==XkmLayoutRequired)&&
((complete&(~XkmLayoutLegal))==0)) {
- fprintf(file,"xkb_layout \"%s\" {\n",name);
+ if (fprintf(file,"xkb_layout \"%s\" {\n",name)<=0)
+ {
+ ErrorF("[xkb] writting XKB Keymap\n");
+ return False;
+ }
}
else if (XkmSingleSection(complete&(~XkmVirtualModsMask))) {
multi_section= 0;
--
1.5.6.5

View File

@ -0,0 +1,277 @@
xkbcomp outputs will be cached in files with hashed keymap as
names. This saves boot time for around 1s on commodity netbooks.
Signed-off-by: Yan Li <yan.i.li@intel.com>
---
configure.ac | 6 +-
xkb/README.compiled | 8 ++--
xkb/ddxLoad.c | 141 +++++++++++++++++++++++++++++++++++++++-----------
3 files changed, 117 insertions(+), 38 deletions(-)
diff --git a/configure.ac b/configure.ac
index f2718b8..5d8a6e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -476,9 +476,9 @@ AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [
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(serverconfig-path, AS_HELP_STRING([--with-serverconfig-path=PATH],
[Directory where ancillary server config files are installed (default: ${libdir}/xorg)]),
[ SERVERCONFIG="$withval" ],
@@ -1753,7 +1753,7 @@ AC_DEFINE_DIR(XKB_BIN_DIRECTORY, bindir, [Path to XKB bin dir])
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
# XKM_OUTPUT_DIR (used in code) must end in / or file names get hosed
diff --git a/xkb/README.compiled b/xkb/README.compiled
index 71caa2f..a4a2ae0 100644
--- a/xkb/README.compiled
+++ b/xkb/README.compiled
@@ -4,10 +4,10 @@ current keymap and/or any scratch keymaps used by clients. The X server
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.
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index 4d5dfb6..8819353 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -32,6 +32,12 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#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>
#define NEED_EVENTS 1
@@ -52,18 +58,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#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\""
@@ -179,6 +173,45 @@ OutputDirectory(
}
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,
@@ -187,7 +220,10 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
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 * canonicalXkmfileName;
+ char sha1Asc[SHA_DIGEST_LENGTH*2+1], xkbKeyMapBuf[1024];
+ int ret;
const char *emptystring = "";
const char *xkbbasedirflag = emptystring;
@@ -198,16 +234,65 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
/* 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);
+ fclose(out);
+#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);
+ }
- XkbEnsureSafeMapName(keymap);
+ XkbEnsureSafeMapName(xkmfile);
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);
+ xfree(canonicalXkmfileName);
+ return True;
+ }
+ LogMessage(X_INFO, "XKB: generating xkmfile %s\n", canonicalXkmfileName);
+ xfree(canonicalXkmfileName);
+
+ /* continue to call xkbcomp to compile the keymap */
+
#ifdef WIN32
strcpy(tmpname, Win32TempDir());
strcat(tmpname, "\\xkb_XXXXXX");
@@ -235,9 +320,9 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
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);
+ xkm_output_dir, xkmfile);
if (xkbbasedirflag != emptystring) {
xfree(xkbbasedirflag);
@@ -250,13 +335,12 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
#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");
+ return False;
}
-#endif
- XkbWriteXKBKeymapForNames(out,names,xkb,want,need);
#ifndef WIN32
if (Pclose(out)==0)
#else
@@ -265,16 +349,12 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
{
if (xkbDebugFlags)
DebugF("[xkb] xkb executes: %s\n",buf);
- if (nameRtrn) {
- strncpy(nameRtrn,keymap,nameRtrnLen);
- nameRtrn[nameRtrnLen-1]= '\0';
- }
if (buf != NULL)
xfree (buf);
return True;
}
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);
@@ -375,7 +455,6 @@ unsigned missing;
DebugF("Loaded XKB keymap %s, defined=0x%x\n",fileName,(*xkbRtrn)->defined);
}
fclose(file);
- (void) unlink (fileName);
return (need|want)&(~missing);
}
-- 1.5.6.5
-- Li, Yan