forked from Sigil-Ebook/Sigil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Building_on_Linux.html
159 lines (153 loc) · 16.9 KB
/
Building_on_Linux.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!doctype html>
<html>
<head>
<meta charset='UTF-8'><meta name='viewport' content='width=device-width initial-scale=1'>
<title>Building_on_Linux</title></head>
<body><h1><center>Building Sigil on Linux</center></h1>
<h2><center>Systems like Ubuntu 18.04 (and its derivatives) or newer</center></h2>
<p>If you're looking for instructions on how to build on systems older than Ubuntu 18.04 (systems whose repo version of Qt5 is less than 5.9.4), you should look at the <a href='./Building_on_older_Linux.html'>Building_on_older_Linux</a> documentation.</p>
<h2>General Overview</h2>
<p>The requirements for building Sigil on newer Linux systems like Ubuntu 18.04, Mint 19, Arch Linux, etc., should be able to be installed entirely from your system's software repositories.</p>
<p>To build Sigil on newer Linux systems, you need to get/do the following things:</p>
<ol start='' >
<li><a href='#gcc'>A Linux build-toolchain</a> with a C++11 capable compiler (gcc 4.9.x or higher recommended)</li>
<li><a href='#cmake'>CMake</a> (3.0 or higher)</li>
<li><a href='#qt5'>Qt5.9.4 or higher</a> (with QtWebEngine)</li>
<li><a href='#thirdparty'>3rd-party dependencies</a> (an optional step)</li>
<li><a href='#python'>Python 3.4</a> (or higher)</li>
<li><a href='#sigil'>The Sigil source code</a> (downloaded tarball/zipfile or a git clone)</li>
<li><a href='#build'>Build/Install Sigil</a></li>
<li><a href='#testing'>Test Sigil's Plugin Framework</a></li>
<li><a href='#advanced'>Advanced Stuff</a></li>
</ol>
<p>Since I'm basically an Ubuntu/Debian guy at heart, I'll be mentioning stuff like:</p>
<blockquote><p><code>sudo apt-get install</code></p>
</blockquote>
<p>from here on out. You'll have to forgive me for not knowing all the yum/pacman/emerge equivalents. It's not a slight--I can assure you.</p>
<h2><a name="gcc"/>Linux Build Environment</h2>
<p>On Ubuntu-type systems you can use:</p>
<blockquote><p><code>sudo apt-get install build-essential git</code></p>
</blockquote>
<p>to get pretty-much everything you need to configure/compile/install C++ projects. On other flavors of Linux you need to basically make sure that you have gcc/g++ and "make" installed.</p>
<h2><a name="cmake"/>Getting CMake</h2>
<p>Once again: <code>sudo apt-get install cmake</code> will get you what you need on Ubuntu-type systems.</p>
<h2><a name="qt5"/>Getting Qt5</h2>
<center>**If your repos don't provide at lease Qt5.9.4, use the [Building_on_older_Linux](./Building_on_older_Linux.md) documentation**</center>
<p>To get Sigil's Qt5 requirements, <code>sudo apt-get install</code> the following packages:</p>
<ul>
<li>qtbase5-dev</li>
<li>qttools5-dev</li>
<li>qttools5-dev-tools</li>
<li>qtwebengine5-dev</li>
</ul>
<p>The folllowing command can be copied and pasted for convenience:</p>
<p><code>sudo apt-get install qtbase5-dev qttools5-dev qttools5-dev-tools qtwebengine5-dev</code></p>
<h2><a name="thirdparty"/>3rd-Party Dependencies (optional step)</h2>
<p>Sigil will provide the extra third-party libs if you do nothing, but most (if not all) of Sigil's third-party dependencies should be avialable in your software repos. If you want to make use of them, <code>sudo apt-get install</code> the following packages.</p>
<ul>
<li>libhunspell-dev</li>
<li>libpcre3-dev</li>
<li>libminizip-dev</li>
</ul>
<p>The folllowing command can be copied and pasted for convenience:</p>
<p><code>sudo apt-get install libhunspell-dev libpcre3-dev libminizip-dev</code></p>
<p>If you do install them, remember to use use the -DUSE_SYSTEM_LIBS=1 option when configuring Sigil with cmake later on. Otherwise, the build process will ignore them and provide/build its own.</p>
<h2><a name="python"/>Getting Python 3.4 (or higher)</h2>
<p>On Ubuntu/Debian <code>sudo apt-get install</code> (at a minimum) the following packages:</p>
<ul>
<li>python3-dev</li>
<li>python3-pip</li>
<li>python3-lxml</li>
<li>python3-six</li>
<li>python3-css-parser (may have to use <code>pip3 install css-parser</code> if your distro has no package for this)</li>
</ul>
<p>The folllowing command can be copied and pasted for convenience:</p>
<p><code>sudo apt-get install python3-dev python3-pip python3-lxml python3-six python3-css-parser</code></p>
<p>That's all the Python 3.4 (or higher) stuff you will need to get Sigil "up and running", but if you want to make use of Sigil plugins that people are developing, you will also want to install the "standard" modules that ship with the binary version of Sigil on Windows and OS X. These should all be able to be installed with <code>sudo apt-get install</code>.</p>
<ul>
<li>python3-tk</li>
<li>python3-pyqt5</li>
<li>python3-html5lib</li>
<li>python3-regex</li>
<li>python3-pillow (could be python3-pil)</li>
<li>python3-cssselect</li>
<li>python3-chardet</li>
</ul>
<p>The folllowing command can be copied and pasted for convenience:</p>
<p><code>sudo apt-get install python3-tk python3-pyqt5 python3-html5lib python3-regex python3-pillow python3-cssselect python3-chardet</code></p>
<p>If you run into any that won't install with <code>sudo apt-get install</code> you can still use pip3 to install them.</p>
<h2><a name="sigil"/>Getting Sigil's Source Code</h2>
<p>You can clone the Sigil Github repository:</p>
<blockquote><p><code>git clone https://github.com/Sigil-Ebook/Sigil.git</code></p>
</blockquote>
<p>Or you can download a specific release tarball/zipfile from Sigil's <a href='https://github.com/Sigil-Ebook/Sigil/releases/latest'>releases page</a> on Github.</p>
<p>I recommend the latter method, as the github repository version might not always be stable at any given moment (even though we try hard not to leave it broken).</p>
<p>Unzip/untar the source code. Rename the uppermost directory ("Sigil-0.X.X" if you've download the Sigil-0.X.X-Code.zip file ) to something useful like "sigil-src". Unless you like typing mixed-case stuff in a terminal.</p>
<h2><a name="build"/>Building Sigil</h2>
<p>First off ... you don't build IN the Sigil source directory. You do all the building in a separate "build" directory. So at the same directory level as the Sigil source code directory, create a new directory called "sigil-build". The rest of the instructions will assume that both your Sigil source directory (I renamed it "sigil-src" in the previous step; adjust accordingly if you didn't) and your Sigil build directory ("sigil-build) are at the root of your user's home (~) directory.</p>
<p>So first off, open a terminal and cd into your sigil-build directory</p>
<blockquote><p><code>cd ~/sigil-build</code></p>
</blockquote>
<p>Then issue the following command to configure Sigil for building:</p>
<blockquote><p><code>cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ../sigil-src</code></p>
</blockquote>
<p>If there are no errors, you're ready to build.</p>
<p>The default install prefix is /usr/local. If you wish to change the install location, you can do so by adding a <code>-DCMAKE_INSTALL_PREFIX</code> option to the above cmake configure command like so:</p>
<blockquote><p><code>cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/a/different/install/prefix -DCMAKE_BUILD_TYPE=Release ../sigil-src</code></p>
</blockquote>
<p>You can also customize/override where the Sigil support files get installed (<code><CMAKE_INSTALL_PREFIX>/share</code> by default) with the <code>-DSHARE_INSTALL_PREFIX</code> option (not recommended for beginners).</p>
<p>If cmake couldn't automatically find the necessary Python 3.4 (or higher) stuff it needs (like if you installed manually in an unusual location, or you want to use a different Python version) you may need to tell cmake <em>specifically</em> where things can be found. Do so with:</p>
<blockquote><p><code>-DPYTHON_LIBRARY=<the full path to the python3.4 (or higher) shared library> (usually something similar to /usr/lib/libpython34.so)</code></p>
</blockquote>
<blockquote><p><code>-DPYTHON_INCLUDE_DIR=<the full path to the directory where python3.4's (or higher) header files can be found> (ex: /usr/include/python3.4)</code></p>
</blockquote>
<blockquote><p><code>-DPYTHON_EXECUTABLE=<the full path to the python3.4 (or higher) interpreter> (ex: /usr/lib/python3)</code></p>
</blockquote>
<p>Once the cmake configure command finishes with no errors, build Sigil with:</p>
<blockquote><p><code>make (or make -j4 if you have plenty of processor cores)</code></p>
</blockquote>
<h3>Common compilation failures/Errors.</h3>
<p>To be determined.</p>
<h3>Installing Sigil</h3>
<p>If all goes well, install Sigil with:</p>
<blockquote><p><code>sudo make install</code></p>
</blockquote>
<p>If you configured with the default install prefix, you can launch by entering "sigil" (no quotes) at a terminal. If you configured to install somewhere else, you may need to create a link to the sigil launch script (<code><CMAKE_INSTALL_PREFIX>/bin/sigil</code>) in a directory that is on your path. There's also a .desktop file in <code><SIGIL_SHARE_PREFIX>/share/applications</code> that you can create a link to on your desktop. Sigil should also appear in your Desktop Environment's menu system (under Office and/or Accessories). You may need to logout and back in for the menu entries to be visible after installing (you can also force your menus to update if you have the xdg-utils package installed by issuing the "xdg-desktop-menu forceupdate" command from a terminal)</p>
<h2><a name="testing"/>Testing Sigil's Python plugin framework</h2>
<p>To test if Sigil's Python 3.4+ plugin framework is fully functional, you can do the following:</p>
<ol start='' >
<li>download testplugin_v013.zip from <a href='https://github.com/Sigil-Ebook/Sigil/raw/master/docs/testplugin_v014.zip'>https://github.com/Sigil-Ebook/Sigil/raw/master/docs/testplugin_v014.zip</a></li>
<li>open Sigil to the normal nearly blank template epub it generates when opened</li>
<li>use Plugins->Manage Plugins menu and make sure you have a Python 3.4+ interpreter configured </li>
<li>use the "Add Plugin" button to navigate to and add testplugin_vXXX.zip and then hit "Okay" to exit the Manage Plugins Dialog</li>
<li>use Plugins->Edit->testplugin to launch the plugin and hit the "Start" button to run it</li>
<li>check the plugin output window for your missing or broken plugin test results</li>
</ol>
<p>Install any missing Python modules with your system's package management system or Python's pip3.</p>
<h2><a name="advanced"/>Advanced Stuff</h2>
<p>There are several configuration and environment variable options that can tailor how Sigil is built and/or run. I've talked about a few of the cmake options already, but I'll mention them here again along with the rest--with a brief explanation of their purposes.</p>
<h3>CMake options</h3>
<p>-DQt5_DIR=<code><path></code> Configures cmake to use a Qt5 installation other than the normal system version of Qt5 (ex. /opt/Qt5.12.3/5.12/gcc_64/lib/cmake/Qt5 - the path should alays end in /lib/cmake/Qt5)</p>
<p>-DCMAKE_INSTALL_PREFIX=<code><path></code> Configures the prefix where Sigil will be installed to (default is /usr/local)</p>
<p>-DSHARE_INSTALL_PREFIX=<code><path></code> Configures the prefix where Sigil's support files will be installed to (default is /usr/local meaning the support files will be installed in /usr/local/share/sigil)</p>
<p>-DCMAKE_INSTALL_LIBDIR=(lib|lib64) Use to override GnuInstallDirs if it doesn't choose the correct lib directory for your distro.</p>
<p>-DUSE_SYSTEM_LIBS=(0|1) Tells cmake to try and use the system libraries when building Sigil instead of the ones bundled with Sigil in the 3rdParty directory. If a system version of a 3rd-party can't be found, Sigil falls back on the bundled version -- unless -DSYSTEM_LIBS_REQUIRED=1 is also specified (default is 0).</p>
<p>-DSYSTEM_LIBS_REQUIRED=(0|1) When used in conjunction with -DUSE_SYSTEM_LIBS=1, the Sigil build process will fail if all the necessary libraries can't be located on the system, instead of falling back on the bundled versions (default is 0).</p>
<p>-DINSTALL_BUNDLED_DICTS=(0|1) Default is 1. Can be used to enable/disable the installation of the bundled Hunspell dictionaries used for spellchecking. If this is disabled (-DINSTALL_BUNDLED_DICTS=0), then the standard system spell-check dictionary location of /usr/share/hunspell will be searched for eligible dictionaries. If additional system paths need to be searched for dictionaries, they can be added using the -DEXTRA_DICT_DIRS option. Setting this to 0 will require that you manually install the language-specific hunspell dictionaries (from your software repos) yourself (e.g. <code>sudo apt-get install hunspell-en-us</code>).</p>
<p>-DEXTRA_DICT_DIRS=<code><path1></code>:<code><path2></code> Path(s) that should be searched for eligible spellcheck dictionaries (in addition to /usr/share/hunspell). Multiple paths should be separated by colons. This option is only relevant if -DINSTALL_BUNDLED_DICTS=0 is also specified.</p>
<p>-DMATHJAX_DIR=<code><path></code> If you would like use your system's MathJax implementation instead of the one that comes bundled with Sigil, use this cmake directive when first configuring. A minimum of MathJax v2.7.0 is required to work with Sigil. NOTE: if -DMATHJAX_DIR=<code><path></code> is used, Sigil will install a config script to <code><path></code>/config/local. This file is required for Sigil's Preview to be able properly render MathML. This feature was added between Sigil 0.9.12 and 0.9.13.</p>
<p>The following three cmake options are used to manually specify which Python3 you want to use when building Sigil instead of relying on the included cmake utilities to try and automatically find a suitable version.</p>
<p>-DPYTHON_LIBRARY=<code><the path to the python3.x shared library></code></p>
<p>-DPYTHON_INCLUDE_DIR=<code><the path to the directory where python3.x's header files can be found></code></p>
<p>-DPYTHON_EXECUTABLE=<code><the path to the python3.x interpreter></code></p>
<p>-DBUILD_PATCHED_LIBXML2=(0|1) Some newer versions of libxml2 have a bug that causes QtWebKit to render html entities twice. Adding -DBUILD_PATCHED_LIBXML2=1 to the cmake command will clone the libxml2 git repo, checkout a specific commit, patch the source, build it and install it alongside Sigil (does not affect the system version of libxml2). Requires git, libtool, autoconf and automake packages to be installed (as well as a working internet connection). Cmake should notify of any missing programs needed. The default is to NOT build the patched version of libxml2 (-DBUILD_PATCHED_LIBXML2=0).</p>
<h3>Environment Variables</h3>
<p>The following are environment variables that can be set at runtime to affect how Sigil is run after building/installing. They are commonly set by manually editing Sigil's launch script (<code><CMAKE_INSTALL_PREFIX></code>/bin/sigil).</p>
<p>SIGIL_PREFS_DIR - Changes where sigil looks for and updates its user preference data. Needs to specify a full path in a directory where the user has write privileges.</p>
<p>SIGIL_EXTRA_ROOT - Handy for relocating the Sigil support files. For instance you can move the <code><CMAKE_SHARE_PREFIX>/share/sigil</code> directory anywhere you like. You just have to set SIGIL_EXTRA_ROOT to the path where you moved <code><CMAKE_SHARE_PREFIX>/share/sigil</code> to.</p>
<p>SIGIL_DICTIONARIES - Used to tell Sigil what directories are to be searched for Hunspell dictionary files. Multiple directories can be specified by separating the paths with a colon. i.e. SIGIL_DICTIONARIES="/usr/share/hunspell" or SIGIL_DICTIONARIES="/usr/share/hunspell:/usr/share/hunspellextra" Setting this variable at run time will override all compile-time dictionary search paths (except for any user-supplied dictionaries manually added to their preference directory's hunspell_dictionary location).</p>
<p>FORCE_SIGIL_DARKMODE_PALETTE - If this variable is set at runtime, it tells Sigil to ignore any defined platform themes/styles (QT_QPA_PLATFORMTHEME, or QT_STYLE_OVERRIDE) and to use the dark color palette provided by Sigil (starting with Sigil v1.1).</p>
<p>SIGIL_ICON_SCALE_FACTOR - Valid values: 1.0 to 3.0. The default value (with no variable set) is 1.8. Sigil scales its menu icons based on font-size. This can sometimes result in icons being a bit too large (or too small) depending on the system Qt theme. Use this variable to tweak the icon size if deemed necessary. <strong>(Only works with Sigil v0.9.7 and earlier; v0.9.8 has a preference setting to adjust icons)</strong></p>
<p>The Sigil launch script also sets a SIGIL_SHARE_PREFIX environment variable, but it is automatically set to be the same as the cmake SHARE_INSTALL_PREFIX build-time option. It would be unwise to change this environment variable. Use the SIGIL_EXTRA_ROOT environment variable instead, if you need to alter the location of Sigil's support files after building Sigil.</p>
</body>
</html>