misc/sunpinyin: Added (Chinese input method)

Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
This commit is contained in:
Grissiom 2010-06-27 16:01:15 -05:00 committed by Erik Hanson
parent 842ea71a3a
commit f06623ea51
7 changed files with 209 additions and 0 deletions

15
misc/sunpinyin/README Normal file
View file

@ -0,0 +1,15 @@
SunPinyin is a statistical language model based Chinese input method, which was
firstly developed by Sun Beijing Globalization team.
Just like fcitx, you can build it into a stand alone XIM program. If you do not
want the XIM sunpinyin, set EN_XIM=no (EN_XIM=no sh ./sunpinyin.SlackBuild).
This SlackBuild will build the XIM program by default. If building XIM program,
this package will have /etc/profile.d/sunpinyin.{csh,sh} to setup the envs. Set
them to be executable if you want them take effect or vice versa.
Also, this package have a wrapper called ibus-sunpinyin which enables user to
use SunPinyin with IBus framework. You can build it with EN_IBUS=y. If you want
to use this wrapper, make sure you have ibus installed before building.
If you disable both IBus wrapper and XIM program, this package will end up with
"useless" stuffs such as docs and translations. Take care ;)

26
misc/sunpinyin/doinst.sh Normal file
View file

@ -0,0 +1,26 @@
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
# toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
preserve_perms() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
if [ -e $OLD ]; then
cp -a $OLD ${NEW}.incoming
cat $NEW > ${NEW}.incoming
mv ${NEW}.incoming $NEW
fi
config $NEW
}
preserve_perms etc/profile.d/sunpinyin.csh.new
preserve_perms etc/profile.d/sunpinyin.sh.new

View file

@ -0,0 +1,17 @@
#!/bin/csh
# SunPinyin is a statistical language model based Chinese input method, which
# was firstly developed by Sun Beijing Globalization team.
[ -x /usr/bin/xsunpinyin ]
if ($status == 0) then
# Enable legacy X applications to use sunpinyin:
setenv XMODIFIERS="@im=xsunpinyin"
# Enable Qt/KDE applications to use sunpinyin.
setenv QT_IM_MODULE="XIM"
# Enable GTK applications to use sunpinyin:
setenv GTK_IM_MODULE="XIM"
# Make sunpinyin start automatically if the "magic key" Ctrl-Space is pressed:
setenv XIM_PROGRAM="/usr/bin/xsunpinyin -d"
endif

View file

@ -0,0 +1,16 @@
#!/bin/sh
# SunPinyin is a statistical language model based Chinese input method, which
# was firstly developed by Sun Beijing Globalization team.
if [ -x /usr/bin/xsunpinyin ]; then
# Enable legacy X applications to use sunpinyin:
export XMODIFIERS="@im=xsunpinyin"
# Enable Qt/KDE applications to use sunpinyin.
export QT_IM_MODULE=XIM
# Enable GTK applications to use sunpinyin:
export GTK_IM_MODULE=XIM
# Make sunpinyin start automatically if the "magic key" Ctrl-Space is pressed:
export XIM_PROGRAM="/usr/bin/xsunpinyin -d"
fi

19
misc/sunpinyin/slack-desc Normal file
View file

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
sunpinyin: SunPinyin
sunpinyin:
sunpinyin: SunPinyin is a statistical language model based Chinese input method,
sunpinyin: which was firstly developed by Sun Beijing Globalization team.
sunpinyin:
sunpinyin: Homepage: http://code.google.com/p/sunpinyin/
sunpinyin:
sunpinyin:
sunpinyin:
sunpinyin:
sunpinyin:

View file

@ -0,0 +1,106 @@
#!/bin/sh
# Slackware build script for sunpinyin
# Written by Grissiom <chaos.proton@gmail.com>
PRGNAM=sunpinyin
VERSION=${VERSION:-2.0.1}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
arm*) ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
EN_XIM=${EN_XIM:-'y'}
EN_IBUS=${EN_IBUS:-'no'}
#EN_SCIM=${EN_SCIM:-'y'} # SCIM is an unfinished port.
#if [ "$EN_SCIM" != 'no' ]; then
# EXTRA_ARG=$EXTRA_ARG' --enable-scim '
#fi
if [ "$EN_IBUS" != 'no' ]; then
EXTRA_ARG=$EXTRA_ARG' --enable-ibus '
fi
if [ "$EN_XIM" != 'no' ]; then
EXTRA_ARG=$EXTRA_ARG' --enable-xim '
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-2.0
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-2.0
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--localstatedir=/var \
--disable-static \
--build=$ARCH-slackware-linux \
$EXTRA_ARG
make
make install DESTDIR=$PKG
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
if [ "$EN_XIM" != 'no' ]; then
# Add profile scripts that set up the environment:
mkdir -p $PKG/etc/profile.d
cat $CWD/profile.d/sunpinyin.csh > $PKG/etc/profile.d/sunpinyin.csh.new
cat $CWD/profile.d/sunpinyin.sh > $PKG/etc/profile.d/sunpinyin.sh.new
chmod 0755 $PKG/etc/profile.d/*
# need doinst.sh to handle .new files.
mkdir -p $PKG/install
cat $CWD/doinst.sh > $PKG/install/doinst.sh
fi
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a \
AUTHORS ChangeLog COPYING *LICENSE NEWS README TODO \
$PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

View file

@ -0,0 +1,10 @@
PRGNAM="sunpinyin"
VERSION="2.0.1"
HOMEPAGE="http://code.google.com/p/sunpinyin/"
DOWNLOAD="http://sunpinyin.googlecode.com/files/sunpinyin-2.0.1.tar.gz"
MD5SUM="4f2888c8a34b49cc9b85d6b0014940b0"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
MAINTAINER="Grissiom"
EMAIL="chaos.proton@gmail.com"
APPROVED="rworkman"