|
楼主 |
发表于 2003-5-29 16:18:14
|
显示全部楼层
fcitx-1.8.5-ppc.patch 暂时测试没有发现问题
diff -Naur fcitx-1.8.5.orig/Makefile.ppc fcitx-1.8.5/Makefile.ppc
--- fcitx-1.8.5.orig/Makefile.ppc 1970-01-01 08:00:00.000000000 +0800
+++ fcitx-1.8.5/Makefile.ppc 2003-05-28 21:34:32.000000000 +0800
@@ -0,0 +1,64 @@
+CC = gcc
+
+CFLAGS= -O2 -fno-strength-reduce -DPOWERPC
+
+INC = -I/usr/X11R6/include -I.
+
+SRC = main.c ime.c KeyList.c AddPhraseWindow.c IC.c InputWindow.c MainWindow.c MyErrorsHandlers.c punc.c py.c PYFA.c pyParser.c pyMapTable.c SetLocale.c tools.c wbx.c window.c xim.c qw.c sp.c py-2.c
+
+LIB = -L/usr/X11R6/lib -lX11
+
+OBJ = $(SRC:.c=.o)
+
+all: libXimd.a fcitx
+
+fcitx: $(OBJ) IMdkit/lib/libXimd.a
+ $(CC) $(CFLAGS) $(LIB) $(OBJ) IMdkit/lib/libXimd.a -o fcitx
+
+libXimd.a:
+ cd IMdkit/lib; make
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INC) $<
+
+clean:
+ rm -f *.o fcitx fcitx.noxft
+ cd IMdkit/lib; make clean
+
+install:
+ mkdir -p /usr/share/fcitx
+ install -s fcitx /usr/bin
+ cp -f data/punc.mb /usr/share/fcitx/
+ cp -f data/wbx.mb /usr/share/fcitx/
+ cp -f data/pybase.mb /usr/share/fcitx/
+ cp -f data/pyphrase.mb /usr/share/fcitx/
+ cp -f data/pySym.mb /usr/share/fcitx/
+ cp -f data/sp.dat /usr/share/fcitx/
+# cp -f -r fonts /usr/share/fcitx
+
+install_local:
+ strip fcitx
+ mkdir -p ${HOME}/fcitx/
+ cp -f fcitx ${HOME}/fcitx/
+ cp -f data/punc.mb ${HOME}/fcitx/
+ cp -f data/wbx.mb ${HOME}/fcitx/
+ cp -f data/pybase.mb ${HOME}/fcitx/
+ cp -f data/pyphrase.mb ${HOME}/fcitx/
+ cp -f data/pySym.mb ${HOME}/fcitx/
+ cp -f data/sp.dat ${HOME}/fcitx/
+# cp -f -r fonts ${HOME}/fcitx/
+ mkdir -p ${HOME}/bin/
+ ln -sf ${HOME}/fcitx/fcitx ${HOME}/bin/
+# echo "#!/bin/sh" > ${HOME}/bin/fcitx
+# echo "xset +fp ${HOME}/fcitx/fonts" >> ${HOME}/bin/fcitx
+# echo "${HOME}/fcitx/fcitx -local">>${HOME}/bin/fcitx
+# chmod 755 ${HOME}/bin/fcitx
+
+uninstall:
+ rm -f /usr/bin/fcitx
+ rm -fr /usr/share/fcitx
+
+uninstall_local:
+ rm -f ${HOME}/bin/fcitx
+ rm -fr ${HOME}/fcitx
+
diff -Naur fcitx-1.8.5.orig/Makefile.xft.ppc fcitx-1.8.5/Makefile.xft.ppc
--- fcitx-1.8.5.orig/Makefile.xft.ppc 1970-01-01 08:00:00.000000000 +0800
+++ fcitx-1.8.5/Makefile.xft.ppc 2003-05-28 21:34:49.000000000 +0800
@@ -0,0 +1,56 @@
+CC = gcc
+
+CFLAGS= -O2 -fno-strength-reduce -D_USE_XFT -DPOWERPC
+
+INC = -I/usr/X11R6/include `xft-config --cflags`
+
+SRC = main.c ime.c KeyList.c AddPhraseWindow.c IC.c InputWindow.c MainWindow.c MyErrorsHandlers.c punc.c py.c PYFA.c pyParser.c pyMapTable.c SetLocale.c tools.c wbx.c window.c xim.c qw.c sp.c py-2.c
+
+LIB = -L/usr/X11R6/lib -lX11 `xft-config --libs`
+
+OBJ = $(SRC:.c=.o)
+
+all: libXimd.a fcitx
+
+fcitx: $(OBJ) IMdkit/lib/libXimd.a
+ $(CC) $(CFLAGS) $(LIB) $(OBJ) IMdkit/lib/libXimd.a -o fcitx
+
+libXimd.a:
+ cd IMdkit/lib; make
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INC) $<
+
+clean:
+ rm -f *.o fcitx fcitx.noxft
+ cd IMdkit/lib; make clean
+
+install:
+ mkdir -p /usr/share/fcitx
+ install -s fcitx /usr/bin/
+ cp -f data/punc.mb /usr/share/fcitx/
+ cp -f data/wbx.mb /usr/share/fcitx/
+ cp -f data/pybase.mb /usr/share/fcitx/
+ cp -f data/pyphrase.mb /usr/share/fcitx/
+ cp -f data/pySym.mb /usr/share/fcitx/
+ cp -f data/sp.dat /usr/share/fcitx/
+install_local:
+ mkdir -p ${HOME}/fcitx/
+ install -s fcitx ${HOME}/fcitx/
+ cp -f data/punc.mb ${HOME}/fcitx/
+ cp -f data/wbx.mb ${HOME}/fcitx/
+ cp -f data/pybase.mb ${HOME}/fcitx/
+ cp -f data/pyphrase.mb ${HOME}/fcitx/
+ cp -f data/pySym.mb ${HOME}/fcitx/
+ cp -f data/sp.dat ${HOME}/fcitx/
+ mkdir -p ${HOME}/bin/
+ echo "#!/bin/sh" > ${HOME}/bin/fcitx
+ echo "${HOME}/fcitx/fcitx -local">>${HOME}/bin/fcitx
+ chmod 755 ${HOME}/bin/fcitx
+uninstall:
+ rm -f /usr/bin/fcitx
+ rm -fr /usr/share/fcitx
+uninstall_local:
+ rm -f ${HOME}/bin/fcitx
+ rm -fr ${HOME}/fcitx
+
diff -Naur fcitx-1.8.5.orig/py.c fcitx-1.8.5/py.c
--- fcitx-1.8.5.orig/py.c 2003-05-28 21:42:17.000000000 +0800
+++ fcitx-1.8.5/py.c 2003-05-28 21:39:46.000000000 +0800
@@ -65,6 +65,19 @@
extern Bool bIsGB2312;
#endif
+#ifdef POWERPC
+static void fix_mb_endian_int(int *);
+
+static void fix_mb_endian_int(int *mb)
+{
+ unsigned char *p;
+ int i = 0;
+ p = (unsigned char *)mb;
+ i = (p[3]<<24)|(p[2]<<16)|(p[1]<<8)|p[0];
+ *mb = i;
+}
+#endif
+
Bool LoadPYDict (void)
{
FILE *fp;
@@ -88,7 +101,12 @@
return FILE_NOT_FOUND;
fread (&iPYFACount, sizeof (int), 1, fp);
- PYFAList = (PYFA *) malloc (sizeof (PYFA) * iPYFACount);
+
+#ifdef POWERPC
+ fix_mb_endian_int(&iPYFACount);
+#endif
+
+ PYFAList = (PYFA *) malloc (sizeof (PYFA) * iPYFACount);
if (!PYFAList)
return CANNOT_ALLOC_MEMORY;
@@ -96,11 +114,21 @@
fread (PYFAList.strMap, sizeof (char) * 2, 1, fp);
PYFAList.strMap[2] = '\0';
fread (&(PYFAList.iBase), sizeof (int), 1, fp);
+
+#ifdef POWERPC
+ fix_mb_endian_int(&(PYFAList.iBase));
+#endif
+
PYFAList.pyBase = (PyBase *) malloc (sizeof (PyBase) * PYFAList.iBase);
for (j = 0; j < PYFAList.iBase; j++) {
fread (PYFAList.pyBase[j].strHZ, sizeof (char) * 2, 1, fp);
PYFAList.pyBase[j].strHZ[2] = '\0';
fread (&iLen, sizeof (int), 1, fp);
+
+#ifdef POWERPC
+ fix_mb_endian_int(&iLen);
+#endif
+
PYFAList.pyBase[j].iIndex = iLen;
PYFAList.pyBase[j].iHit = 0;
if (iLen > iCounter)
@@ -130,12 +158,26 @@
while (!feof (fp)) {
if (!fread (&i, sizeof (int), 1, fp))
break;
+
+#ifdef POWERPC
+ fix_mb_endian_int(&i);
+#endif
+
if (!fread (strBase, sizeof (char) * 2, 1, fp))
break;
strBase[2] = '\0';
+
+#ifdef POWERPC
+ fix_mb_endian_int(&k);
+#endif
+
if (!fread (&k, sizeof (int), 1, fp))
break;
+#ifdef POWERPC
+ fix_mb_endian_int(&iLen);
+#endif
+
j = GetBaseIndex (i, strBase);
PYFAList.pyBase[j].iPhrase = k;
[zhanh@ibook fcitx]$ cat fcitx-1.8.5-ppc.patch
diff -Naur fcitx-1.8.5.orig/Makefile.ppc fcitx-1.8.5/Makefile.ppc
--- fcitx-1.8.5.orig/Makefile.ppc 1970-01-01 08:00:00.000000000 +0800
+++ fcitx-1.8.5/Makefile.ppc 2003-05-28 21:59:25.000000000 +0800
@@ -0,0 +1,64 @@
+CC = gcc
+
+CFLAGS= -O2 -fno-strength-reduce -DPOWERPC
+
+INC = -I/usr/X11R6/include -I.
+
+SRC = main.c ime.c KeyList.c AddPhraseWindow.c IC.c InputWindow.c MainWindow.c MyErrorsHandlers.c punc.c py.c PYFA.c pyParser.c pyMapTable.c SetLocale.c tools.c wbx.c window.c xim.c qw.c sp.c py-2.c
+
+LIB = -L/usr/X11R6/lib -lX11
+
+OBJ = $(SRC:.c=.o)
+
+all: libXimd.a fcitx
+
+fcitx: $(OBJ) IMdkit/lib/libXimd.a
+ $(CC) $(CFLAGS) $(LIB) $(OBJ) IMdkit/lib/libXimd.a -o fcitx
+
+libXimd.a:
+ cd IMdkit/lib; make
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INC) $<
+
+clean:
+ rm -f *.o fcitx fcitx.noxft
+ cd IMdkit/lib; make clean
+
+install:
+ mkdir -p /usr/share/fcitx
+ install -s fcitx /usr/bin
+ cp -f data/punc.mb /usr/share/fcitx/
+ cp -f data/wbx.mb /usr/share/fcitx/
+ cp -f data/pybase.mb /usr/share/fcitx/
+ cp -f data/pyphrase.mb /usr/share/fcitx/
+ cp -f data/pySym.mb /usr/share/fcitx/
+ cp -f data/sp.dat /usr/share/fcitx/
+# cp -f -r fonts /usr/share/fcitx
+
+install_local:
+ strip fcitx
+ mkdir -p ${HOME}/fcitx/
+ cp -f fcitx ${HOME}/fcitx/
+ cp -f data/punc.mb ${HOME}/fcitx/
+ cp -f data/wbx.mb ${HOME}/fcitx/
+ cp -f data/pybase.mb ${HOME}/fcitx/
+ cp -f data/pyphrase.mb ${HOME}/fcitx/
+ cp -f data/pySym.mb ${HOME}/fcitx/
+ cp -f data/sp.dat ${HOME}/fcitx/
+# cp -f -r fonts ${HOME}/fcitx/
+ mkdir -p ${HOME}/bin/
+ ln -sf ${HOME}/fcitx/fcitx ${HOME}/bin/
+# echo "#!/bin/sh" > ${HOME}/bin/fcitx
+# echo "xset +fp ${HOME}/fcitx/fonts" >> ${HOME}/bin/fcitx
+# echo "${HOME}/fcitx/fcitx -local">>${HOME}/bin/fcitx
+# chmod 755 ${HOME}/bin/fcitx
+
+uninstall:
+ rm -f /usr/bin/fcitx
+ rm -fr /usr/share/fcitx
+
+uninstall_local:
+ rm -f ${HOME}/bin/fcitx
+ rm -fr ${HOME}/fcitx
+
diff -Naur fcitx-1.8.5.orig/Makefile.xft.ppc fcitx-1.8.5/Makefile.xft.ppc
--- fcitx-1.8.5.orig/Makefile.xft.ppc 1970-01-01 08:00:00.000000000 +0800
+++ fcitx-1.8.5/Makefile.xft.ppc 2003-05-28 21:59:25.000000000 +0800
@@ -0,0 +1,56 @@
+CC = gcc
+
+CFLAGS= -O2 -fno-strength-reduce -D_USE_XFT -DPOWERPC
+
+INC = -I/usr/X11R6/include `xft-config --cflags`
+
+SRC = main.c ime.c KeyList.c AddPhraseWindow.c IC.c InputWindow.c MainWindow.c MyErrorsHandlers.c punc.c py.c PYFA.c pyParser.c pyMapTable.c SetLocale.c tools.c wbx.c window.c xim.c qw.c sp.c py-2.c
+
+LIB = -L/usr/X11R6/lib -lX11 `xft-config --libs`
+
+OBJ = $(SRC:.c=.o)
+
+all: libXimd.a fcitx
+
+fcitx: $(OBJ) IMdkit/lib/libXimd.a
+ $(CC) $(CFLAGS) $(LIB) $(OBJ) IMdkit/lib/libXimd.a -o fcitx
+
+libXimd.a:
+ cd IMdkit/lib; make
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INC) $<
+
+clean:
+ rm -f *.o fcitx fcitx.noxft
+ cd IMdkit/lib; make clean
+
+install:
+ mkdir -p /usr/share/fcitx
+ install -s fcitx /usr/bin/
+ cp -f data/punc.mb /usr/share/fcitx/
+ cp -f data/wbx.mb /usr/share/fcitx/
+ cp -f data/pybase.mb /usr/share/fcitx/
+ cp -f data/pyphrase.mb /usr/share/fcitx/
+ cp -f data/pySym.mb /usr/share/fcitx/
+ cp -f data/sp.dat /usr/share/fcitx/
+install_local:
+ mkdir -p ${HOME}/fcitx/
+ install -s fcitx ${HOME}/fcitx/
+ cp -f data/punc.mb ${HOME}/fcitx/
+ cp -f data/wbx.mb ${HOME}/fcitx/
+ cp -f data/pybase.mb ${HOME}/fcitx/
+ cp -f data/pyphrase.mb ${HOME}/fcitx/
+ cp -f data/pySym.mb ${HOME}/fcitx/
+ cp -f data/sp.dat ${HOME}/fcitx/
+ mkdir -p ${HOME}/bin/
+ echo "#!/bin/sh" > ${HOME}/bin/fcitx
+ echo "${HOME}/fcitx/fcitx -local">>${HOME}/bin/fcitx
+ chmod 755 ${HOME}/bin/fcitx
+uninstall:
+ rm -f /usr/bin/fcitx
+ rm -fr /usr/share/fcitx
+uninstall_local:
+ rm -f ${HOME}/bin/fcitx
+ rm -fr ${HOME}/fcitx
+
diff -Naur fcitx-1.8.5.orig/py.c fcitx-1.8.5/py.c
--- fcitx-1.8.5.orig/py.c 2003-05-28 21:42:17.000000000 +0800
+++ fcitx-1.8.5/py.c 2003-05-28 22:03:02.000000000 +0800
@@ -65,6 +65,19 @@
extern Bool bIsGB2312;
#endif
+#ifdef POWERPC
+static void fix_mb_endian_int(int *);
+
+static void fix_mb_endian_int(int *mb)
+{
+ unsigned char *p;
+ int i = 0;
+ p = (unsigned char *)mb;
+ i = (p[3]<<24)|(p[2]<<16)|(p[1]<<8)|p[0];
+ *mb = i;
+}
+#endif
+
Bool LoadPYDict (void)
{
FILE *fp;
@@ -88,7 +101,12 @@
return FILE_NOT_FOUND;
fread (&iPYFACount, sizeof (int), 1, fp);
- PYFAList = (PYFA *) malloc (sizeof (PYFA) * iPYFACount);
+
+#ifdef POWERPC
+ fix_mb_endian_int(&iPYFACount);
+#endif
+
+ PYFAList = (PYFA *) malloc (sizeof (PYFA) * iPYFACount);
if (!PYFAList)
return CANNOT_ALLOC_MEMORY;
@@ -96,11 +114,21 @@
fread (PYFAList.strMap, sizeof (char) * 2, 1, fp);
PYFAList.strMap[2] = '\0';
fread (&(PYFAList.iBase), sizeof (int), 1, fp);
+
+#ifdef POWERPC
+ fix_mb_endian_int(&(PYFAList.iBase));
+#endif
+
PYFAList.pyBase = (PyBase *) malloc (sizeof (PyBase) * PYFAList.iBase);
for (j = 0; j < PYFAList.iBase; j++) {
fread (PYFAList.pyBase[j].strHZ, sizeof (char) * 2, 1, fp);
PYFAList.pyBase[j].strHZ[2] = '\0';
fread (&iLen, sizeof (int), 1, fp);
+
+#ifdef POWERPC
+ fix_mb_endian_int(&iLen);
+#endif
+
PYFAList.pyBase[j].iIndex = iLen;
PYFAList.pyBase[j].iHit = 0;
if (iLen > iCounter)
@@ -130,12 +158,21 @@
while (!feof (fp)) {
if (!fread (&i, sizeof (int), 1, fp))
break;
+
+#ifdef POWERPC
+ fix_mb_endian_int(&i);
+#endif
+
if (!fread (strBase, sizeof (char) * 2, 1, fp))
break;
strBase[2] = '\0';
if (!fread (&k, sizeof (int), 1, fp))
break;
+#ifdef POWERPC
+ fix_mb_endian_int(&k);
+#endif
+
j = GetBaseIndex (i, strBase);
PYFAList.pyBase[j].iPhrase = k;
@@ -143,6 +180,11 @@
for (k = 0; k < PYFAList.pyBase[j].iPhrase; k++) {
fread (&iLen, sizeof (int), 1, fp);
+
+#ifdef POWERPC
+ fix_mb_endian_int(&iLen);
+#endif
+
PYFAList.pyBase[j].phrase[k].strMap = (char *) malloc (sizeof (char) * (iLen + 1));
if (!PYFAList.pyBase[j].phrase[k].strMap) |
|