Subversion Repositories Scribus

Rev

Rev 10815 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
10780 craig 1
BUILDING SCRIBUS ON MICROSOFT WINDOWS
2
=====================================
3
 
10797 craig 4
STATUS OF WIN32 CMAKE BUILDS
5
============================
6
 
7
Building Scribus on win32 with cmake is still rather poorly tested.
8
It's getting there, but for now the Visual Studio project based builds
9
maintained by Jean Ghali are much more stable.
10
 
11
Known issues with this build:
12
 
13
	- It's hard to ensure that debug libs are used for debug builds
14
	  and release libs for release builds, as not all CMake scripts
15
	  do this sensibly.
16
 
17
	- The scripter isn't building yet.
18
 
19
	- The sxwim plugin isn't building yet.
20
 
21
HOW TO DO THE BUILD
22
===================
23
 
10780 craig 24
This documentation is minimal, and will be replaced by more detailed
25
information once the CMake-based win32 builds are better tested.
26
 
27
You will need:
28
	- Microsoft Windows XP (others may work but are untested)
29
	- Microsoft Visual Studio Express Edition 8 2005
30
	- The Microsoft Platform SDK
10797 craig 31
	- CMake 2.5.x (2.4.x WILL NOT WORK)
32
	- A recent Qt 4.3 snapshot built with Visual Studio 8 2005
10818 craig 33
          (see below)
10797 craig 34
	- libxml2 win32 binaries from the libxml project
35
	- libjpeg sources from jig.org
10818 craig 36
	- libtiff sources from libtiff.org
37
	- libpng sources from libpng.org
38
	- zlib sources from zlib.org
39
	- freetype sources from freetype.org
40
	- LittleCMS sources from www.littlecms.com
41
	- PoDoFo 0.5.0 (and ONLY 0.5.0) sources from podofo.sourceforge.net
10797 craig 42
	- A Python 2.5 Windows binary build.
43
          For debug builds, you'll need a release that contains the python25_d.dll .
10780 craig 44
 
10797 craig 45
Some more details can be found below in the section entitled GETTING DEPENDENCIES.
10780 craig 46
 
47
To build scribus its self, you should create a new empty build directory
48
outside the Scribus source tree. In this directory, create a new text file and
49
name it "build.cmd". Ignore the warning about changing the file extension.
50
 
51
Open build.cmd in a text editor, and paste the following into it:
52
 
