root/trunk/uploadr/README.windows

Revision 383, 13.1 kB (checked in by calh, 4 months ago)

renamed the .cpp to a .template file to avoid accidentally checking keys into SVN

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 in the spaces provided. Copy
160 flKey.cpp.template to flKey.cpp and insert your keys:
161
162   UPLOADR/MacUploadr.app/Contents/Resources/components/flKey.cpp.template
163   UPLOADR/MacUploadr.app/Contents/Resources/components/flKey.cpp
164
165 The API key is stored as a string.  The secret is stored as individual
166 characters so it is not easily readable from the binary.
167
168 There are blocks to keep both a Windows and Mac key/secret in the same
169 source file (you certainly don't have to, though).  This is mainly
170 important for the official builds.
171
172
173
174 GraphicsMagick
175 ------------------------------------------------------------------------
176
177 Download GraphicsMagick Windows SOURCE:
178   ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/windows/
179
180 You'll need MS Visual C++ to build GraphicsMagick. We've built it
181 sucessfully using VC++ 7 and 8, but other versions may work fine.
182
183 Go to the VisualMagick/configure directory of the GraphicsMagick Windows
184 source directory.  Open configure.vcproj in Visual Studio and edit the
185 project configuration:
186
187   o Set the active configuration to "Release"
188   o Change the Use of MFC under Configuration Properties > General to
189     "Use MFC in a Static Library"
190   o Change the Runtime Library under Configuration Properties > C/C++ >
191     Code Generation to "Multi-threaded (/MT)"
192
193 Build the project and then run the configuration program (called
194 configure.exe, in the same folder as the .vcproj file). Select "Static
195 Multi-threaded runtimes" and otherwise accept the defaults.  This will
196 create your solution (project file) for Visual Studio in the root
197 GraphicsMagick folder. It should be called 'VisualStaticMT.sln'.
198
199 Open the solution and let Visual Studio 8 have its way with the Visual
200 Studio 7 solution file.  Edit the project configuration:
201
202   o Set the active configuration to "Release" for 'All'
203   o Change the Runtime Library for the CORE_Magick++ project under
204     Configuration Properties > C/C++ > Code Generation to
205     "Multi-threaded DLL (/MD)"
206   o Tell all of the CORE_* projects to optimize for speed under
207     Configuration Properties > C/C++ > Optimization
208     (Optimization: "Maximize Speed /O2")
209
210 Build it to see where the problems are.  As of 1.1.8, 18 out of 20
211 projects build properly.  The two that do not are utilities that are
212 extraneous.  In 1.1.7, the errors that will likely show up in a
213 try/catch block can be fixed by changing "exception" to "std::exception"
214 and adding "&" to make all of the catches happen by reference.  The
215 official builds are build with 1.1.10 and will soon move to 1.1.11.
216
217 You can verify that enough of it built correctly by checking in the
218 VisualMagick\lib directory. There should be a .lib file for each
219 CORE_* project.
220
221 Add the path to your GraphicsMagick build's VisualMagick\lib directory
222 to your library path.  Add the path to VisualMagick\include to your
223 include path.
224
225 The magic.mgk, modules.mgk and delegates.mgk files must be in the root of
226 the application (next to application.ini).  These files are included in
227 the tarball and Subversion checkouts, so you shouldn't have to worry. You
228 can otherwise find them in the VisualMagick\bin directory.
229
230
231 Exiv2
232 ------------------------------------------------------------------------
233
234 Download Exiv2 source from:
235   http://exiv2.org/download.html
236
237 Download and install Expat for Windows:
238   http://sourceforge.net/project/showfiles.php?group_id=10127
239
240 Open up the solution file at 'msvc\exiv2.sln'. Just like GraphicsMagick,
241 let Visual Studio 8 eat the 7.1 project files. Edit the project
242 configuration:
243
244   o Disable every project in the Exiv2 solution except exiv2lib and xmpsdk
245     (Use the configuration manager and uncheck the boxes)
246   o Change the Runtime Library for remaining projects under
247     Configuration Properties > C/C++ > Code Generation to
248     "Multi-threaded DLL (/MD)"
249   o Set remaining projects to their Release state
250   o Modify the xmpsdk project:
251       o Change Configuration Properties > C/C++ > General >
252         Additional Include Directories to (all one line):
253         "..\..\..\expat-2.0.1\lib;..\..\xmpsdk\src;..\..\xmpsdk\include;"
254         "C:\Program Files\Expat 2.0.1\Source\lib"
255         (the last path portion might be different, depending on where
256         you install expat).
257       o Change Configuration Properties > Librarian > General >
258         Additional Dependencies to "libexpat.lib"
259       o Change Configuration Properties > Librarian > General >
260         Additional Library Directories to:
261         "$(SolutionDir)/lib";"C:\Program Files\Expat 2.0.1\Bin"
262   o Modify the exiv2lib project:
263       o Change Configuration Properties > Librarian > General >
264         Link Library Dependencies to "Yes" (VC7 doesn't seem to have
265         this option - just skip it)
266       o Change Configuration Properties > C/C++ > General >
267         Additional Include Directories to:
268         "..\..\src;..\..;..\..\xmpsdk\include"
269
270 You should now be able to build the solution. It should produce the
271 following files:
272
273         msvc\exiv2lib\Release\exiv2.lib
274         msvc\xmpsdk\Release\xmpsdk.lib
275
276 Copy libexpat.dll from "C:\Program Files\Expat 2.0.1\Bin" to
277 "UPLOADR\MacUploadr.app\Contents\Resources".
278
279
280 FFmpeg
281 ------------------------------------------------------------------------
282
283 FFmpeg will not build in Visual Studio but can be linked by Visual
284 Studio, so we'll need to use MSys/WinGW.
285
286 --- I'm dubious that we need to install anything extra here [CAL]
287 --- But i need to wait until i actually get gm.dll linking
288 --- Additionally add in dependencies like zlib:
289 ---   http://wiki.videolan.org/Win32CompileMSYS
290
291 Check out and build the most recent version of FFmpeg:
292 (handy hint: Shift+Insert pastes into the MSYS shell)
293
294   $ svn co svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
295   $ cd ffmpeg
296   $ ./configure --disable-ffserver --disable-ffplay --enable-gpl \
297     --enable-memalign-hack --enable-static --disable-shared \
298     --disable-debug --enable-swscale
299
300 The lastest version of FFmpeg is kinda broken on windows and needs
301 to be built one library at a time,. This should do the trick:
302
303   $ cd libswscale && make && cd ..
304   $ cd libavdevice && make && cd ..
305   $ cd libavformat && make && cd ..
306   $ cd libavcodec && make && cd ..
307   $ cd libavutil && make && cd ..
308   $ make
309
310 make install on windows doesn't work for FFmpeg trunk at the moment.
311 that may or may not be a problem...
312
313 The Uploadr Visual Studio project is setup to expect the MinGW bits for
314 linking FFmpeg into the flGM XPCOM object.
315
316
317 Building XPCOM components
318 ------------------------------------------------------------------------
319
320 If you make any changes to the IDL files defining the XPCOM interfaces,
321 you must increment the BuildID defined in:
322   UPLOADR/MacUploadr.app/Contents/Resources/application.ini
323
324 Use the Visual Studio projects in:
325   UPLOADR/MacUploadr.app/Contents/Resources/components/*.vcproj
326
327 The two projects will generate gm.dll and key.dll.
328
329
330 Running Flickr Uploadr
331 ------------------------------------------------------------------------
332
333 Copy xulrunner-stub.exe from the xulrunner/ directory into the root
334 of your app, UPLOADR/MacUploadr.app/Contents/Resources/, rename it to
335 "Flickr Uploadr.exe" and double-click it to run Uploadr.
336
337 You can hack the icons.ico file into the executable using Resource
338 Hacker:
339   http://angusj.com/resourcehacker/
340
341 Create a shortcut to this executable and append the "-console
342 -jsconsole" parameters to launch Uploadr with both debug windows open.
343
344
345 Packaging
346 ------------------------------------------------------------------------
347
348 Windows installers are created using NSIS, specifically the Unicode
349 version available here:
350   http://www.scratchpaper.com/
351
352 Building the NSIS package will likely fail if you do not have Visual
353 Studio 8 installed.  The installer references vcredist_x86.exe.  For
354 controlled experimentation it is OK to omit this installation step by
355 commenting line 110 in UPLOADR/windows_install_build.nsi.
356
357 One-command builds in MSys for all eight languages:
358   $ make win all
359
360 Or to build a single language:
361   $ make win build en-US
362
363 If you do not want to create update files (see README.updates):
364   $ make win all-build
Note: See TracBrowser for help on using the browser.