diff --git a/COMPILE_ubuntu-16.04.md b/COMPILE_ubuntu-16.04.md new file mode 100644 index 000000000..8298b571c --- /dev/null +++ b/COMPILE_ubuntu-16.04.md @@ -0,0 +1,112 @@ +Howto build kiwix-lib on Ubuntu 16.04 (LTS) +=========================================== + +Some dependencies packaged on Ubuntu 16.04 are too old or don't provide +pkg-config files. + +The [kiwix-build](https://github.com/kiwix/kiwix-build) script takes care of +downloading, compiling and installing all the dependencies and kiwix-* projects. +We recommend you to use this script. + +If you still want to compile yourself kiwix-lib... here we go ! + +This script describe step by step how to compile kiwix-lib on a fresh +Ubuntu 16.04 system. + +# Install needed packages + +``` +sudo apt install uuid-dev libicu-dev libctpp2-dev automake libtool +``` + +# Prepare the environment + +We will install all our custom dependencies in a separated directory to avoid +polluting the system. + +``` +KIWIX_DIR= +mkdir $KIWIX_DIR +virtualenv -p python3 $KIWIX_DIR +# Activate the virtualenv +source $KIWIX_DIR/bin/activate +# The virtualenv can be deactivated at anytime with +deactivate +``` + +## Libzim + +``` +git clone https://gerrit.wikimedia.org/r/p/openzim.git +cd openzim/zimlib +./autoconf.sh +./configure --prefix=$KIWIX_DIR +make +make install +``` + +## libpugixml + +``` +wget http://github.com/zeux/pugixml/releases/download/v1.8/pugixml-1.8.tar.gz && tar xf pugixml-1.8.tar.gz +cd pugixml-1.8 +cmake -DCMAKE_INSTALL_PREFIX=$KIWIX_DIR -DBUILD_PKGCONFIG=1 -DBUILD_SHARED_LIBS=1 +make +make install +``` + +## Xapian + +The libxapian provided by ubuntu package is too old and do not have the GLASS_BACKEND we use. +So we need to compile our own xapian version: + +``` +wget http://download.kiwix.org/dev/xapian-core-1.4.0.tar.xz && tar xf xapian-core-1.4.0.tar.xz +cd xapian-core-1.4.0 +./configure --enable-shared --enable-static --disable-sse --disable-backend-inmemory --disable-documentation --prefix=$KIWIX_DIR +make +make install +``` + +## meson + +Meson is a python package, just install it with pip. +(Be sure you are using the virtualenv created before) + +``` +pip install meson +hash -r # let's bash renew its hashes and use the meson we've just installed +``` + +## ninja + +``` +git clone git://github.com/ninja-build/ninja.git && cd ninja +git checkout release +./configure.py --bootstrap +cp ninja $KIWIX_DIR/bin +``` + +The virtualenv automatically add the $KIWIX_DIR/bin in PATH, so there +is nothing more to do. + + +# Compile kiwix-lib + + +Then, it's time to compile kiwix-lib : + +``` +$ cd kiwix-lib +$ mkdir build +$ PKG_CONFIG_PATH=~/KIWIX/lib/pkgconfig meson . build --prefix=$KIWIX_DIR +$ cd build +$ ninja +$ ninja install +``` + +By default, it will compile dynamic linked libraries. +If you want statically linked libraries, you can add `--default-library=static` +option to the meson command. + +Licensed as GPLv3 or later, see COPYING for more details. diff --git a/README.md b/README.md index 037eaddd1..7eb355406 100644 --- a/README.md +++ b/README.md @@ -3,16 +3,14 @@ libkiwix libkiwix contains the common code base for all kiwix ports. - - -Build kiwix-tools ------------------ +Build kiwix-lib +--------------- Most of the compilation steps (including download and compilation of dependencies and other tools (kiwix-tools)) are handle by [kiwix-build](https://github.com/kiwix/kiwix-build) script. -If you don't have any special need, we recommand you to use kiwix-build +If you don't have any special need, we recommend you to use kiwix-build instead of doing all the steps yourself. Dependencies: @@ -22,29 +20,15 @@ You'll need the following dependencies to build libkiwix: * icu * libzim * pugixml -* aria2c * ctpp2 -* xapian (optional) +* xapian (optional) (>=1.4) +* meson build system (>=0.34)(and so, ninja, pkg-config, ...) -On debian architecture, you can install the following deb packages: -* libicu-dev -* libxapian-dev -* libctpp2-dev -* aria2c - -You will need to install yourself: -* [libzim](http://www.openzim.org/wiki/Zimlib) -* libpugixml - 1.8+, compiled with `-DBUILD_PKGCONFIG=1 -DBUILD_SHARED_LIBS=1` - -As we use meson to build kiwix-tools, you will need the common meson tools: -* [meson](http://mesonbuild.com/) >= 0.34 -* ninja -* pkg-config - -To build: +Once all dependencies are installed, you can compile kiwix-lib with: ``` $ cd kiwix-lib +$ mkdir build $ meson . build $ cd build $ ninja @@ -55,4 +39,15 @@ By default, it will compile dynamic linked libraries. If you want statically linked libraries, you can add `--default-library=static` option to the meson command. +(You may need to set PKG_CONFIG_PATH before running meson depending of where +and how you've install dependencies) +(Depending of you system, `ninja` may be called `ninja-build`) + + +Howto build kiwix-lib on Ubuntu 16.04 (LTS) +------------------------------------------- + +If you want to compile yourself kiwix-lib see the specific readme to +[compile kiwix-lib on Ubuntu 16.04](COMPILE_ubuntu-16.04.md). + Licensed as GPLv3 or later, see COPYING for more details.