53
---
54
rem Dependency paths:
55
set CMAKE=C:\Program Files\CMake 2.5\bin\cmake.exe
10797 craig 56
rem used for headers only; we get the lib from the libpng build
57
set ZLIBDIR=c:\developer\lib\zlib
58
rem provides both png and zlib .libs
59
set PNGDIR=C:\developer\lib\lpng1220-vc\
10780 craig 60
set QTDIR=C:\developer\Qt\qt-win-opensource-src-4.3.2-snapshot-20070929
10797 craig 61
set LCMSDIR=c:\developer\lib\lcms-1.16-vc
62
set JPEGDIR=c:\developer\lib\jpeg-6b-vc
63
set FREETYPEDIR=c:\developer\lib\freetype-2.3.5
64
set TIFFDIR=c:\developer\lib\tiff-3.8.2-vc
65
set PODOFODIR=c:\developer\podofo\050-vs-inst
10780 craig 66
set PODOFOSHARED=1
10797 craig 67
set LIBXMLDIR=c:\developer\lib\libxml2-2.6.30.win32
10780 craig 68
set SCRIBUSINSTALLDIR=c:\developer\scribus-bin
69
rem
70
rem
10797 craig 71
set PATH=%SYSTEMROOT%;%SYSTEMROOT%\system32;%QTDIR%\bin
72
set INCLUDE=
73
set LIB=
74
set SCPNGPROJ=%PNGDIR%\projects\visualc71\
10780 craig 75
del cmakecache.txt
10818 craig 76
"%CMAKE%" -G "Visual Studio 8 2005" -DCMAKE_INCLUDE_PATH:PATH=%QTDIR%\src\3rdparty\zlib;%QTDIR%\src\3rdparty\libpng;%ZLIBDIR%;%ZLIBDIR%\include;%PNGDIR%;%PNGDIR%\include;%LCMSDIR%\include;%JPEGDIR%;%JPEGDIR%\include;%TIFFDIR%\libtiff;%TIFFDIR%\include;%FREETYPEDIR%\include;%FREETYPEDIR%\include\freetype2;%PODOFODIR%\include;%LIBXMLDIR%\include -DCMAKE_LIBRARY_PATH:PATH=%ZLIBDIR%\lib;%SCPNGPROJ%\Win32_DLL_Debug\Zlib;%SCPNGPROJ%\Win32_DLL_Release\Zlib;%PNGDIR%\lib;%SCPNGPROJ%\Win32_DLL_Debug;%SCPNGPROJ%\Win32_DLL_Release;%LCMSDIR%\lib;%LCMSDIR%\Lib\MS;%LCMSDIR%\Lib\MS\dll;%JPEGDIR%;%JPEGDIR%\lib;%TIFFDIR%\libtiff;%TIFFDIR%\lib;%FREETYPEDIR%\objs;%FREETYPEDIR%\lib;%PODOFODIR%\lib;%LIBXMLDIR%\lib -DLIBPODOFO_SHARED=%PODOFOSHARED% -DCMAKE_INSTALL_PREFIX=c:\developer\scribus-bin -DJPEG_NAMES:STRING=libjpeg -DFREETYPE_LIBRARY_NAMES_RELEASE=freetype235MT -DFREETYPE_LIBRARY_NAMES_DEBUG=freetype235MT_D -DUSE_QT_ZLIB_PNGLIB=1 ..\scribus-trunk
10780 craig 77
---
78
 
10797 craig 79
The above script is designed to work with common arrangements of library
80
install directories, both build trees and installed copies. If you follow the
81
instructions here about setting up the libraries scribus requires, you should
82
be OK. [SEE: GETTING DEPENDENENCIES]
10780 craig 83
 
10797 craig 84
Update the dependency paths to match your system.  Now open a cmd.exe window,
85
cd into the build directory, and run build.cmd . If all goes well, it'll find
86
your libraries and exit successfully.
10809 subik 87
(Note: Some systems could have some environment related problems running this
88
from simple cmd.exe. Use SDK console instead then.)
10797 craig 89
 
10780 craig 90
Open the solution that CMake generated in Visual Studio and build it. On
91
Windows it's easier to do a release build as you don't need to build a debug
92
Qt, python, etc.
93
 
94
If it all builds, manually build the INSTALL project to trigger an install. Now
10797 craig 95
copy the DLLs from the zlib, libpng, qt, lcms, freetype, libtiff, libjpeg,
96
libxml, and podofo directories into the Scribus install directory (where
97
scribus.exe is). It should now run.
10780 craig 98
 
99
Crash problems at runtime? Verify that Qt, freetype, lcms, and Scribus all use
100
the same runtime, and that all were built for debugging or all for release not
101
a mixture of the two. Windows does not permit you to mix debug and release
102
executables like other platforms do.
103
 
104
You can use depends.exe to check that the runtimes match.
105
 
10797 craig 106
GETTING DEPENDENCIES
107
====================
108
 
109
This is a quick and dirty set of notes that will be filled out once everything's
110
verified as correct and working. It asssumes that you'll be building all your
111
dependencies at a single root, like C:\Developer. The root *MUST* not have spaces
112
in its path.
113
 
114
----
115
Qt:
116
 
10813 craig 117
Download the latest qt 4.3 snapshot for windows and unpack it to C:\Developer .
118
Don't get the "all" snapshot, it lacks configure.exe  and can't easily be built
119
on Windows.
120
 
