root/trunk/uploadr/README.windows

Revision 369, 12.5 kB (checked in by calh, 2 years ago)

split out the README file per-platform

Line 
1 Flickr Uploadr
2
3 Copyright (c) 2007-2008 Yahoo! Inc.  All rights reserved.  This library is
4 free software; you can redistribute it and/or modify it under the terms of
5 the GNU General Public License (GPL), version 2 only.  This library is
6 distributed WITHOUT ANY WARRANTY, whether express or implied. See the GNU
7 GPL for more details (http://www.gnu.org/licenses/gpl.html)
8
9 ------------------------------------------------------------------------
10
11 This guide uses UPLOADR to indicate the root of the Flickr Uploadr
12 source tree on your filesystem.  It probably shouldn't contain spaces
13 (C:\Documents and Settings\you\My Documents\Flickr Uploadr is probably
14 a bad idea).
15
16 On Windows, you must use the MSys bash shell to build Uploadr.  Cygwin
17 is not supported.  Instructions for getting your MSys environment setup
18 are included below.
19
20 You can obtain the Flickr Uploadr source code from either a tarball or
21 from Subversion.
22
23 Download tarball:
24   http://flickr.com/tools/uploadr/
25
26 Checkout from Subversion:
27   $ svn co http://code.flickr.com/svn/trunk/uploadr UPLOADR
28
29
30 Windows Build Environment
31 ------------------------------------------------------------------------
32
33 If you're planning on building the third party libraries on windows
34 (graphics magick, exiv2, ffmepg) then you'll need to have MS Visual C++
35 version 8 or greater installed. Version 7 will work for the third party
36 libraries themselves, but version 8 is required for building the final
37 DLLs.
38
39 To build the installers and such, you'll need to install MSYS. Start
40 by going here:
41
42 http://sf.net/project/showfiles.php?group_id=2435
43
44 Choose 'MSYS Base System', then find the file called something like
45 'msysCORE-1.0.11-2007.01.19-1.tar.bz2'. Unzip this (get WinRaR if you
46 can't open it) and put it at C:\msys
47
48 Download the following files from the 'MSYS Base System' page:
49
50     MSYS-1.0.11-20071204.tar.bz2
51     bash-3.1-MSYS-1.0.11-1.tar.bz2
52     coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2
53
54 And download these file from the 'MSYS Supplementary Tools' page:
55
56     perl-5.6.1-MSYS-1.0.11-1.tar.bz2
57     crypt-1.1-1-MSYS-1.0.11-1.tar.bz2
58
59 Version numbers may be higher. Unzip them into the same folder as
60 MSYS, overwriting any existing duplicate files.
61
62 When you launch MSYS via the batch file in its root folder, you should
63 be able to type 'perl -v' and get a Perl banner if all went well.
64
65 Follow these steps to get MSYS working with Visual Studio:
66
67 http://arrozcru.no-ip.org/ffmpeg_wiki/tiki-index.php?page=Fixing+msys
68
69 From the same download page, download the following packages:
70
71   From the MinGW Runtime section:
72       mingw-runtime-3.14.tar.gz
73
74   From the GNU Binutils section:
75       binutils-2.18.50-20080109-2.tar.gz
76
77   From the MinGW API for MS-Windows section:
78       w32api-3.11.tar.gz
79
80   From the GCC Version 4 / Technology Preview: gcc-4.2.1-sjlj-2 section:
81       gcc-core-4.2.1-sjlj-2.tar.gz
82       gcc-g++-4.2.1-sjlj-2.tar.gz
83
84 Unpack each package into C:\msys\mingw then go to C:\msys\mingw\bin\ and
85 rename:
86
87   c++-sjlj.exe to c++.exe
88   cpp-sjlj.exe to cpp.exe
89   g++-sjlj.exe to g++.exe
90   gcc-sjlj.exe to gcc.exe
91
92 Follow these instructions to make mingw work with msys:
93
94 http://arrozcru.no-ip.org/ffmpeg_wiki/tiki-index.php?page=Integrating+MinGW+with+MSys
95
96 You probably already have an SVN client, but if not, you can grab the
97 commandline one from here:
98
99   http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91
100   svn-1.4.6-setup.exe (or a more recent version)
101
102 Once installed, typing 'svn --version' from a fresh MSYS shell should give
103 you a version banner.
104
105 Next you'll need a zip utility. Grab this zip file:
106
107   ftp://ftp.info-zip.org/pub/infozip/WIN32/zip232xN.zip
108
109 And copy zip.exe into msys/bin. Ok, all ready!
110
111
112 XULRunner
113 ------------------------------------------------------------------------
114
115 XULRunner trunk builds:
116   ftp://ftp.mozilla.org/pub/mozilla.org/xulrunner/nightly/latest-trunk/
117
118 Note: You want the version *without* 'sdk' in the name.
119
120
121 Download a version of XULRunner trunk and unzip it into:
122   UPLOADR/MacUploadr.app/Contents/Resources/
123
124 The XULRunner files (e.g. xulrunner.exe) should now be here:
125   UPLOADR/MacUploadr.app/Contents/Resources/xulrunner/
126
127 Make sure you unzip the file keeping directory paths intact. There should
128 be several folders inside the 'xulrunner' folder, including 'chrome',
129 'components', etc.
130
131
132 Gecko SDK
133 ------------------------------------------------------------------------
134
135 To build the XPCOM components you will need the Gecko SDK:
136   http://developer.mozilla.org/en/docs/Gecko_SDK#Downloading
137
138 Place the SDK here:
139   UPLOADR/MacUploadr.app/Contents/Resources/gecko-sdk.win
140
141 These SDKs are from the Gecko 1.8 series and so are only safe to use
142 if the XPCOM components use only frozen interfaces.  Fortunately,
143 Uploadr currently falls into this category.
144
145
146 You'll also need bits from Mozilla's Wintools:
147   http://ftp.mozilla.org/pub/mozilla.org/mozilla/source/wintools.zip
148
149 Extract that and copy glib-1.2.dll and libIDL-0.6.dll from
150 wintools/buildtools/windows/bin/x86/ to your gecko-sdk.win/bin/ directory.
151
152
153
154 API Keys
155 ------------------------------------------------------------------------
156
157 You'll need your own API key and secret from Flickr to build Uploadr.
158 These can be obtained at http://flickr.com/services/api/.  The key
159 and secret must be placed in flKey.cpp as indicated:
160   UPLOADR/MacUploadr.app/Contents/Resources/components/flKey.cpp
161
162 The API key is stored as a string.  The secret is stored as individual
163 characters so it is not easily readable from the binary.
164
165 There are blocks to keep both a Windows and Mac key/secret in the same
166 source file (you certainly don't have to, though).  This is mainly
167 important for the official builds.
168
169
170
171 GraphicsMagick
172 ------------------------------------------------------------------------
173
174 Download GraphicsMagick Windows SOURCE:
175   ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/windows/
176
177 You'll need MS Visual C++ to build GraphicsMagick. We've built it
178 sucessfully using VC++ 7 and 8, but other versions may work fine.
179
180 Go to the VisualMagick/configure directory of the GraphicsMagick Windows
181 source directory.  Open configure.vcproj in Visual Studio and edit the
182 project configuration:
183
184   o Set the active configuration to "Release"
185   o Change the Use of MFC under Configuration Properties > General to
186     "Use MFC in a Static Library"
187   o Change the Runtime Library under Configuration Properties > C/C++ >
188     Code Generation to "Multi-threaded (/MT)"
189
190 Build the project and then run the configuration program (called
191 configure.exe, in the same folder as the .vcproj file). Select "Static
192 Multi-threaded runtimes" and otherwise accept the defaults.  This will
193 create your solution (project file) for Visual Studio in the root
194 GraphicsMagick folder. It should be called 'VisualStaticMT.sln'.
195
196 Open the solution and let Visual Studio 8 have its way with the Visual
197 Studio 7 solution file.  Edit the project configuration:
198
199   o Set the active configuration to "Release" for 'All'
200   o Change the Runtime Library for the CORE_Magick++ project under
201     Configuration Properties > C/C++ > Code Generation to
202     "Multi-threaded DLL (/MD)"
203   o Tell all of the CORE_* projects to optimize for speed under
204     Configuration Properties > C/C++ > Optimization
205     (Optimization: "Maximize Speed /O2")
206
207 Build it to see where the problems are.  As of 1.1.8, 18 out of 20
208 projects build properly.  The two that do not are utilities that are
209 extraneous.  In 1.1.7, the errors that will likely show up in a
210 try/catch block can be fixed by changing "exception" to "std::exception"
211 and adding "&" to make all of the catches happen by reference.  The
212 official builds are build with 1.1.10 and will soon move to 1.1.11.
213
214 You can verify that enough of it built correctly by checking in the
215 VisualMagick\lib directory. There should be a .lib file for each
216 CORE_* project.
217
218 Add the path to your GraphicsMagick build's VisualMagick\lib directory
219 to your library path.  Add the path to VisualMagick\include to your
220 include path.
221
222 The magic.mgk, modules.mgk and delegates.mgk files must be in the root of
223 the application (next to application.ini).  These files are included in
224 the tarball and Subversion checkouts, so you shouldn't have to worry. You
225 can otherwise find them in the VisualMagick\bin directory.
226
227
228 Exiv2
229 ------------------------------------------------------------------------
230
231 Download Exiv2 source from:
232   http://exiv2.org/download.html
233
234 Download and install Expat for Windows:
235   http://sourceforge.net/project/showfiles.php?group_id=10127
236
237 Open up the solution file at 'msvc\exiv2.sln'. Just like GraphicsMagick,
238 let Visual Studio 8 eat the 7.1 project files. Edit the project
239 configuration:
240
241   o Disable every project in the Exiv2 solution except exiv2lib and xmpsdk
242     (Use the configuration manager and uncheck the boxes)
243   o Change the Runtime Library for remaining projects under
244     Configuration Properties > C/C++ > Code Generation to
245     "Multi-threaded DLL (/MD)"
246   o Set remaining projects to their Release state
247   o Modify the xmpsdk project:
248       o Change Configuration Properties > C/C++ > General >
249         Additional Include Directories to (all one line):
250         "..\..\..\expat-2.0.1\lib;..\..\xmpsdk\src;..\..\xmpsdk\include;"
251         "C:\Program Files\Expat 2.0.1\Source\lib"
252         (the last path portion might be different, depending on where
253         you install expat).
254       o Change Configuration Properties > Librarian > General >
255         Additional Dependencies to "libexpat.lib"
256       o Change Configuration Properties > Librarian > General >
257         Additional Library Directories to:
258         "$(SolutionDir)/lib";"C:\Program Files\Expat 2.0.1\Bin"
259   o Modify the exiv2lib project:
260       o Change Configuration Properties > Librarian > General >
261         Link Library Dependencies to "Yes" (VC7 doesn't seem to have
262         this option - just skip it)
263       o Change Configuration Properties > C/C++ > General >
264         Additional Include Directories to:
265         "..\..\src;..\..;..\..\xmpsdk\include"
266
267 You should now be able to build the solution. It should produce the
268 following files:
269
270         msvc\exiv2lib\Release\exiv2.lib
271         msvc\xmpsdk\Release\xmpsdk.lib
272
273 Copy libexpat.dll from "C:\Program Files\Expat 2.0.1\Bin" to
274 "UPLOADR\MacUploadr.app\Contents\Resources".
275
276
277 FFmpeg
278 ------------------------------------------------------------------------
279
280 FFmpeg will not build in Visual Studio but can be linked by Visual
281 Studio, so we'll need to use MSys/WinGW.
282
283 --- I'm dubious that we need to install anything extra here [CAL]
284 --- But i need to wait until i actually get gm.dll linking
285 --- Additionally add in dependencies like zlib:
286 ---   http://wiki.videolan.org/Win32CompileMSYS
287
288 Check out and build the magic version of FFmpeg:
289 (handy hint: Shift+Insert pastes into the MSYS shell)
290
291   $ svn co -r 10885 svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
292   $ cd ffmpeg
293   $ ./configure --disable-ffserver --disable-ffplay --enable-gpl \
294     --enable-memalign-hack --enable-static --disable-shared \
295     --disable-debug
296   $ make && make install
297
298 The Uploadr Visual Studio project is setup to expect the MinGW bits for
299 linking FFmpeg into the flGM XPCOM object.
300
301
302 Building XPCOM components
303 ------------------------------------------------------------------------
304
305 If you make any changes to the IDL files defining the XPCOM interfaces,
306 you must increment the BuildID defined in:
307   UPLOADR/MacUploadr.app/Contents/Resources/application.ini
308
309 Use the Visual Studio projects in:
310   UPLOADR/MacUploadr.app/Contents/Resources/components/*.vcproj
311
312 The two projects will generate gm.dll and key.dll.
313
314
315 Running Flickr Uploadr
316 ------------------------------------------------------------------------
317
318 Copy xulrunner-stub.exe from the xulrunner/ directory into the root
319 of your app, UPLOADR/MacUploadr.app/Contents/Resources/, rename it to
320 "Flickr Uploadr.exe" and double-click it to run Uploadr.
321
322 You can hack the icons.ico file into the executable using Resource
323 Hacker:
324   http://angusj.com/resourcehacker/
325
326 Create a shortcut to this executable and append the "-console
327 -jsconsole" parameters to launch Uploadr with both debug windows open.
328
329
330 Packaging
331 ------------------------------------------------------------------------
332
333 Windows installers are created using NSIS, specifically the Unicode
334 version available here:
335   http://www.scratchpaper.com/
336
337 Building the NSIS package will likely fail if you do not have Visual
338 Studio 8 installed.  The installer references vcredist_x86.exe.  For
339 controlled experimentation it is OK to omit this installation step by
340 commenting line 110 in UPLOADR/windows_install_build.nsi.
341
342 One-command builds in MSys for all eight languages:
343   $ make win all
344
345 Or to build a single language:
346   $ make win build en-US
347
348 If you do not want to create update files (see README.mar):
349   $ make win all-build
Note: See TracBrowser for help on using the browser.