| 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://ffmpeg.arrozcru.com/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 |
mingwrt-3.15-mingw32-dev.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 (because of http://archives.free.net.ph/message/20080910.160811.a4295713.en.html, not using 3.12 yet) |
|---|
| 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 |
Make sure you have C:\msys\mingw\lib\crt2.o (comes from MinGW Runtime section) |
|---|
| 93 |
|
|---|
| 94 |
Follow these instructions to make mingw work with msys: |
|---|
| 95 |
|
|---|
| 96 |
http://ffmpeg.arrozcru.com/ffmpeg_wiki/tiki-index.php?page=Integrating+MinGW+with+MSys |
|---|
| 97 |
|
|---|
| 98 |
You probably already have an SVN client, but if not, you can grab the |
|---|
| 99 |
commandline one from here: |
|---|
| 100 |
|
|---|
| 101 |
http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91 |
|---|
| 102 |
svn-1.4.6-setup.exe (or a more recent version) |
|---|
| 103 |
|
|---|
| 104 |
Once installed, typing 'svn --version' from a fresh MSYS shell should give |
|---|
| 105 |
you a version banner. |
|---|
| 106 |
|
|---|
| 107 |
Next you'll need a zip utility. Grab this zip file: |
|---|
| 108 |
|
|---|
| 109 |
ftp://ftp.info-zip.org/pub/infozip/WIN32/zip232xN.zip |
|---|
| 110 |
|
|---|
| 111 |
And copy zip.exe into msys/bin. Ok, all ready! |
|---|
| 112 |
|
|---|
| 113 |
|
|---|
| 114 |
XULRunner |
|---|
| 115 |
------------------------------------------------------------------------ |
|---|
| 116 |
|
|---|
| 117 |
XULRunner trunk builds: |
|---|
| 118 |
ftp://ftp.mozilla.org/pub/mozilla.org/xulrunner/nightly/latest-trunk/ |
|---|
| 119 |
|
|---|
| 120 |
Note: You want the version *without* 'sdk' in the name. |
|---|
| 121 |
|
|---|
| 122 |
|
|---|
| 123 |
Download a version of XULRunner trunk and unzip it into: |
|---|
| 124 |
UPLOADR/MacUploadr.app/Contents/Resources/ |
|---|
| 125 |
|
|---|
| 126 |
The XULRunner files (e.g. xulrunner.exe) should now be here: |
|---|
| 127 |
UPLOADR/MacUploadr.app/Contents/Resources/xulrunner/ |
|---|
| 128 |
|
|---|
| 129 |
Make sure you unzip the file keeping directory paths intact. There should |
|---|
| 130 |
be several folders inside the 'xulrunner' folder, including 'chrome', |
|---|
| 131 |
'components', etc. |
|---|
| 132 |
|
|---|
| 133 |
|
|---|
| 134 |
Gecko SDK |
|---|
| 135 |
------------------------------------------------------------------------ |
|---|
| 136 |
|
|---|
| 137 |
To build the XPCOM components you will need the Gecko SDK: |
|---|
| 138 |
http://developer.mozilla.org/en/docs/Gecko_SDK#Downloading |
|---|
| 139 |
|
|---|
| 140 |
Place the SDK here: |
|---|
| 141 |
UPLOADR/MacUploadr.app/Contents/Resources/xulrunner-sdk |
|---|
| 142 |
|
|---|
| 143 |
These SDKs are from the Gecko 1.9 series and so are only safe to use |
|---|
| 144 |
if the XPCOM components use only frozen interfaces. Fortunately, |
|---|
| 145 |
Uploadr currently falls into this category. |
|---|
| 146 |
|
|---|
| 147 |
|
|---|
| 148 |
You'll also need bits from Mozilla's Wintools: |
|---|
| 149 |
http://ftp.mozilla.org/pub/mozilla.org/mozilla/source/wintools.zip |
|---|
| 150 |
|
|---|
| 151 |
Extract that and copy glib-1.2.dll and libIDL-0.6.dll from |
|---|
| 152 |
wintools/buildtools/windows/bin/x86/ to your xulrunner-sdk/sdk/bin/ directory. |
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 |
|
|---|
| 156 |
API Keys |
|---|
| 157 |
------------------------------------------------------------------------ |
|---|
| 158 |
|
|---|
| 159 |
You'll need your own API key and secret from Flickr to build Uploadr. |
|---|
| 160 |
These can be obtained at http://flickr.com/services/api/. The key |
|---|
| 161 |
and secret must be placed in flKey.cpp in the spaces provided. Copy |
|---|
| 162 |
flKey.cpp.template to flKey.cpp and insert your keys: |
|---|
| 163 |
|
|---|
| 164 |
UPLOADR/MacUploadr.app/Contents/Resources/components/flKey.cpp.template |
|---|
| 165 |
UPLOADR/MacUploadr.app/Contents/Resources/components/flKey.cpp |
|---|
| 166 |
|
|---|
| 167 |
The API key is stored as a string. The secret is stored as individual |
|---|
| 168 |
characters so it is not easily readable from the binary. |
|---|
| 169 |
|
|---|
| 170 |
There are blocks to keep both a Windows and Mac key/secret in the same |
|---|
| 171 |
source file (you certainly don't have to, though). This is mainly |
|---|
| 172 |
important for the official builds. |
|---|
| 173 |
|
|---|
| 174 |
|
|---|
| 175 |
|
|---|
| 176 |
GraphicsMagick |
|---|
| 177 |
------------------------------------------------------------------------ |
|---|
| 178 |
|
|---|
| 179 |
Download GraphicsMagick Windows SOURCE: |
|---|
| 180 |
ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/windows/ |
|---|
| 181 |
|
|---|
| 182 |
You'll need MS Visual C++ to build GraphicsMagick. We've built it |
|---|
| 183 |
sucessfully using VC++ 7 and 8, but other versions may work fine. |
|---|
| 184 |
|
|---|
| 185 |
Go to the VisualMagick/configure directory of the GraphicsMagick Windows |
|---|
| 186 |
source directory. Open configure.vcproj in Visual Studio and edit the |
|---|
| 187 |
project configuration: |
|---|
| 188 |
|
|---|
| 189 |
o Set the active configuration to "Release" |
|---|
| 190 |
o Change the Use of MFC under Configuration Properties > General to |
|---|
| 191 |
"Use MFC in a Static Library" |
|---|
| 192 |
o Change the Runtime Library under Configuration Properties > C/C++ > |
|---|
| 193 |
Code Generation to "Multi-threaded (/MT)" |
|---|
| 194 |
|
|---|
| 195 |
Build the project and then run the configuration program (called |
|---|
| 196 |
configure.exe, in the same folder as the .vcproj file). Select "Static |
|---|
| 197 |
Multi-threaded runtimes" and otherwise accept the defaults. This will |
|---|
| 198 |
create your solution (project file) for Visual Studio in the root |
|---|
| 199 |
GraphicsMagick folder. It should be called 'VisualStaticMT.sln'. |
|---|
| 200 |
|
|---|
| 201 |
Open the solution and let Visual Studio 8 have its way with the Visual |
|---|
| 202 |
Studio 7 solution file. Edit the project configuration: |
|---|
| 203 |
|
|---|
| 204 |
o Set the active configuration to "Release" for 'All' |
|---|
| 205 |
o Change the Runtime Library for the CORE_Magick++ project under |
|---|
| 206 |
Configuration Properties > C/C++ > Code Generation to |
|---|
| 207 |
"Multi-threaded DLL (/MD)" |
|---|
| 208 |
o Tell all of the CORE_* projects to optimize for speed under |
|---|
| 209 |
Configuration Properties > C/C++ > Optimization |
|---|
| 210 |
(Optimization: "Maximize Speed /O2") |
|---|
| 211 |
|
|---|
| 212 |
Build it to see where the problems are. As of 1.1.8, 18 out of 20 |
|---|
| 213 |
projects build properly. The two that do not are utilities that are |
|---|
| 214 |
extraneous. In 1.1.7, the errors that will likely show up in a |
|---|
| 215 |
try/catch block can be fixed by changing "exception" to "std::exception" |
|---|
| 216 |
and adding "&" to make all of the catches happen by reference. The |
|---|
| 217 |
official builds are build with 1.1.10 and will soon move to 1.1.11. |
|---|
| 218 |
build 1.2.5 builds all the CORE_* projects fine |
|---|
| 219 |
|
|---|
| 220 |
You can verify that enough of it built correctly by checking in the |
|---|
| 221 |
VisualMagick\lib directory. There should be a .lib file for each |
|---|
| 222 |
CORE_* project. |
|---|
| 223 |
|
|---|
| 224 |
Add the path to your GraphicsMagick build's VisualMagick\lib directory |
|---|
| 225 |
to your library path. Add the path to VisualMagick\include (JDE --- |
|---|
| 226 |
GraphicsMagick-1.2.5 does not have an include dir, but C:\Source\UPLOADR\GraphicsMagick-1.2.5\magick maybe) |
|---|
| 227 |
to your include path. |
|---|
| 228 |
|
|---|
| 229 |
The magic.mgk, modules.mgk and delegates.mgk files must be in the root of |
|---|
| 230 |
the application (next to application.ini). These files are included in |
|---|
| 231 |
the tarball and Subversion checkouts, so you shouldn't have to worry. You |
|---|
| 232 |
can otherwise find them in the VisualMagick\bin directory. |
|---|
| 233 |
|
|---|
| 234 |
|
|---|
| 235 |
Exiv2 |
|---|
| 236 |
------------------------------------------------------------------------ |
|---|
| 237 |
|
|---|
| 238 |
Download Exiv2 source from: |
|---|
| 239 |
http://exiv2.org/download.html |
|---|
| 240 |
|
|---|
| 241 |
Download and install Expat for Windows: |
|---|
| 242 |
http://sourceforge.net/project/showfiles.php?group_id=10127 |
|---|
| 243 |
|
|---|
| 244 |
Open up the solution file at 'msvc\exiv2.sln'. Just like GraphicsMagick, |
|---|
| 245 |
let Visual Studio 8 eat the 7.1 project files. Edit the project |
|---|
| 246 |
configuration: |
|---|
| 247 |
|
|---|
| 248 |
o Disable every project in the Exiv2 solution except exiv2lib and xmpsdk |
|---|
| 249 |
(Use the configuration manager and uncheck the boxes) |
|---|
| 250 |
o Change the Runtime Library for remaining projects under |
|---|
| 251 |
Configuration Properties > C/C++ > Code Generation to |
|---|
| 252 |
"Multi-threaded DLL (/MD)" |
|---|
| 253 |
o Set remaining projects to their Release state |
|---|
| 254 |
o Modify the xmpsdk project: |
|---|
| 255 |
o Change Configuration Properties > C/C++ > General > |
|---|
| 256 |
Additional Include Directories to (all one line): |
|---|
| 257 |
"..\..\..\expat-2.0.1\lib;..\..\xmpsdk\src;..\..\xmpsdk\include;" |
|---|
| 258 |
"C:\Program Files\Expat 2.0.1\Source\lib" |
|---|
| 259 |
(the last path portion might be different, depending on where |
|---|
| 260 |
you install expat). |
|---|
| 261 |
o Change Configuration Properties > Librarian > General > |
|---|
| 262 |
Additional Dependencies to "libexpat.lib" |
|---|
| 263 |
o Change Configuration Properties > Librarian > General > |
|---|
| 264 |
Additional Library Directories to: |
|---|
| 265 |
"$(SolutionDir)/lib";"C:\Program Files\Expat 2.0.1\Bin" |
|---|
| 266 |
o Modify the exiv2lib project: |
|---|
| 267 |
o Change Configuration Properties > Librarian > General > |
|---|
| 268 |
Link Library Dependencies to "Yes" (VC7 doesn't seem to have |
|---|
| 269 |
this option - just skip it) |
|---|
| 270 |
o Change Configuration Properties > C/C++ > General > |
|---|
| 271 |
Additional Include Directories to: |
|---|
| 272 |
"..\..\src;..\..;..\..\xmpsdk\include" |
|---|
| 273 |
|
|---|
| 274 |
You should now be able to build the solution. It should produce the |
|---|
| 275 |
following files: |
|---|
| 276 |
|
|---|
| 277 |
msvc\exiv2lib\Release\exiv2.lib |
|---|
| 278 |
msvc\xmpsdk\Release\xmpsdk.lib |
|---|
| 279 |
|
|---|
| 280 |
Copy libexpat.dll from "C:\Program Files\Expat 2.0.1\Bin" to |
|---|
| 281 |
"UPLOADR\MacUploadr.app\Contents\Resources". |
|---|
| 282 |
|
|---|
| 283 |
|
|---|
| 284 |
FFmpeg |
|---|
| 285 |
------------------------------------------------------------------------ |
|---|
| 286 |
|
|---|
| 287 |
FFmpeg will not build in Visual Studio but can be linked by Visual |
|---|
| 288 |
Studio, so we'll need to use MSys/WinGW. |
|---|
| 289 |
|
|---|
| 290 |
--- I'm dubious that we need to install anything extra here [CAL] |
|---|
| 291 |
--- But i need to wait until i actually get gm.dll linking |
|---|
| 292 |
--- Additionally add in dependencies like zlib: (got it from zlib-1.2.3-MSYS-1.0.11-1.tar.bz2 from the MSYS supplementary tool download URL) |
|---|
| 293 |
--- http://wiki.videolan.org/Win32CompileMSYS |
|---|
| 294 |
|
|---|
| 295 |
Check out and build the most recent version of FFmpeg: |
|---|
| 296 |
(handy hint: Shift+Insert pastes into the MSYS shell) |
|---|
| 297 |
|
|---|
| 298 |
$ svn co svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg |
|---|
| 299 |
$ cd ffmpeg |
|---|
| 300 |
$ ./configure --disable-ffserver --disable-ffplay --enable-gpl \ |
|---|
| 301 |
--enable-memalign-hack --enable-static --disable-shared \ |
|---|
| 302 |
--disable-debug --enable-swscale |
|---|
| 303 |
|
|---|
| 304 |
The lastest version of FFmpeg is kinda broken on windows and needs |
|---|
| 305 |
to be built one library at a time,. This should do the trick: |
|---|
| 306 |
--- JDE : Note = with trunk from 09/17/08, make just works |
|---|
| 307 |
BUT |
|---|
| 308 |
had to patch MinGW as described at http://ffmpeg.arrozcru.org/wiki/index.php?title=MSys_MinGW |
|---|
| 309 |
and commented out the #include <sys/select.h> |
|---|
| 310 |
|
|---|
| 311 |
$ cd libswscale && make && cd .. |
|---|
| 312 |
$ cd libavdevice && make && cd .. |
|---|
| 313 |
$ cd libavformat && make && cd .. |
|---|
| 314 |
$ cd libavcodec && make && cd .. |
|---|
| 315 |
$ cd libavutil && make && cd .. |
|---|
| 316 |
$ make |
|---|
| 317 |
|
|---|
| 318 |
make install on windows doesn't work for FFmpeg trunk at the moment. |
|---|
| 319 |
that may or may not be a problem... |
|---|
| 320 |
|
|---|
| 321 |
The Uploadr Visual Studio project is setup to expect the MinGW bits for |
|---|
| 322 |
linking FFmpeg into the flGM XPCOM object. |
|---|
| 323 |
|
|---|
| 324 |
|
|---|
| 325 |
Building XPCOM components |
|---|
| 326 |
------------------------------------------------------------------------ |
|---|
| 327 |
|
|---|
| 328 |
If you make any changes to the IDL files defining the XPCOM interfaces, |
|---|
| 329 |
you must increment the BuildID defined in: |
|---|
| 330 |
UPLOADR/MacUploadr.app/Contents/Resources/application.ini |
|---|
| 331 |
|
|---|
| 332 |
Use the Visual Studio projects in: |
|---|
| 333 |
UPLOADR/MacUploadr.app/Contents/Resources/components/*.vcproj |
|---|
| 334 |
|
|---|
| 335 |
Modify project properties to use your paths to GraphicsMagick and exiv2-0.17.1 |
|---|
| 336 |
|
|---|
| 337 |
The two projects will generate gm.dll and key.dll. |
|---|
| 338 |
|
|---|
| 339 |
|
|---|
| 340 |
Running Flickr Uploadr |
|---|
| 341 |
------------------------------------------------------------------------ |
|---|
| 342 |
|
|---|
| 343 |
Copy xulrunner-stub.exe from the xulrunner/ directory into the root |
|---|
| 344 |
of your app, UPLOADR/MacUploadr.app/Contents/Resources/, rename it to |
|---|
| 345 |
"Flickr Uploadr.exe" and double-click it to run Uploadr. |
|---|
| 346 |
you also need to change the resource of this file to use the flickr uploadr icon. |
|---|
| 347 |
You can use XN Resource editor from http://www.wilsonc.demon.co.uk/d10resourceeditor.htm |
|---|
| 348 |
|
|---|
| 349 |
You can hack the icons.ico file into the executable using Resource |
|---|
| 350 |
Hacker: |
|---|
| 351 |
http://angusj.com/resourcehacker/ |
|---|
| 352 |
|
|---|
| 353 |
Create a shortcut to this executable and append the "-console |
|---|
| 354 |
-jsconsole" parameters to launch Uploadr with both debug windows open. |
|---|
| 355 |
|
|---|
| 356 |
|
|---|
| 357 |
Packaging |
|---|
| 358 |
------------------------------------------------------------------------ |
|---|
| 359 |
|
|---|
| 360 |
Windows installers are created using NSIS, specifically the Unicode |
|---|
| 361 |
version available here: |
|---|
| 362 |
http://www.scratchpaper.com/ |
|---|
| 363 |
|
|---|
| 364 |
Building the NSIS package will likely fail if you do not have Visual |
|---|
| 365 |
Studio 8 installed. The installer references vcredist_x86.exe. For |
|---|
| 366 |
controlled experimentation it is OK to omit this installation step by |
|---|
| 367 |
commenting line 110 in UPLOADR/windows_install_build.nsi. |
|---|
| 368 |
|
|---|
| 369 |
One-command builds in MSys for all eight languages: |
|---|
| 370 |
$ make win all |
|---|
| 371 |
|
|---|
| 372 |
Or to build a single language: |
|---|
| 373 |
$ make win packaging en-US |
|---|
| 374 |
|
|---|
| 375 |
If you do not want to create update files (see README.updates): |
|---|
| 376 |
$ make win all-build |
|---|