Difference between revisions of "Compile from source"

From Fcitx
Jump to navigation Jump to search
m
Line 96: Line 96:
 
  mkdir build
 
  mkdir build
 
  cd build
 
  cd build
  cmake .. -DCMAKE_INSTALL_PREFIX=`fcitx4-config --prefix`
+
  cmake .. -DCMAKE_INSTALL_PREFIX=`fcitx4-config --prefix` -DLIB_INSTALL_DIR=`fcitx4-config --libdir`
 
  make
 
  make
 
  sudo make install
 
  sudo make install

Revision as of 06:04, 21 October 2012

Other languages:
English

Grab the source

You can always get the stable code from [1], if you wish to use development version, you need to install git and take a look at http://code.google.com/p/fcitx/source/checkout and http://github.com/fcitx/.

General Dependency

In general, fcitx and its component largely uses cmake as its build system, and create many of macro with cmake to help build.

This section means, it's the most common dependency among all Fcitx related package, though some of them might not depend on these.

  • C compiler (both GCC and Clang are tested)
  • C++ compiler (both G++ and CLang++)
  • cmake
  • intltool
  • make

Dependency of Fcitx

  • gtk2 (gtk2 input method module)
  • gtk3 (gtk2 input method module)
  • qt4 (qt4 input method module)
  • libxrender (Classic UI)
  • cairo (Classic UI)
  • pango (Classic UI)
  • dbus (all im module, Kimpanel)
  • dbus-glib (gtk im module)
  • opencc (Better Simp-Trad Chinese Conversion for Chttrans)
  • enchant (Keyboard keyboard word hint)
  • presage (Keyboard better English word hint)
  • libxkbfile
  • icu
  • gobject-introspection

If you want to see the specific package name on different distribution, please check Fcitx Complie Dependencies

Compile Option

All compile option start with -D, following only include option name.

CMake General option

  • CMAKE_INSTALL_PREFIX (Directory to install)
  • CMAKE_BUILD_TYPE (Debug, Release, RelWithDbgInfo)

Fcitx option

All ENABLE option is boolean value, can be set with On or Off. For default value, please check CMakeLists.txt.

  • ENABLE_GTK2_IM_MODULE
  • ENABLE_GTK3_IM_MODULE
  • ENABLE_QT_IM_MODULE
  • ENABLE_CAIRO
  • ENABLE_PANGO
  • ENABLE_DBUS
  • ENABLE_DEBUG
  • ENABLE_TABLE
  • ENABLE_OPENCC
  • ENABLE_STATIC
  • ENABLE_TEST
  • ENABLE_SNOOPER
  • ENABLE_GIR
  • ENABLE_ENCHANT
  • ENABLE_PRESAGE
  • NO_SNOOPER_APPS (Comma separated regex string)
  • LIB_INSTALL_DIR (By default is prefix/lib, useful when want to install under /usr/lib64 or other directory)

General command

All cmake based Fcitx component can be compiled in following way.

cd /path/to/source
mkdir build
cd build
cmake .. [CMake options]
make
sudo make install


For example, build Fcitx with all im module, and install to /usr.

cd /path/to/source
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_GTK3_IM_MODULE=On -DENABLE_QT_IM_MODULE=On
make
sudo make install

For Other Fcitx component, you'd better use

cd /path/to/source
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=`fcitx4-config --prefix` -DLIB_INSTALL_DIR=`fcitx4-config --libdir`
make
sudo make install

Use non standard path to install

It's not recommend to use non standard path, but if you have special need, you need following environment variable to make things work.

Say you install Fcitx at /opt/fcitx, and the library directory is /opt/fcitx/lib, then you need following environment variable.

   export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/fcitx/lib/pkgconfig
   export PATH=$PATH:/opt/fcitx/bin
   export CMAKE_PREFIX_PATH=/opt/fcitx

See also