summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrissiom <chaos.proton@gmail.com>2010-06-27 16:01:15 -0500
committerErik Hanson <erik@slackbuilds.org>2010-06-29 00:36:35 -0500
commitf06623ea51f1b733a06797527bd2a15ae7d57265 (patch)
tree71b6a56ba82540ec1ebfee108d36b704cdbb6f10
parent842ea71a3ad91c062324acbf7ffeeaf0ee372d0a (diff)
downloadslackbuilds-f06623ea51f1b733a06797527bd2a15ae7d57265.tar.gz
misc/sunpinyin: Added (Chinese input method)
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
-rw-r--r--misc/sunpinyin/README15
-rw-r--r--misc/sunpinyin/doinst.sh26
-rw-r--r--misc/sunpinyin/profile.d/sunpinyin.csh17
-rw-r--r--misc/sunpinyin/profile.d/sunpinyin.sh16
-rw-r--r--misc/sunpinyin/slack-desc19
-rw-r--r--misc/sunpinyin/sunpinyin.SlackBuild106
-rw-r--r--misc/sunpinyin/sunpinyin.info10
7 files changed, 209 insertions, 0 deletions
diff --git a/misc/sunpinyin/README b/misc/sunpinyin/README
new file mode 100644
index 0000000000..aa918c4e1d
--- /dev/null
+++ b/misc/sunpinyin/README
@@ -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 ;)
diff --git a/misc/sunpinyin/doinst.sh b/misc/sunpinyin/doinst.sh
new file mode 100644
index 0000000000..f6ed560b31
--- /dev/null
+++ b/misc/sunpinyin/doinst.sh
@@ -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
diff --git a/misc/sunpinyin/profile.d/sunpinyin.csh b/misc/sunpinyin/profile.d/sunpinyin.csh
new file mode 100644
index 0000000000..26db802153
--- /dev/null
+++ b/misc/sunpinyin/profile.d/sunpinyin.csh
@@ -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
+
diff --git a/misc/sunpinyin/profile.d/sunpinyin.sh b/misc/sunpinyin/profile.d/sunpinyin.sh
new file mode 100644
index 0000000000..a53367bbef
--- /dev/null
+++ b/misc/sunpinyin/profile.d/sunpinyin.sh
@@ -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
+
diff --git a/misc/sunpinyin/slack-desc b/misc/sunpinyin/slack-desc
new file mode 100644
index 0000000000..95eb085a77
--- /dev/null
+++ b/misc/sunpinyin/slack-desc
@@ -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:
diff --git a/misc/sunpinyin/sunpinyin.SlackBuild b/misc/sunpinyin/sunpinyin.SlackBuild
new file mode 100644
index 0000000000..810a4deefa
--- /dev/null
+++ b/misc/sunpinyin/sunpinyin.SlackBuild
@@ -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}
diff --git a/misc/sunpinyin/sunpinyin.info b/misc/sunpinyin/sunpinyin.info
new file mode 100644
index 0000000000..5a01e1fac6
--- /dev/null
+++ b/misc/sunpinyin/sunpinyin.info
@@ -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"