Difference between revisions of "Compile from source"

From Fcitx
Jump to navigation Jump to search
(Marked this version for translation)
 
(26 intermediate revisions by the same user not shown)
Line 1: Line 1:
In general, fcitx largely use cmake as its build system, and create many of macro with cmake to help build.
+
<languages/>
  
== Fcitx Dependency ==
+
<translate>
 +
== Grab the source == <!--T:1-->
 +
You can always get the stable code from [http://code.google.com/p/fcitx/downloads/], 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 == <!--T:2-->
 +
In general, fcitx and its components largely use cmake as its build systems, and there are many cmake macros to help building a fcitx module.
 +
 
 +
<!--T:3-->
 +
This section includes the most common dependencies among all Fcitx related packages (some packages might not depend on all of them).
 
* C compiler  (both [[wikipedia:GNU_Compiler_Collection|GCC]] and [[wikipedia:Clang|Clang]] are tested)
 
* C compiler  (both [[wikipedia:GNU_Compiler_Collection|GCC]] and [[wikipedia:Clang|Clang]] are tested)
 
* C++ compiler (both [[wikipedia:G++|G++]] and [[wikipedia:Clang++|CLang++]])
 
* C++ compiler (both [[wikipedia:G++|G++]] and [[wikipedia:Clang++|CLang++]])
 +
* cmake
 +
* intltool
 +
* make
 +
 +
=== Dependency of Fcitx === <!--T:4-->
 
* gtk2 (gtk2 input method module)
 
* gtk2 (gtk2 input method module)
 
* gtk3 (gtk2 input method module)
 
* gtk3 (gtk2 input method module)
 
* qt4 (qt4 input method module)
 
* qt4 (qt4 input method module)
* libxrender ([[Classic UI]])
+
* libxrender ([[Special:myLanguage/ClassicUI|Classic UI]])
* cairo ([[Classic UI]])
+
* libxfixes (X compositor change detection for gnome and x clipboard access for fcitx-clipboard)
* pango ([[Classic UI]])
+
* cairo ([[Special:myLanguage/ClassicUI|Classic UI]])
* dbus (all im module, [[Kimpanel]])
+
* pango ([[Special:myLanguage/ClassicUI|Classic UI]])
 +
* dbus (all im module, [[Special:myLanguage/Kimpanel|Kimpanel]])
 
* dbus-glib (gtk im module)
 
* dbus-glib (gtk im module)
* [http://code.google.com/p/opencc opencc] (Better Simp-Trad Chinese Conversion for [[Chttrans]])
+
* [http://code.google.com/p/opencc opencc] (dynamic after 4.2.7, Better Simp-Trad Chinese Conversion for [[Special:myLanguage/Chttrans|Chttrans]])
* intltool
+
* enchant (dynamic after 4.2.6, enchant word hint backend)
 +
* presage (dynamic after 4.2.6, presage word hint backend)
 +
* libxkbfile
 +
* icu
 +
* gobject-introspection
 +
 
 +
<!--T:5-->
 +
If you want to see the specific package name on different distribution, please check [[Special:myLanguage/Fcitx Complie Dependencies|Fcitx Complie Dependencies]]
  
If you want to browse specific package name for a distro, please check [[:Category:Dependency Fcitx]]
+
<!--T:22-->
 +
The "dynamic" dependency means the package is not required either at compile time or at runtime (although the corresponding option may be disabled by default if it is not found at compile time). The libraries will be loaded dynamically at runtime if found.
  
== Compile Option ==
+
== Compile Option == <!--T:6-->
 
All compile option start with -D, following only include option name.
 
All compile option start with -D, following only include option name.
  
=== CMake General option ==
+
=== CMake General option === <!--T:7-->
 
* CMAKE_INSTALL_PREFIX (Directory to install)
 
* CMAKE_INSTALL_PREFIX (Directory to install)
 
* CMAKE_BUILD_TYPE (Debug, Release, RelWithDbgInfo)
 
* CMAKE_BUILD_TYPE (Debug, Release, RelWithDbgInfo)
  
=== Fcitx option ===
+
=== Fcitx option === <!--T:8-->
  
 +
<!--T:9-->
 
All ENABLE option is boolean value, can be set with On or Off. For default value, please check CMakeLists.txt.
 
All ENABLE option is boolean value, can be set with On or Off. For default value, please check CMakeLists.txt.
  
 +
<!--T:10-->
 
* ENABLE_GTK2_IM_MODULE
 
* ENABLE_GTK2_IM_MODULE
 
* ENABLE_GTK3_IM_MODULE
 
* ENABLE_GTK3_IM_MODULE
Line 40: Line 64:
 
* ENABLE_TEST
 
* ENABLE_TEST
 
* ENABLE_SNOOPER
 
* ENABLE_SNOOPER
 +
* ENABLE_GIR
 +
* ENABLE_ENCHANT
 +
* ENABLE_PRESAGE
 
* NO_SNOOPER_APPS (Comma separated [[wikipedia:Regex|regex]] string)
 
* NO_SNOOPER_APPS (Comma separated [[wikipedia:Regex|regex]] string)
 
* LIB_INSTALL_DIR (By default is prefix/lib, useful when want to install under /usr/lib64 or other directory)
 
* LIB_INSTALL_DIR (By default is prefix/lib, useful when want to install under /usr/lib64 or other directory)
  
== General command ==
+
== General command == <!--T:11-->
    cd /path/to/source
+
 
    mkdir build
+
<!--T:12-->
    cmake .. [CMake options]
+
All cmake based Fcitx component can be compiled in following way.
    make
+
 
    sudo make install
+
<!--T:13-->
 +
cd /path/to/source
 +
mkdir build
 +
cd build
 +
cmake .. [CMake options]
 +
make
 +
sudo make install
 +
 
 +
 
 +
<!--T:14-->
 +
For example, build Fcitx with all im module, and install to /usr. If your distribution make use of /usr/lib64, you should add -DLIB_INSTALL_DIR=/usr/lib64(default "lib").
 +
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
 +
 
 +
<!--T:15-->
 +
For Other Fcitx component, you'd better use
 +
 
 +
<!--T:16-->
 +
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 == <!--T:17-->
 +
It's not recommend to use non standard path, but if you have special need, you need following environment variable to make things work.
 +
 
 +
<!--T:18-->
 +
Say you install Fcitx at /opt/fcitx, and the library directory is /opt/fcitx/lib, then you need following environment variable.
 +
 
 +
    <!--T:19-->
 +
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 ==
+
== See also == <!--T:20-->
 +
* [[Special:myLanguage/Make a portable Fcitx|Make a portable Fcitx]]
 
* [http://www.cmake.org/Wiki/ CMake wiki]
 
* [http://www.cmake.org/Wiki/ CMake wiki]
  
 +
<!--T:21-->
 
[[Category:Compile]]
 
[[Category:Compile]]
[[Category:Dependency Fcitx]]
+
 
 +
</translate>

Latest revision as of 22:56, 2 February 2016

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 components largely use cmake as its build systems, and there are many cmake macros to help building a fcitx module.

This section includes the most common dependencies among all Fcitx related packages (some packages might not depend on all of them).

  • 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)
  • libxfixes (X compositor change detection for gnome and x clipboard access for fcitx-clipboard)
  • cairo (Classic UI)
  • pango (Classic UI)
  • dbus (all im module, Kimpanel)
  • dbus-glib (gtk im module)
  • opencc (dynamic after 4.2.7, Better Simp-Trad Chinese Conversion for Chttrans)
  • enchant (dynamic after 4.2.6, enchant word hint backend)
  • presage (dynamic after 4.2.6, presage word hint backend)
  • libxkbfile
  • icu
  • gobject-introspection

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

The "dynamic" dependency means the package is not required either at compile time or at runtime (although the corresponding option may be disabled by default if it is not found at compile time). The libraries will be loaded dynamically at runtime if found.

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. If your distribution make use of /usr/lib64, you should add -DLIB_INSTALL_DIR=/usr/lib64(default "lib").

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