dragora-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dragora-bug] [Fwd: [DRAGORA] Chinese support - Xiaoy]


From: Matias A. Fonzo
Subject: [Dragora-bug] [Fwd: [DRAGORA] Chinese support - Xiaoy]
Date: Sat, 19 Nov 2011 15:46:02 -0200
User-agent: SquirrelMail/1.4.19

---------------------------- Mensaje original ----------------------------
Asunto: [DRAGORA] Chinese support - Xiaoy
De:     "stragapede peppe" <address@hidden>
Fecha:  Sab, 19 de Noviembre de 2011, 9:42 am
Para:   address@hidden
--------------------------------------------------------------------------

So, finally i decided to write a little tutorial on how to make chinese
language support available on Dragora.

Let's start from how to setup runlevel 3. First of all we need to install a
chinese input method (fonts are optional) and then setup the environments
variables:

1) Get latest Fcitx chinese input method source tarball from
http://www.fcitx.org/download/ (at the time of this tutorial last version
is 3.6.3, but you can modify the scripts to fit newer versions), create a
directory in you home called fcitx, create a file inside ti called
fcitx-build and paste inside the file the content below, then chmod +x the
build file (make sure the build file is in the same directory of the
source) and execute the build ex: sudo ./fcitx-build. When finished install
the package with the command: # pkg add fcitx-[version number]-i486-1.tlz

#!/bin/bash
#  Copyright (C) 2011  Matias A. Fonzo, <address@hidden>
#
#  This program is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.

set -e

CWD=$(pwd)

TMP=${TMP:-/tmp/sources}
OUT=${OUT:-/tmp/packages}

P=fcitx
V=${V:-3.6.3}
ARCH=${ARCH:-i486}
B=${B:-1}

# Flags for the compiler:
DCFLAGS=${DCFLAGS:=-O2 -march=i486 -mtune=i686}

# Parallel jobs for the compiler:
JOBS=${JOBS:=-j4}

PKG=${TMP}/package-${P}

rm -rf $PKG
mkdir -p $PKG $OUT

rm -rf ${TMP}/${P}-${V}
echo "Uncompressing the tarball..."
tar -jxvf ${CWD}/${P}-${V}.tar.bz2 -C $TMP

cd ${TMP}/${P}-${V}

# Set sane ownerships and permissions:
chown -R 0:0 .
find . \
 \( -perm 2777 -o -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="$DCFLAGS" \
CXXFLAGS="$DCFLAGS" \
./configure \
 --prefix=/usr \
 --sysconfdir=/etc \
 --infodir=/usr/info \
 --mandir=/usr/man \
 --localstatedir=/var \
 --disable-static \
 --enable-shared \
 --program-prefix="" \
 --program-suffix="" \
 --enable-gtk \
 --enable-utp \
 --enable-libnotify \
 --enable-libcanberra \
 --enable-cli \
 --enable-daemon \
 --with-inotify \
 --build=${ARCH}-dragora-linux-gnu

make $JOBS V=1 || make;
make install DESTDIR=$PKG

# Compress .info page(s)?:
if [[ -d ${PKG}/usr/info ]]; then
  ( cd ${PKG}/usr/info
    rm -f dir  # Redundancy.
    gzip -9N *.info*
  )
fi

# Compress and link .man page(s)?:
if [[ -d ${PKG}/usr/man ]]; then
  ( cd ${PKG}/usr/man
    find . -type f -exec gzip -9N '{}' +
    find . -type l | while read file ; do
      ln -sf $(readlink $file).gz ${file}.gz
      rm $file
    done
  )
fi

# Copy the documentation:
mkdir -p ${PKG}/usr/doc/${P}-${V}
cp -a \
 AUTHORS COPYING ChangeLog NEWS README \
 ${PKG}/usr/doc/${P}-${V}

cd $PKG

# Strip binaries & libraries:
find . -type f | xargs file | awk '/ELF/ && /executable/ || /shared
object/' | \
 cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || :

# Copy the description files:
mkdir -p description install
cp ${CWD}/description/?? description/
zcat ${CWD}/post-install.gz > install/post-install

# Build the package:
makepkg -l ${OUT}/${P}-${V}-${ARCH}-${B}.tlz


2) create a file called .xinitrc in your home directory and paste the
content below using the editor you prefer (you can use vim, in Dragora is
installed by default, or mousepad if you prefer an editor in X graphical
environment), then save it and close your editor.