121
Start a command line and import your Visual Studio environment:
122
\path\to\visual\studio\VC\vcvarsall.bat
123
\path\to\platform\sdk\setenv.cmd
124
 
125
now cd to C:\Developer\Qt-win-whatever and run configure:
10797 craig 126
configure -debug-and-release -fast -no-qt3support -platform win32-msvc2005
127
 
10813 craig 128
and nmake.
129
 
10797 craig 130
----
131
 
10818 craig 132
Zlib and LibPNG are both embedded in the QtCore library with symbols exported
133
for public use . If you're using a Qt binary redist you may still need to
134
download these libraries sources for their headers. In most cases your
135
copy of Qt will contain a directory called  %QTDIR%\src\3rdparty\zlib
136
(and one for libpng), in which case you need not worry about these libraries at
137
all.
10797 craig 138
 
139
----
140
 
10818 craig 141
jpeg:
10815 craig 142
 
10818 craig 143
While Qt also bundles libjpeg, it's not linked to the main DLL but rather a plugin.
144
As such, we need to link to it directly.
10815 craig 145
 
10813 craig 146
Get jpeg sources from jig.org . Unpack to your libraries directory.
147
Now, in a command prompt:
10797 craig 148
 
10813 craig 149
cd
10797 craig 150
copy Makefile.vc Makefile
151
copy jconfig.vc jconfig.h
152
nmake
153
 
154
(you might have to use vcvars.bat from vc and setvars.bat from the platform sdk)
155
 
156
 
157
----
158
 
159
lcms:
160
 
161
Get lcms sources.
10818 craig 162
Build using VC project in Projects dir. Build the DLL ("lcmsdll"
163
project) in debug and release configurations.
10797 craig 164
 
165
Now modify lcms.h and remove:
166
 
167
#define unlink _unlink
168
 
169
You must modify lcms.h to prevent it from defining `cdecl'. [TODO: other
170
changes] [ TODO: line numbers / patch ]. This is only required to use the
171
header with Scribus; it's Ok to use a library built without these changes.
172
 
173
 
174
----
175
 
176
Libtiff
177
 
10818 craig 178
While Qt also bundles libtiff, it's not linked to the main DLL but rather a plugin.
179
As such, we need to link to it directly.
10797 craig 180
 
10818 craig 181
Download libtiff sources from libtiff.org and unpack them.
182
 
10797 craig 183
in a vcvars/setenv window:
184
 
185
set INCLUDE=%INCLUDE%;\path\to\jpeg\include;\path\to\zlib\include
186
set LIB=%LIB%;\path\to\jpeg\lib;\path\to\zlib\lib
187
 
188
cd %LIBTIFFDIR%\libtiff
189
nmake /nologo /f Makefile.vc libtiff.lib
190
 
10818 craig 191
Since we're building libtiff as a static library, there's no need to worry
192
about which runtime it's linked to. You can build the DLL if you like
193
(you need to specify LIBS= to include Qt [for zlib] and libjpeg) but
194
the static library should be fine.
195
 
10797 craig 196
----
197
 
198
Freetype:
199
 
200
unpack freetype
201
open builds\win32\visualc
202
upgrade
203
build "Release Multithreaded" and "Debug Multithreaded"
204
 
10818 craig 205
Note that if you're not using Freetype 2.3.5 exactly, you will have
206
to change the freetype library names passed in the build.cmd script.
207
 
10797 craig 208
----
209
 
210
libxml:
211
 
212
download win32 binaries from libxml.org, unpack.
213
Note that these binaries do not use the same runtime
214
as the rest of the binaries we're building. Feel free to
215
rebuild libxml to fix this, but in practice it doesn't
216
matter since we never pass a FILE* nor do we allocate memory
217
to be deallocated in libxml or vice versa.
218
 
219
Remember that iconv from the same package must be on the
220
header search path too. If in doubt, just drop iconv.h
221
into the libxml tree.