

1- PREREQUISITES
================


1.1 DJVULIBRE
-------------

You need DjVuLibre >= 3.5.18.

See http://djvu.sourceforge.net for the 
source code and for pointers to binary packages.
Under debian type "apt-get install libdjvulibre-dev"


1.2 QT4
-------

You need Qt4 >= 4.2.0

See http://trolltech.com for the source code.
Select the version of Qt adapted to your platform.
Under debian type "apt-get install libqt4-dev qt4-dev-tools


1.3 PKG-CONFIG
--------------

Under Unix the configure script uses pkg-config
to locate the DjVuLibre library and its ancillary files.
See http://pkgconfig.freedesktop.org.

If you do not have pkg-config, you will have
to specify which compilation options using
the variabled DDJVUAPI_CFLAGS and DDJVUAPI_LIBS.


1.4 XDG-UTILS
-------------

Optionally, the installation process under unix creates
a shell script that installs the djview4 menu entry and icon.
This script depends on the XDG "Portland" utilities
available at http://portland.freedesktop.org.

See file desktopfiles/README for more information.



2 COMPILING AND INSTALLING UNDER UNIX
=====================================


2.1 CONFIGURE
-------------

First run the script 'configure' to generate the makefiles.

Command 'configure --help' list options and environment 
variables that affect the generation of makefile.
The most useful ones are:

--prefix=<directory>
        Indicate the base directory for installing djview.
        The default prefix is /usr/local.
        Binary packages are usually compiled with prefix /usr.

--mandir=<directory>
        Indicates where the man pages go.
        The default is ${prefix}/man but many systems 
        prefer to install man pages in ${prefix}/share/man.

PKG_CONFIG_PATH=<colon-separated-directories>
        Indicates the path for search pkg-config description files.
        The default path is /usr/lib/pkgconfig:/usr/share/pkgconfig.
        If you have installed DjVuLibre with a prefix different
        from /usr, you probably want to add ${prefix}/lib/pkgconfig
        to this path.

DDJVUAPI_CFLAGS=<compiler-flags>
        Compiler flags for using the DjVuLibre api.
        This is useful when you do not have pkg-config
        or when pkg-config does not locate DjVuLibre.

DDJVUAPI_LIBS=<linker-flags>
        Linker flags for using the DjVuLibre api.
        This is useful when you do not have pkg-config
        or when pkg-config does not locate DjVuLibre.

QMAKE=<filaname>
        Indicate the location of the Qt4 qmake executable.
        This is useful when configure cannot locate Qt4.

Running configure creates all the required makefiles
and executes command qmake in directory src.


2.2 MAKE
--------

You can then compile djview4 with command
  % make


2.3 INSTALL
-----------

Once the compilation is successful, command
  % make install
copies the binary files to the appropriate location.
The following files are created

        ${bindir}/djview4
        ${bindir}/djview   --> djview4
        ${mandir}/man1/djview4.1
        ${mandir}/man1/djview.1   --> djview4.1
        ${datadir}/djvu/djview4/...

Unless specified otherwise on the configure command line:
        ${bindir}=${prefix}/bin
        ${mandir}=${prefix}/man
        ${datadir}=${prefix}/share

File README_packagers contains more information 
about the installation process.

After the installation, you can run
  % ${datadir}/djview4/desktop/register-djview-menu install
to setup the djview4 menu entries and icons.





3 OTHER PLATFORMS
=================

In general you can compile the standalone 
viewer djview4 on non unix platforms.
However the browser plugin capability 
is currently not working on non X11 systems.

You will need to compile DjVuLibre.
You will need the appropriate version of Qt4.


3.1 MAC OS X
------------

There are two options under Mac OS X.

* Installing the X11 system and its development files.
  First install the X11 version of Qt4.
  Proceding as for normal Unix systems.
  Please refer to section 2 for details.      

* Installing the native Mac OS X version of Qt4.
  First install the native Mac version of Qt4.
  We recommend that you first install macports
  with the libraries zlib, libpng, jpeg and tiff.
  You must also install Qt and compile djvulibre.
  Assuming Qt is in the default location and
  djvulibre in /usr/local, configure with

    $ ./configure --disable-nsdejavu \
        PKG_CONFIG_PATH=/usr/local/lib/pkgconfig \
        QMAKE=/Developer/Tools/Qt/qmake \
        QMAKESPEC=macx-g++
        
  Then compile with
  
    $ make

  Note1: The Qt4 documentation states that qmake can 
  also be used to generate an XCode project file.
  But this is more dependent on the exact XCode version
  you are using. Use QMAKESPEC=macx-xcode
   
  Note2: This procedure generates a nice application bundle.
  However the binaries inside the bundle may depend on 
  shared libraries located elsewhere. To produce a distributable
  application bundle, you must fix that with command install_name_tool.
  See the Qt documentation about the deployment of Mac applications.


3.2 WINDOWS
-----------

There are also two ways to compile djview under Windows.
Both versions

* Using the MINGW compiler is easier because the 
  binary version of Qt/Windows is compiled for MINGW.

  - Install the binary version of Qt4.
  - Install the mingw version of zlib, libtiff, libjpeg.
  - Compile djvulibre using the configure method.
  - Go to directory djview4/src.
  - Type command 
       $ qmake DEFINES+=HAVE_TIFF \
          LIBS+="-L$HOME/djvulibre-3.5/libdjvu/.libs -ldjvulibre -ltiff" \
	  QMAKE_CXXFLAGS+="-I$HOME/djvulibre-3.5"
    where you replace the paths by the actual djvulibre paths.
  - Then compile using 
       $ mingw32-make SHELL=cmd.exe


* Using Visual C++.

  - First you need to compile Qt4 using Visual C++.
    This used to be require patching the Qt source
    <http://qtnode.net/wiki?title=Qt4_with_Visual_Studio>
    Starting with Qt-4.3.2, the opensource Qt version
    supports Visual C++ right out of the box.
  - Compile djvulibre using the visual C++ method.
  - Go to directory src
  - Type command 
       $ qmake -win32 -tp vc
    to generate a MS Visual C++ project file.
  - Tweak the project file to properly link with
    the djvulibre library and the tiff library.
    One good way to do so is to open the file "djvulibre.sln"
    that comes with the cvs version of djvulibre. Then add the
    project "djview.vcproj" and insert the property sheets
    "dirs.vsprops", "warnings.vsprops" and "tools.vsprops".
    This works well despite requiring a lot of clicks.

    