#.xinitrc chinese Dragora support begins
export LANG=zh_CN.gb2312
export LC_CTYPE="zh_CN.GBK" #use this for a complete chinese
                            #environment

#export LC_CTYPE="en_US.UTF-8" #replace this withe above LC_CTYPE
                               #variable for an english environment
                               #with chinese support
export GTK_IM_MODULE=xim
export QT_IM_MODULE=xim
export XMODIFIERS="@im=fcitx"

fcitx &

xfce4-session
#.xinitrc chinese Dragora support ends

3) now kill X and restart fcitx session with $ startx. Your chinese
environment should be set...


For runlevel 4 follow the first step above (install fcitx), then in your
home create a file called .xprofile and paste inside it the below content
using the editor you prefer (you can use vim, in Dragora is installed by
default, or mousepad if you prefer an editor in X graphical environment),
then save it and close your editor. After that, just logout and restart
your fcitx X session: chinese support should be available.

#.xprofile chinese Dragora support begins
export LANG=zh_CN.gb2312
export LC_CTYPE="zh_CN.GBK" #use this for a complete chinese
                            #environment

#export LC_CTYPE="en_US.UTF-8" #replace this withe above LC_CTYPE
                               #variable for an english environment
                               #with chinese support
export GTK_IM_MODULE=xim
export QT_IM_MODULE=xim
export XMODIFIERS="@im=fcitx"

fcitx &

#.xprofile chinese Dragora support ends

Fonts (optional). To install chinese different type of fonts (they should
have a better rendering then the default ones) download the fonts you like
(you can try the fonts at
http://fr.sourceforge.jp/projects/sfnet_wqy/downloads/wqy-zenhei/0.8.38%20%28Pangu%29/wqy-zenhei-0.8.38-1.tar.gz/)
then copy them as root in /user/share/fonts/[your custom directory] and
then run the command as root: fc-cache -vf. Your fonts should be available
once you restart X.

To report a bug or for suggestions on how to implement different input
methods please send an email to the mailing list or wait for me in
dragora's IRC chat channel ;-)

Xiaoy
_______________________________________________
Dragora-ardi mailing list
address@hidden
https://listas.usla.org.ar/cgi-bin/mailman/listinfo/dragora-ardi
So, finally i decided to write a little tutorial on how to make chinese language support available on Dragora.

Let's start from how to setup runlevel 3. First of all we need to install a chinese input method (fonts are optional) and then setup the environments variables:

1) Get latest Fcitx chinese input method source tarball from http://www.fcitx.org/download/ (at the time of this tutorial last version is 3.6.3, but you can modify the scripts to fit newer versions), create a directory in you home called fcitx, create a file inside ti called fcitx-build and paste inside the file the content below, then chmod +x the build file (make sure the build file is in the same directory of the source) and execute the build ex: sudo ./fcitx-build. When finished install the package with the command: # pkg add fcitx-[version number]-i486-1.tlz

#!/bin/bash
#  Copyright (C) 2011  Matias A. Fonzo, <address@hidden>
#
#  This program is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.

set -e

CWD=$(pwd)

TMP=${TMP:-/tmp/sources}
OUT=${OUT:-/tmp/packages}

P=fcitx
V=${V:-3.6.3}
ARCH=${ARCH:-i486}
B=${B:-1}

# Flags for the compiler:
DCFLAGS=${DCFLAGS:=-O2 -march=i486 -mtune=i686}

# Parallel jobs for the compiler:
JOBS=${JOBS:=-j4}

PKG=${TMP}/package-${P}

rm -rf $PKG
mkdir -p $PKG $OUT

rm -rf ${TMP}/${P}-${V}
echo "Uncompressing the tarball..."
tar -jxvf ${CWD}/${P}-${V}.tar.bz2 -C $TMP

cd ${TMP}/${P}-${V}

