Gammu All Mobile Management Utilities - Installation
====================================================


Binaries - Linux
================

Many distributions come with prebuilt Gammu binaries, if you can use
them, it is definitely the easiest thing.


Binaries - Windows
==================

You can download Windows binaries from <http://cihar.com/gammu/>. For
Windows 95, 98 and NT 4.0 you will also need ShFolder DLL, which can be
downloaded from Microsoft:

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=6AE02498-07E9-48F1-A5D6-DBFA18D37E0F


From Sources - Requirements
===========================

Gammu does not require anything at all to build, but you might miss some
features. Optional dependencies include:

Bluez-libs 
    - http://www.bluez.org/
    - Bluetooth support on Linux.

libCURL
    - http://curl.haxx.se/libcurl/
    - New versions notification and phonedb access.

libiconv
    - http://www.gnu.org/software/libiconv/
    - Support for more charsets in AT engine.

Gettext
    - http://www.gnu.org/software/gettext/
    - Localization of strings.

MySQL
    - http://mysql.com/
    - MySQL support in SMSD.

PostgreSQL
    - http://www.postgresql.org/
    - PostgreSQL support in SMSD.


From Sources - Linux
====================

You need CMake from <http://www.cmake.org> for configuring Gammu.

For compatibility reasons, configure like wrapper is provided, if you
don't need much specific tuning, you can use general "./configure; make;
sudo make install" set of commands.

If you need/want to tweak build a bit more than configure wrapper
provides, you have to use CMake directly. For now, only out of source
build is supported, so you have to create separate directory for build:

> mkdir build
> cd build

Then just configure project:

> cmake ..

Build it:

> make

Test that everything is okay:

> make test

And finally install it:

> sudo make install

You can configure build parameters either by command line (see
parameters bellow), or using TUI - ccmake.

Useful cmake parameters:

-DENABLE_SHARED=ON enables shared library
-DCMAKE_BUILD_TYPE="Debug" enables debug build
-DCMAKE_INSTALL_PREFIX="/usr" change installation prefix
-DENABLE_PROTECTION=OFF disables various compile time protections
against buffer overflows and similar attacks

You can also disable support for whole set of phones, e.g.:

-DWITH_NOKIA_SUPPORT=OFF disables Nokia phones support
-DWITH_Bluez=OFF disables Bluetooth support
-DWITH_IrDA=OFF disables IrDA support


From Sources - Windows
======================

You need CMake from <http://www.cmake.org> for configuring Gammu. CMake
is able to generate projects for various tools including Microsoft
Visual Studio, Borland toolchains, Cygwin or Mingw32. Just click on
CMakeLists.txt in project sources and configure CMake to be able to find
optional libraries (see cross compilation section for more information
about getting those). The result should be project for your compiler
where you should be able to work with it as with any other project.

More detailed and up to date information is maintained on the wiki:
http://www.gammu.org/wiki/index.php?title=Gammu:Compiling/installing_in_Windows

Cross compilation for Windows on Linux
======================================

Only cross compilation using CMake has been tested. You need to install
MinGW cross tool chain and run time. On Debian you can do it by apt-get
install mingw32. Build is then quite simple:

mkdir build-win32
cd build-win32
cmake .. -DCROSS_MINGW=ON
make

If your MinGW cross compiler binaries are not found automatically, you
can specify their different names:

cmake .. -DCROSS_MINGW=ON \
    -DMINGW_C_COMPILER=/usr/local/bin/i386-mingw32-gcc \
    -DMINGW_AR=/usr/local/bin/i386-mingw32-ar \
    -DMINGW_RANLIB=/usr/local/bin/i386-mingw32-ranlib

To build just bare static library without any dependencies, use:

cmake .. -DCROSS_MINGW=ON \
    -DENABLE_SHARED=OFF \
    -DMYSQL_CROSS_PATH= \
    -DPOSTGRES_CROSS_PATH= \
    -DCURL_CROSS_PATH= \
    -DGETTEXT_CROSS_PATH=

To be compatible with current Python on Windows, we need to build
against MSVCR71, to achieve this, libmoldname71 library is needed. It
will be hopefully part of next MinGW release, but for now you can build
it following way:

1. Get moldname.def.in from MinGW-runtime sources.
2. Get MinGW-runtime.
3. Execute following commands (crafted for Debian):

i586-mingw32msvc-ar x /usr/i586-mingw32msvc/lib/libmoldname.a isascii.o iscsym.o iscsymf.o toascii.o  strcasecmp.o  strncasecmp.o wcscmpi.o
i586-mingw32msvc-gcc -DRUNTIME=71 -D__FILENAME__=moldname-71.def  -D__MSVCRT__ -C -E -P -xc-header moldname.def.in >moldname-71.def
i586-mingw32msvc-dlltool -k -U --dllname msvcr71.dll --def moldname-71.def --output-lib libmoldname71.a
i586-mingw32msvc-ar rc libmoldname71.a isascii.o iscsym.o iscsymf.o toascii.o strcasecmp.o strncasecmp.o wcscmpi.o
i586-mingw32msvc-ranlib libmoldname71.a

Information taken from <http://www.pygame.org/wiki/PreparingMinGW>.

Furthermore you need to change specs definition for GCC, on Debian you
can do this by editing /usr/bin/i586-mingw32msvc-gcc and changing line
where you can find -lmoldname. Be careful not to change length of
string! There are enough spaces to remove.


MySQL
-----

If you want MySQL support in Win32 build, add path to MySQL binaries in
MYSQL_CROSS_PATH variable:

-DMYSQL_CROSS_PATH=/path/to/mysql

You can download MySQL binaries from <http://dev.mysql.com/>, but then
need some tweaks:

cd mysql/lib/opt
reimp.exe -d libmysql.lib
i586-mingw32msvc-dlltool --kill-at --input-def libmysql.def \
    --dllname libmysql.dll --output-lib libmysql.a

reimp.exe is part of mingw-utils and can be run through wine, I didn't
try to compile native binary from it.


PostgreSQL
----------

If you want PostgreSQL support in Win32 build, add path to MySQL
binaries in POSTGRE_CROSS_PATH variable:

-DPOSTGRES_CROSS_PATH=/path/to/pgsql

You can download PostgreSQL binaries from <http://www.postgresql.org/>,
but then you need to add wldap32.dll library to bin.


Gettext
-------

For Gettext (internationalization support), you need
gettext-0.14.4-bin.zip, gettext-0.14.4-dep.zip, gettext-0.14.4-lib.zip
from <http://gnuwin32.sourceforge.net/>. Unpack these to some directory
and point build 

-DGETTEXT_CROSS_PATH=/path/to/gettext


CURL
----

For CURL support, you need curl-7.19.0-devel-mingw32.zip from
<http://curl.haxx.se/>. Unpack it to some directory and point build

-DCURL_CROSS_PATH=/path/to/curl


# vim: et ts=4 sw=4 sts=4 tw=72 spell spelllang=en_us
