Here are my notes, etc on cross-compiling mupdf : 1. get the source - darcs get http://mupdf.com/repos/mupdf 2. just run jam '-sBUILD=release' on its own to build the native version, to generate the font_*.c and cmap_*.c which we'll need later 3. apply the patch (to be attached, and description) 4. jam '-sBUILD=release' '-sOS=MINGW' '-sCC=i686-pc-mingw32-gcc' \ '-sAR=i686-pc-mingw32-ar -crs' '-sRANLIB=i686-pc-mingw32-ar -rcs' 5. when the build fails due to not finding libfonts.a and libcmaps.a, do them manually: cd build/mingw-amd64-release/ find ../linux-amd64-release/*.c -type f \ -exec i686-pc-mingw32-gcc -I ../../fitz/ -I ../../mupdf/ -c {} \; i686-pc-mingw32-ar -crs libfonts.a font*.o i686-pc-mingw32-ar -crs libcmaps.a cmap*.o cd ../../ 6. do step 4 again. 7. go into mingw-amd64-release/, the files needs a bit of renaming to add the '.exe' ending. 8. copy libfreetype-6.dll , libjpeg-7.dll and zlib1.dll from /usr/i686-pc-mingw32/sys-root/mingw/bin/ to make a release. (by default binaries made have dynamic dependencies) That's it. I tried this myself again on a clean checkout while writing this.
Created attachment 5894 [details] patch to apply Here is a description of what the patch tries to do: - stripe out and fake the libfonts libcmaps dependencies, since it doesn't work and we have to build them by hand from the native-generated files. - modify the include and link paths to point to fedora as shipped header/library locations for freetype - the resource compiler is 'i686-pc-mingw32-windres' , instead of 'windres'. - I tried to build against the fedora-shipped mingw32-openjpeg but it does not work, for yet unknown reason; so ignore those.
Created attachment 5895 [details] zip file of the cross compile, plus dependent dll's $ zipinfo /tmp/mupdf-crossed.zip Archive: /tmp/mupdf-crossed.zip 19110926 bytes 10 files -rwxr-xr-x 2.3 unx 2301552 b- defX 27-Jul-09 02:43 libfreetype-6.dll -rwxr-xr-x 2.3 unx 192227 b- defX 18-Sep-09 22:46 libjpeg-7.dll -rwx--x--x 2.3 unx 6523550 b- defX 21-Jan-10 01:25 npmupdf.dll -rwxr-xr-x 2.3 unx 69120 b- defX 27-Jul-09 03:04 zlib1.dll -rwx--x--x 2.3 unx 6527339 b- defX 21-Jan-10 01:25 mupdf.exe -rwx--x--x 2.3 unx 208978 b- defX 21-Jan-10 01:25 pdfclean.exe -rwx--x--x 2.3 unx 6476440 b- defX 21-Jan-10 01:25 pdfdraw.exe -rwx--x--x 2.3 unx 6464038 b- defX 21-Jan-10 01:25 pdfextract.exe -rwx--x--x 2.3 unx 6477667 b- defX 21-Jan-10 01:25 pdfinfo.exe -rwx--x--x 2.3 unx 207461 b- defX 21-Jan-10 01:25 pdfshow.exe 10 files, 35448372 bytes uncompressed, 19109908 bytes compressed: 46.1%
BTW, this is gcc-4 built, so could be dfferent compared to gcc-3 builds performance-wise. I'd be interested to know if there is any performance differences.
New instructions for Makefile: Build natively first to generate cmap and font files: $ make && mv build/generated pregen && make clean ...or... $ wget http://mupdf.com/download/source/mupdf-pregen.zip $ unzip mupdf-pregen.zip Install third party library package mupdf-thirdparty.zip $ wget http://mupdf.com/download/source/mupdf-thirdparty.zip $ unzip mupdf-thirdparty.zip $ cp thirdparty/jpeg/jconfig.txt thirdparty/jpeg/jconfig.h Build with cross compiler: $ make OS=MINGW CC=i586-mingw32msvc-cc AR=i586-mingw32msvc-ar WINDRES=i586-mingw32msvc-windres
Verifed. Thanks. I must have renamed the files to added the "exe" manually..., mupdf.exe now has an "exe" extension but the other pdf* executables don't. Would be nice to have .exe for them as well. Just a thought.