Vladimir - 2013-07-27

I have compiled DjVuLibre from source, because Mac OS X pre-compiled binaries are outdated, and would like to share my experience with other Mac users about how to solve some problems.

Before the compilation of djvulibre-3.5.25, I have compiled from source and installed the following packages:
jpeg-9 , libpng-1.6.3 , xz-5.0.5 (just for LZMA2 support in tiff), tiff-4.0.3 , zlib-1.2.8

Aside from minor "/usr/local/include/jmorecfg.h:263: error: expected identifier before numeric constant", which is solved by changing " typedef enum { FALSE = 0 ,
TRUE = 1 } boolean; " to " typedef enum { false= 0 , true= 1 } boolean; " in this file,
there were no problems. So, there is no reason to use macports: they always have outdated software for Mac OS X, but the latest Mac OS X is 100% UNIX Certified -
so now (in most cases) the 'universal' source code works without any modifications!

First of all, the recommended "./configure" command from "README_macosx" (under this paragraph) is wrong for latest version of system and compilation tools, it will give you errors such as this: "error: C compiler cannot create executables", and warnings: "WARNING: JPEG support is disabled", "WARNING: Tiff support is disabled"

./configure \ --enable-static=yes \ --disable-desktopfiles \ --with-extra-includes=/usr/include \ --with-extra-libraries=/usr/lib \ CFLAGS="-arch ppc -arch i386" \ CXXFLAGS="-arch ppc -arch i386" \ LDFLAGS="-arch ppc -arch i386"

The correct "./configure" command is:
./configure --enable-static=yes --enable-desktopfiles=no --with-jpeg=/usr/local/lib

Also, there is a mistake in "./desktopfiles/Makefile.in" file, which causes error:
"/bin/sh: @INKSCAPE@: command not found
cp: ./prebuilt-hi16-djvu.png: No such file or directory"

To fix it, you could open this text file and change "@INKSCAPE@" in "${PNGICONS}" command to: " /Applications/Inkscape.app/Contents/MacOS/Inkscape "

Despite this command has "--without-gui" option and is supposed to generate icons quietly, because of current "Inkscape + XQuartz" chain, Inkscape GUI will open anyway and compilation will be paused. To continue the compilation, you need to click "File -> Exit" at Inkscape "New document 1" program window for each generated icon!

After you have completed everything mentioned above, you would get the following message: "Congratulations: the compilation was successful!" :-)

 
Last edit: Vladimir 2013-07-27