Rev 16768 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
16720 | jghali | 1 | BUILDING SCRIBUS ON MICROSOFT WINDOWS WITH MICROSOFT VISUAL STUDIO |
2 | ================================================================== |
||
3 | |||
4 | HOW TO DO THE BUILD |
||
5 | =================== |
||
6 | |||
7 | This documentation is minimal and assume you have a decent knowledge of |
||
8 | Microsoft Visual Studio. No help regarding use of Visual Studio and |
||
9 | related tools will be provided. |
||
10 | |||
11 | You will need: |
||
12 | - Microsoft Windows XP, Vista or 7 |
||
13 | - Microsoft Visual Studio 2008 or Visual C++ Express Edition 2008 |
||
14 | - A recent Qt (version >= 4.6) release built with Visual Studio 2008 |
||
15 | - Cairo sources from cairographics.org (version >= 1.8.0) |
||
16 | - Pixman sources from cairographics.org (version = 0.12.0) |
||
17 | - Boost from www.boost.org (version >= 1.35.0) |
||
18 | - Libxml2 win32 binaries from the Libxml project |
||
19 | - Libjpeg win32 libs and binaries from the GnuWin32 project |
||
20 | - Libtiff win32 libs and binaries from the GnuWin32 project |
||
21 | - Freetype sources from freetype.org (version >= 2.4.0) |
||
22 | - LittleCMS sources from www.littlecms.com (version >= 2.1) |
||
23 | - PoDoFo 0.8.x (and ONLY 0.8.x) sources from podofo.sourceforge.net |
||
24 | - A Python 2.7 Windows binary build. |
||
25 | For debug builds, you'll need a release that contains the python27_d.dll . |
||
26 | |||
27 | Some more details can be found below in the section entitled GETTING DEPENDENCIES. |
||
28 | |||
29 | After having installed all dependencies, open Scribus-build.vsprops files located |
||
30 | in Scribus\win32\vc9 and update the dependency paths to match your system. |
||
31 | |||
32 | Open the Visual Studio solution located in Scribus\win32\vc9 and start building. The *-cairo |
||
33 | configurations will build Scribus with cairo renderer. The *-arthur configurations will buid |
||
34 | Scribus using qt arthur renderer. Note : official Scribus builds use cairo as render. |
||
35 | |||
36 | After building completed, you will find executables in a Scribus-builds\scribus-vc9-*\scribus |
||
37 | directory located in same directory as Scribus sources. Those executables will not function yet. |
||
38 | Scribus resources must be copied from source directory to install directory first. |
||
39 | |||
40 | In order to do that, create a batch script and copy/paste following lines : |
||
41 | |||
42 | set SCRIBUS_SRC_PATH=.\Scribus |
||
43 | set SCRIBUS_BUILD_ROOT=.\Scribus-builds |
||
44 | set SCRIBUS_INSTALL_PATH=.\Scribus-builds\scribus-vc9-debug-cairo\scribus |
||
45 | |||
46 | copy %SCRIBUS_SRC_PATH%\AUTHORS %SCRIBUS_INSTALL_PATH%\share\doc |
||
47 | copy %SCRIBUS_SRC_PATH%\COPYING %SCRIBUS_INSTALL_PATH%\share\doc |
||
48 | copy %SCRIBUS_SRC_PATH%\LINKS %SCRIBUS_INSTALL_PATH%\share\doc |
||
49 | copy %SCRIBUS_SRC_PATH%\TRANSLATION %SCRIBUS_INSTALL_PATH%\share\doc |
||
50 | xcopy %SCRIBUS_SRC_PATH%\scribus\doc %SCRIBUS_INSTALL_PATH%\share\doc /s /y /D |
||
51 | xcopy %SCRIBUS_SRC_PATH%\resources\dicts %SCRIBUS_INSTALL_PATH%\share\dicts /s /y /D |
||
52 | xcopy %SCRIBUS_SRC_PATH%\resources\editorconfig %SCRIBUS_INSTALL_PATH%\share\editorconfig /s /y |
||
53 | xcopy %SCRIBUS_SRC_PATH%\resources\icons %SCRIBUS_INSTALL_PATH%\share\icons /s /y /D |
||
54 | xcopy %SCRIBUS_SRC_PATH%\resources\loremipsum %SCRIBUS_INSTALL_PATH%\share\loremipsum /s /y |
||
55 | xcopy %SCRIBUS_SRC_PATH%\resources\profiles %SCRIBUS_INSTALL_PATH%\libs\profiles /s /y |
||
56 | xcopy %SCRIBUS_SRC_PATH%\resources\swatches %SCRIBUS_INSTALL_PATH%\libs\swatches /s /y |
||
57 | xcopy %SCRIBUS_SRC_PATH%\resources\templates %SCRIBUS_INSTALL_PATH%\share\templates /s /y /D |
||
58 | copy %SCRIBUS_SRC_PATH%\scribus\plugins\tools\pathcut\*.png %SCRIBUS_INSTALL_PATH%\share\icons\ /y |
||
59 | copy %SCRIBUS_SRC_PATH%\scribus\plugins\tools\pathfinder\*.png %SCRIBUS_INSTALL_PATH%\share\icons\ /y |
||
60 | xcopy %SCRIBUS_SRC_PATH%\scribus\plugins\scriptplugin\scripts %SCRIBUS_INSTALL_PATH%\share\scripts /s /y /D |
||
61 | xcopy %SCRIBUS_SRC_PATH%\scribus\plugins\scriptplugin\samples %SCRIBUS_INSTALL_PATH%\share\samples /s /y |
||
62 | copy %SCRIBUS_SRC_PATH%\scribus\plugins\psimport\import.prolog %SCRIBUS_INSTALL_PATH%\libs\import.prolog |
||
63 | copy %SCRIBUS_SRC_PATH%\scribus\plugins\barcodegenerator\barcode.ps %SCRIBUS_INSTALL_PATH%\share\plugins\barcode.ps |
||
64 | copy %SCRIBUS_SRC_PATH%\scribus\unicodemap\unicodenameslist.txt %SCRIBUS_INSTALL_PATH%\share\unicodenameslist.txt |
||
65 | del %SCRIBUS_BUILD_ROOT%\*CMake* /s |
||
66 | del %SCRIBUS_BUILD_ROOT%\*MakeFile* /s |
||
67 | |||
68 | Adjust SCRIBUS_SRC_PATH, SCRIBUS_BUILD_ROOT and SCRIBUS_INSTALL_PATH as needed and run batch script. |
||
69 | |||
70 | Now copy the DLLs from the zlib, libpng, qt, lcms, freetype, libtiff, libjpeg, |
||
71 | libxml, and podofo directories into the Scribus install directory (where |
||
72 | scribus.exe is). Copy also the Dlls, lib and tcl directories from your python |
||
73 | install to scribus install path. Finally copy python27.dll. Scribus should now run. |
||
74 | |||
75 | Crash problems at runtime? Verify that Qt, freetype, lcms, and Scribus all use |
||
76 | the same runtime, and that all were built for debugging or all for release not |
||
77 | a mixture of the two. Windows does not permit you to mix debug and release |
||
78 | executables like other platforms do. |
||
79 | |||
80 | You can use depends.exe to check that the runtimes match. |
||
81 | |||
82 | GETTING DEPENDENCIES |
||
83 | ==================== |
||
84 | |||
85 | This is a quick and dirty set of notes that will be filled out once everything's |
||
86 | verified as correct and working. It asssumes that you'll be building all your |
||
87 | dependencies at a single root, like C:\Developer. The root *MUST* not have spaces |
||
88 | in its path. |
||
89 | |||
90 | ---- |
||
91 | Qt: |
||
92 | |||
93 | Download the latest qt >= 4.6 snapshot from ftp://ftp.qt.nokia.com/qt/source |
||
94 | and unpack it to C:\Developer. |
||
95 | |||
96 | Start a command line and import your Visual Studio environment: |
||
97 | \path\to\visual\studio\VC\vcvarsall.bat |
||
98 | |||
99 | now cd to C:\Developer\qt-everywhere-whatever and run configure: |
||
100 | configure -debug-and-release -fast -no-qt3support -platform win32-msvc2008 |
||
101 | |||
102 | and nmake. |
||
103 | |||
104 | ---- |
||
105 | Boost: |
||
106 | |||
107 | Download the latest boost libraries from www.boost.org. Unpack, no need to compile |
||
108 | anything as Scribus only use functionnalities embedded in C++ templates. |
||
109 | |||
110 | ---- |
||
111 | Zlib and LibPNG : |
||
112 | |||
113 | Zlib and LibPNG are both embedded in the QtCore library with symbols exported |
||
114 | for public use . If you're using a Qt binary redist you may still need to |
||
115 | download these libraries sources for their headers. In most cases your |
||
116 | copy of Qt will contain a directory called %QTDIR%\src\3rdparty\zlib |
||
117 | (and one for libpng), in which case you need not worry about these libraries at |
||
118 | all. |
||
119 | |||
120 | --- |
||
121 | Cairo and Pixman |
||
122 | |||
123 | Cairo and pixman sources can be downloaded from cairographics.org at following address : |
||
124 | |||
125 | http://cairographics.org/releases/ |
||
126 | |||
127 | Follow instructions in sources packages to build pixman, then cairo. |
||
128 | |||
129 | You will however probably find easier to directly download packages with Visual Studio 2008 |
||
130 | solutions ready to build. You can find required file at following address : |
||
131 | |||
132 | https://sourceforge.net/projects/scribus/files/scribus-libs/win32-msvc2008/ |
||
133 | |||
134 | Download the both scribus-pixman-* and scribus-cairo-* zip files. Unpack them. |
||
135 | |||
136 | Build pixman first : open the PixManWin32 solution located in pixman-whatever\win32 |
||
137 | directory and build Debug and Release configurations. |
||
138 | |||
139 | Build cairo afterwards : open the CairoWin32 solution located in cairo-whatever\win32 |
||
140 | directory and build Debug and Release configurations. |
||
141 | |||
142 | ---- |
||
143 | Libjpeg : |
||
144 | |||
145 | While Qt also bundles libjpeg, it's not linked to the main DLL but rather a plugin. |
||
146 | As such, we need to link to it directly. |
||
147 | |||
148 | Get jpeg libraries from GnuWin32 project on Sourceforge : |
||
149 | |||
150 | http://sourceforge.net/projects/gnuwin32/files/jpeg/6b-3/jpeg-6b-3-lib.zip/download |
||
151 | |||
152 | Unpack in C:\Developer. After unpacking you directory layout must be as following : |
||
153 | |||
154 | C:\Developer |
||
155 | |- libjpeg-6b-3 |
||
156 | |- include |
||
157 | |- lib |
||
158 | |- manifest |
||
159 | |||
160 | ---- |
||
161 | LittleCMS : |
||
162 | |||
163 | Get lcms sources (>= 2.1). Although it is possible to build Scribus with lcms 1, |
||
164 | you can only do so without modifying lcms sources with lcms >= 2.1. |
||
165 | We will only describe here instructions related to lcms >= 2.1. |
||
166 | |||
167 | Build using VC project in Projects\VC2008 dir. Modify projects if necessary so |
||
168 | as to make them use the multithreaded dll runtim libraries. |
||
169 | Build the static libraries in debug and release configurations. |
||
170 | |||
171 | After building you must have a lcms2_static.lib and lcms2_staticd.lib in |
||
172 | your lcms source directory. If this is not the case modify projects as necessary. |
||
173 | |||
174 | ---- |
||
175 | Libtiff |
||
176 | |||
177 | While Qt also bundles libtiff, it's not linked to the main DLL but rather a plugin. |
||
178 | As such, we need to link to it directly. |
||
179 | |||
180 | Download libtiff libraries, binaries and dependency packages from GnuWin32 project |
||
181 | on sourceforge : |
||
182 | |||
183 | http://sourceforge.net/projects/gnuwin32/files/tiff/3.8.2/ |
||
184 | |||
185 | Unpack them in C:\Developer. After unpacking you directory layout must be as following : |
||
186 | |||
187 | C:\Developer |
||
188 | |- libtiff-3.8.2 |
||
189 | |- bin |
||
190 | |- contrib |
||
191 | |- include |
||
192 | |- lib |
||
193 | |- man |
||
194 | |- manifest |
||
195 | |||
196 | ---- |
||
197 | Freetype: |
||
198 | |||
199 | Unpack freetype |
||
200 | |||
201 | Open include\freetype\config\ftoption.h and replace the DLL export compilation section |
||
202 | by following lines : |
||
203 | |||
204 | #ifndef __GNUC__ |
||
205 | # define __DLL_IMPORT__ __declspec(dllimport) |
||
206 | # define __DLL_EXPORT__ __declspec(dllexport) |
||
207 | #else |
||
208 | # define __DLL_IMPORT__ __attribute__((dllimport)) extern |
||
209 | # define __DLL_EXPORT__ __attribute__((dllexport)) extern |
||
210 | #endif |
||
211 | |||
212 | #if (defined __WIN32__) || (defined _WIN32) |
||
213 | # ifdef BUILD_FREETYPE2_DLL |
||
214 | # define FREETYPE2_DLL_IMPEXP __DLL_EXPORT__ |
||
215 | # elif defined(FREETYPE2_STATIC) |
||
216 | # define FREETYPE2_DLL_IMPEXP |
||
217 | # elif defined (USE_FREETYPE2_DLL) |
||
218 | # define FREETYPE2_DLL_IMPEXP __DLL_IMPORT__ |
||
219 | # elif defined (USE_FREETYPE2_STATIC) |
||
220 | # define FREETYPE2_DLL_IMPEXP |
||
221 | # else /* assume USE_FREETYPE2_DLL */ |
||
222 | # define FREETYPE2_DLL_IMPEXP __DLL_IMPORT__ |
||
223 | # endif |
||
224 | #else /* __WIN32__ */ |
||
225 | # define FREETYPE2_DLL_IMPEXP |
||
226 | #endif |
||
227 | |||
228 | #define FT_EXPORT(x) FREETYPE2_DLL_IMPEXP x |
||
229 | #define FT_BASE(x) FREETYPE2_DLL_IMPEXP x |
||
230 | |||
231 | Open builds\win32\vc2008 |
||
232 | Build "Release Multithreaded" and "Debug Multithreaded" |
||
233 | |||
234 | At the end of the process you must have those files in your freetype lib |
||
235 | directory : |
||
236 | - freetype.dll |
||
237 | - freetype.lib |
||
238 | - freetypeD.dll |
||
239 | - freetypeD.lib |
||
240 | |||
241 | ---- |
||
242 | Libxml2 / iconv : |
||
243 | |||
244 | Download libxml2 and icon win32 binaries from following address : |
||
245 | |||
246 | ftp://ftp.zlatkovic.com/libxml/ |
||
247 | |||
248 | Note that these binaries do not use the same runtime |
||
249 | as the rest of the binaries we're building. Feel free to |
||
250 | rebuild libxml to fix this, but in practice it doesn't |
||
251 | matter since we never pass a FILE* nor do we allocate memory |
||
252 | to be deallocated in libxml or vice versa. |
||
253 | |||
254 | Remember that iconv from the same package must be on the |
||
255 | header search path too. If in doubt, just drop iconv.h |
||
256 | into the libxml tree. |
||
257 | |||
258 | --- |
||
259 | Podofo : |
||
260 | |||
261 | Podofo sources can be downloaded from podofo.sourceforge.net. At the moment |
||
262 | those instructions are written, the recommended version to build Scribus on |
||
263 | Windows is one of the 0.8.x series. Podofo >= 0.9.0 will not work!!!! |
||
264 | |||
265 | Follow instructions in sources packages to build Podofo. |
||
266 | |||
267 | You will however probably find easier to directly download packages with Visual |
||
268 | Studio 2008 solutions ready to build. You can find required file at |
||
269 | following address : |
||
270 | |||
271 | https://sourceforge.net/projects/scribus/files/scribus-libs/win32-msvc2008/ |
||
272 | |||
273 | Download the both scribus-podofo-* file. Unpack it. |
||
274 | |||
275 | Open the podofo solution located in podofo-whatever directory and build |
||
276 | Debug and Release configurations of PoDoFoLib project. |
||
277 | |||
278 | Note : freetype, libtiff and libjpeg must have been installed and if |
||
279 | necessary compiled before attempting to build podofo. |
||
280 | |||
281 | --- |
||
282 | Python : |
||
283 | |||
284 | Download latest Python 2.7 binaries (and only 2.7, 3.x will not work). |
||
285 | Unpack or install. |
||
286 | Copy the python27.lib file in python 'libs' directory to python27_d.lib |
||
287 | |||
288 | Open pyconfig.h in python include directory |
||
289 | |||
290 | Replace those lines : |
||
291 | |||
292 | #ifdef _DEBUG |
||
293 | # define Py_DEBUG |
||
294 | #endif |
||
295 | |||
296 | by : |
||
297 | |||
298 | #ifdef _DEBUG |
||
299 | # //define Py_DEBUG |
||
300 | #endif |