|
比较受不了 SCIM,于是折腾了一中午 ibus,终于整的差不多了…… SlackBuild 是根据官方里 scim 的改写而成,还需要很多的测试。比如我不用 csh, XFce, 就没有办法测试它在那些环境下的应用情况…… 所以我就把自己写的 SlackBuild 发上来供大家测试吧~ 欢迎提意见和补丁~;)
1.2 版和 1.1 版的依赖貌似是一样的,所以就干脆写了 1.2 的脚本~
- #!/bin/sh
- # Slackware build script for ibus
- # Written by Grissiom chaos.proton@gmail.com
- # If you want to use ibus as your primary input method, you'd better uninstall
- # scim package.
- # This SlackBuild is modified from Eric Hameleers's SlackBuild for scim. It has
- # not been finished porting but works for me. So more testing and debugging is
- # needed. If you see "SCIM" or commented out blocks in this script, that means
- # I don't know the corresponding part in ibus or I don't have the debugging
- # environment(e.g., I don't use csh and XFce).Feel free to mail me if you have
- # brilliant idea or suggestions.
- # Thanks in advance!
- PRGNAM=ibus
- VERSION=${VERSION:-1.2.0.20090828}
- ARCH=${ARCH:-i486}
- BUILD=${BUILD:-1}
- TAG=${TAG:-_SBo}
- if [ "$ARCH" = "i486" ]; then
- SLKCFLAGS="-O2 -march=i486 -mtune=i686"
- LIBDIRSUFFIX=""
- elif [ "$ARCH" = "x86_64" ]; then
- SLKCFLAGS="-O2 -fPIC"
- LIBDIRSUFFIX="64"
- fi
- CWD=$(pwd)
- TMP=${TMP:-/tmp/SBo}
- PKG=$TMP/package-$PRGNAM
- OUTPUT=${OUTPUT:-/tmp}
- rm -rf $PKG
- mkdir -p $TMP $PKG $OUTPUT
- cd $TMP
- rm -rf ${PRGNAM}-${VERSION}
- tar -xvf $CWD/${PRGNAM}-${VERSION}.tar.gz
- cd ${PRGNAM}-${VERSION} || exit 1
- 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} \
- --sysconfdir=/etc \
- --localstatedir=/var \
- --with-html-dir=/usr/doc/$PRGNAM-$VERSION \
- --program-prefix= \
- --program-suffix= \
- --build=$ARCH-slackware-linux
- make
- make DESTDIR=$PKG install || exit 1
- # Add a profile script that sets up the environment:
- mkdir -p $PKG/etc/profile.d
- cat <<EOT > $PKG/etc/profile.d/ibus.sh.new
- #!/bin/sh
- # ibus - Intelligent Input Bus for Linux / Unix OS. This is used to support the
- # entering of text in non-US-English languages.
- # For SCIM to work, you need to use a UTF-8 locale. Make sure it ends on
- # ".UTF-8", not "utf-8"! As an example, you would need to use en_US.UTF-8
- # for a US locale (export LANG=en_US.UTF-8), not en_US.
- #
- # The locale (LANG variable) is set in /etc/profile.d/lang.sh.
- if [ -x /usr/bin/ibus-daemon ]; then
- # Enable legacy X applications to use ibus:
- export XMODIFIERS="@im=ibus"
- # Enable Qt/KDE applications to use ibus. qt4 immodule hasn't finished
- # working yet, so Qt programs could only use ibus through xim. In this
- # manner, make sure you start ibus-daemon with --xim(or -x) option.
- export QT_IM_MODULE="xim"
- # Enable GTK applications to use ibus:
- export GTK_IM_MODULE="ibus"
- # Make ibus start automatically if the "magic key" Ctrl-Space is pressed:
- export XIM_PROGRAM="/usr/bin/ibus-daemon -xdrt"
- fi
- # GTK+ environments such as XFce should support SCIM automatically, BUT
- # if the first app you run is a Qt one, you'll run into problems. This
- # can be avoided by going into Menu -> Settings -> Autostarted Applications
- # and adding SCIM: /usr/bin/scim -d
- # KDE will not start ibus automatically, so you will need a script such as
- # this one in your $HOME/.kde/Autostart:
- #!/bin/bash
- #if [ -x /usr/bin/ibus-daemon]; then
- # /usr/bin/ibus-daemon -xdrt
- #fi
- # Obviously, uncomment all but the first line. :-)
- EOT
- #cat <<EOT > $PKG/etc/profile.d/scim.csh.new
- ##!/bin/csh
- #
- ## SCIM (Smart Common Input Method platform). This is used to support the
- ## entering of text in non-US-English languages.
- #
- ## For SCIM to work, you need to use a UTF-8 locale. Make sure it ends on
- ## ".UTF-8", not "utf-8"! As an example, you would need to use en_US.UTF-8
- ## for a US locale (setenv LANG en_US.UTF-8), not en_US.
- ##
- ## The locale (LANG variable) is set in /etc/profile.d/lang.csh.
- #
- #[ -x /usr/bin/scim ]
- #if (\$status == 0) then
- # # Enable legacy X applications to use scim:
- # setenv XMODIFIERS "@im=SCIM"
- # ## Enable Qt/KDE applications to use scim (does not work for kde4):
- # #setenv QT_IM_MODULE "scim"
- # # Make scim start automatically if the "magic key" Ctrl-Space is pressed:
- # setenv XIM_PROGRAM "/usr/bin/scim -d"
- #endif
- #
- #[ -x /usr/bin/scim-bridge ]
- #if (\$status == 0) then
- # # Let GTK applications like Firefox/Thunderbird use scim-bridge as
- # # default immodule:
- # setenv GTK_IM_MODULE "scim-bridge"
- # # Enable Qt4/KDE4 applications to use scim:
- # setenv QT_IM_MODULE "scim-bridge"
- #endif
- #
- ## This ensures scim starts when you logon.
- ## This will only work if you login through runlevel 4 (graphical login)!!!
- ## Better is to have it start through Ctrl-Space like configured higher up ^^.
- ##[ ! \`ls /tmp/scim-socket*\` ]
- ##if (\$status == 0) then
- ## /usr/bin/scim -d
- ##endif
- #
- ## GTK+ environments such as XFce should support SCIM automatically, BUT
- ## if the first app you run is a Qt one, you'll run into problems. This
- ## can be avoided by going into Menu -> Settings -> Autostarted Applications
- ## and adding SCIM: /usr/bin/scim -d
- #
- ## KDE will not start SCIM automatically, so you will need a script such as
- ## this one in your $HOME/.kde/Autostart:
- #
- ##!/bin/csh
- ##[ -x /usr/bin/scim ]
- ##if (\$status == 0) then
- ## /usr/bin/scim -d &
- ##endif
- #
- ## Obviously, uncomment all but the first line. :-)
- #
- #EOT
- chmod 755 $PKG/etc/profile.d/ibus.sh.new
- # Protect config files from being overwritten:
- #mv $PKG/etc/gconf/schemas/ibus.schemas{,.new}
- # Add this to the doinst.sh
- mkdir -p $PKG/install
- cat <<EOINS >> $PKG/install/doinst.sh
- # Handle the incoming configuration files:
- config() {
- for infile in \$1; do
- NEW="\$infile"
- 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...
- done
- }
- # Prepare the new configuration files
- for file in etc/profile.d/ibus.sh.new etc/profile.d/ibus.csh.new ; do
- if [ -e \$(dirname \$file)/\$(basename \$file .new) -a -x \$(dirname \$file)/\$(basename \$file .new) ]; then
- chmod 755 \$file
- else
- chmod 644 \$file
- fi
- config \$file
- done
- # Run gtk-query-immodules so that "ibus" will appear under Imput Method
- # when you right- click your mouse in a text box.
- if [ -x /usr/bin/update-gtk-immodules ]; then
- /usr/bin/update-gtk-immodules --verbose
- fi
- EOINS
- # Add documentation:
- cp -a \
- ABOUT-NLS AUTHORS COPYING ChangeLog NEWS README \
- $PKG/usr/doc/$PRGNAM-$VERSION
- # Strip binaries:
- find $PKG | xargs file | grep -e "executable" -e "shared object" \
- | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
- # Add a package description:
- mkdir -p $PKG/install
- cat $CWD/slack-desc > $PKG/install/slack-desc
- # Build the package:
- cd $PKG
- /sbin/makepkg --prepend --linkadd y --chown n $OUTPUT/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}.${PKGTYPE:-tgz}
复制代码
依赖:GConf, pyxdg, 这两个都能从 SBo 里找到~ 再有,ibus 只是输入法引擎,不带词库,不过词库的打包脚本很好写。附件是拼音的 SlackBuild~
1.2 版的有 ibus-qt 这个 qt-immodule,比较适合在 qt4 环境下使用,这个是 SlackBuild:
- #!/bin/sh
- # Slackware build script for ibus-qt
- # Written by Grissiom <chaos.proton@gmail.com>
- PRGNAM=ibus-qt
- VERSION=${VERSION:-1.2.0.20090822}
- ARCH=${ARCH:-i486}
- BUILD=${BUILD:-1}
- TAG=${TAG:-_SBo}
- 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"
- fi
- set -e
- rm -rf $PKG
- mkdir -p $TMP $PKG $OUTPUT
- cd $TMP
- rm -rf $PRGNAM-$VERSION-Source
- # how could the tarball have a "Source" suffix?...
- tar xvf $CWD/$PRGNAM-$VERSION-Source.tar.gz
- cd $PRGNAM-$VERSION-Source
- 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 {} \;
- mkdir build
- cd build
- cmake -DCMAKE_CXXFLAGS="$SLKCFLAGS" \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DCMAKE_BUILD_TYPE=Release \
- -DLIBDIR=lib${LIBDIRSUFFIX} \
- -DDOCDIR=/usr/doc/$PRGNAM-$VERSION \
- ..
- make
- make install DESTDIR=$PKG
- ( cd $PKG
- find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \
- xargs strip --strip-unneeded 2> /dev/null || true
- find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \
- xargs strip --strip-unneeded 2> /dev/null
- )
- cd -
- cp -a \
- COPYING \
- $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}
复制代码
不过这个依赖 icu4c ……(ibus 怎么这么多依赖呢?……)
欢迎提意见~ |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|