LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   [Call for testing] ibus SlackBuild (https://www.linuxquestions.org/questions/slackware-14/%5Bcall-for-testing%5D-ibus-slackbuild-726528/)

grissiom 05-17-2009 02:32 AM

[Call for testing] ibus SlackBuild
 
1 Attachment(s)
Hello,

I have wrote a SlackBuild for ibus(http://code.google.com/p/ibus/) which may become the successor of scim. This script is port from scim.SlackBuild in the official source/x/scim folder. But I only have KDE4 environment and I don't use XFce or csh. So I put my script here to call for wider testings. Thanks in advance!~

Code:

#!/bin/sh

# Slackware build script for pycurl

# 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.1.0.20090508}
ARCH=${ARCH:-i486}
NUMJOBS=${NUMJOBS:-" -j3 "}
BUILD=${BUILD:-1}

if [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "s390" ]; then
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
elif [ "$ARCH" = "arm" ]; then
  SLKCFLAGS="-O2 -march=armv4 -mtune=xscale"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "armel" ]; then
  SLKCFLAGS="-O2 -march=armv4t"
  LIBDIRSUFFIX=""
fi

CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-$PRGNAM

rm -rf $PKG
mkdir -p $TMP $PKG

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} \
            --localstatedir=/var \
            --sysconfdir=/etc \
            --program-prefix= \
            --program-suffix= \
            --build=$ARCH-slackware-linux

make $NUMJOBS || make || exit 1
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

# 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 ^^.
#if [ ! \`ls /tmp/scim-socket*\` ]; then
#  /usr/bin/scim -d
#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
#chmod 755 $PKG/etc/profile.d/scim.csh.new

#mkdir -p $PKG/usr/share/applications
#cat $CWD/scim.desktop > $PKG/usr/share/applications/scim.desktop
#cat $CWD/scim-setup.desktop > $PKG/usr/share/applications/scim-setup.desktop

# 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/scim/config.new etc/scim/global.new etc/profile.d/scim.sh.new etc/profile.d/scim.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 "scim" 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 INSTALL 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 $TMP/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}.txz

ibus depend on GConf and pyxdg which both are available in slackbuilds.org . Actually ibus is only the engine, you may need ibus-pinyin for inputting Chinese or ibus-Anthy to inputting Japanese. But the SlackBuilds for them is quite easy. The attachment is the SlackBuilds for ibus-pinyin that I wrote. Have fun!

rworkman 05-18-2009 12:27 PM

As long as it depends on GConf, it won't be the successor to scim in Slackware.

grissiom 05-18-2009 07:24 PM

Quote:

Originally Posted by rworkman (Post 3544862)
As long as it depends on GConf, it won't be the successor to scim in Slackware.

Yes, I have to admit that this dependency made me headache... I hope the ibus dev could get rid of this in the future.(Someone is suggesting using KConfig which may available in Slackware) I will keep an eye for this. Thanks~;)

rworkman 05-18-2009 08:49 PM

What's wrong with a flat text config file?

lumak 05-18-2009 10:14 PM

Where did GNU get the idea that they can put a registry into their Gui. Honestly! there are standards for a reason. It's as if they don't want to be Linux... Ohhhh.... It's all so clear now....

rworkman 05-18-2009 10:51 PM

Grissiom,
Just in case it's not clear (I know that English isn't your native language), please don't interpret anything I say as a criticism of *your* effort. I'm glad you are looking at ibus -- catching stuff like the GConf dependency early in the development cycle might help efforts to eliminate it :-)

grissiom 05-19-2009 10:39 AM

Quote:

Originally Posted by rworkman (Post 3545314)
Grissiom,
Just in case it's not clear (I know that English isn't your native language), please don't interpret anything I say as a criticism of *your* effort.

No, I didn't ;-) I know as I' using Slackware, I'm standing on the shoulders of giants. I'd like to contribute something back. So any discussion is strongly welcome. Just as you said, English is not my native language, so if there is a word that make any of you confused, feel free to point it out. I will try my best to learn English as well :-)

Quote:

I'm glad you are looking at ibus -- catching stuff like the GConf dependency early in the development cycle might help efforts to eliminate it :-)
Yes, I will fire issues on the project's page or even mail the author if I have the passion someday. But it depends.


All times are GMT -5. The time now is 04:09 PM.