# Set sane ownerships and permissions:
chown -R 0:0 .
find . \
 \( -perm 2777 -o -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="$DCFLAGS" \
CXXFLAGS="$DCFLAGS" \
./configure \
 --prefix=/usr \
 --sysconfdir=/etc \
 --infodir=/usr/info \
 --mandir=/usr/man \
 --localstatedir=/var \
 --disable-static \
 --enable-shared \
 --program-prefix="" \
 --program-suffix="" \
 --enable-gtk \
 --enable-utp \
 --enable-libnotify \
 --enable-libcanberra \
 --enable-cli \
 --enable-daemon \
 --with-inotify \
 --build=${ARCH}-dragora-linux-gnu

make $JOBS V=1 || make;
make install DESTDIR=$PKG

# Compress .info page(s)?:
if [[ -d ${PKG}/usr/info ]]; then
  ( cd ${PKG}/usr/info
    rm -f dir  # Redundancy.
    gzip -9N *.info*
  )
fi

# Compress and link .man page(s)?:
if [[ -d ${PKG}/usr/man ]]; then
  ( cd ${PKG}/usr/man
    find . -type f -exec gzip -9N '{}' +
    find . -type l | while read file ; do
      ln -sf $(readlink $file).gz ${file}.gz
      rm $file
    done
  )
fi

# Copy the documentation:
mkdir -p ${PKG}/usr/doc/${P}-${V}
cp -a \
 AUTHORS COPYING ChangeLog NEWS README \
 ${PKG}/usr/doc/${P}-${V}

cd $PKG

# Strip binaries & libraries:
find . -type f | xargs file | awk '/ELF/ && /executable/ || /shared object/' | \
 cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || :

# Copy the description files:
mkdir -p description install
cp ${CWD}/description/?? description/
zcat ${CWD}/post-install.gz > install/post-install

# Build the package:
makepkg -l ${OUT}/${P}-${V}-${ARCH}-${B}.tlz


2) create a file called .xinitrc in your home directory and paste the content below using the editor you prefer (you can use vim, in Dragora is installed by default, or mousepad if you prefer an editor in X graphical environment), then save it and close your editor.

#.xinitrc chinese Dragora support begins
export LANG=zh_CN.gb2312
export LC_CTYPE="zh_CN.GBK" #use this for a complete chinese 
                            #environment 

#export LC_CTYPE="en_US.UTF-8" #replace this withe above LC_CTYPE 
                               #variable for an english environment
                               #with chinese support
export GTK_IM_MODULE=xim
export QT_IM_MODULE=xim
export XMODIFIERS="@im=fcitx"

fcitx &

xfce4-session
#.xinitrc chinese Dragora support ends

3) now kill X and restart fcitx session with $ startx. Your chinese environment should be set...


For runlevel 4 follow the first step above (install fcitx), then in your home create a file called .xprofile and paste inside it the below content using the editor you prefer (you can use vim, in Dragora is installed by default, or mousepad if you prefer an editor in X graphical environment), then save it and close your editor. After that, just logout and restart your fcitx X session: chinese support should be available.

#.xprofile chinese Dragora support begins
export LANG=zh_CN.gb2312
export LC_CTYPE="zh_CN.GBK" #use this for a complete chinese 
                            #environment 

#export LC_CTYPE="en_US.UTF-8" #replace this withe above LC_CTYPE 
                               #variable for an english environment
                               #with chinese support
export GTK_IM_MODULE=xim
export QT_IM_MODULE=xim
export XMODIFIERS="@im=fcitx"

fcitx &

#.xprofile chinese Dragora support ends

Fonts (optional). To install chinese different type of fonts (they should have a better rendering then the default ones) download the fonts you like (you can try the fonts at http://fr.sourceforge.jp/projects/sfnet_wqy/downloads/wqy-zenhei/0.8.38%20%28Pangu%29/wqy-zenhei-0.8.38-1.tar.gz/) then copy them as root in /user/share/fonts/[your custom directory] and then run the command as root: fc-cache -vf. Your fonts should be available once you restart X.

To report a bug or for suggestions on how to implement different input methods please send an email to the mailing list or wait for me in dragora's IRC chat channel ;-)

Xiaoy

reply via email to

[Prev in Thread] Current Thread [Next in Thread]