1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
|
python-gammu installation
=========================
UNIX systems - installation from sources
----------------------------------------
* Gammu library *
First you need Gammu. Either only built as static library or installed
with header files. To do it from source you can follow instructions in
Gammu sources. Shortened version follows here:
1. Download recent Gammu sources from <http://www.gammu.org/>.
2. Unpack it:
> tar xfj gammu-*.tar.bz2
3. Configure (you might want to tweak configure parameters):
> cd gammu-*
> ./configure --prefix=/usr
Optionally you can make it shared library with --enable-shared to
produce shared library.
4. Build:
> make
5. Install:
> sudo make install
* Pkg-config *
For finding gammu libraries, pkg-config is used, so please install it
also.
* Building python-gammu *
Then you can build and install python-gammu. It uses standard distutils,
so it contains from two simple steps:
> python setup.py build
> sudo python setup.py install
Custom installation place
-------------------------
You can override values acquired from pkg-config by passing parameters
to build target. This is useful when you don't have gammu installed, you
can pass path common directory in gammu sources as path to includes and
library:
python setup.py build_ext \
--gammu-libs=path_to_gammu_library \
--gammu-incs=path_to_gammu_includes \
build
Alternatively you can point setup.py to location where you built gammu:
python setup.py build_ext \
--gammu-build=path_to_gammu_build_directory \
build
See "python setup.py build --help" for more options.
When running install later, you will probably need to add --skip-deps in
this case, eg:
python setup.py build_ext --skip-deps \
install
Windows systems
---------------
Current known working way to make static gammu library and then use it.
When you have the library, you need to point build system to right
location. As pkg-config is not well supported on Windows, you have to
specify paths manually in parameters (see above section).
Now you can launch build of python-gammu module.
Alternatively there are be prebuilt modules on python-gammu web site.
Cross compilation for Windows on Linux
--------------------------------------
To build windows python extensions, preferred way is to use windows
Python running with Wine making it invoke MinGW tool chain compiled for
Linux. This way distutils believe it can use the Cygwin/MinGW32
compiler (-mno-cygwin) without patching.
So, install Wine and install Python on Wine:
msiexec /i python-2.5.1.msi
Launch MakeFakeWin.sh at the top of your python-gammu source tree,
giving it MinGW tool chain name (if gcc is called i586-mingw32msvc-gcc,
pass i586-mingw32msvc):
./MakeFakeWin.sh i586-mingw32msvc
Now gcc.exe, g++.exe, dllwrap.exe, dlltool.exe and wx-config.exe
have been created in CWD. These are links to a real windows executable
(wine_linux_launcher.exe) that call the locally created
wine_linux_launcher.sh script, with executable name + all invocation
arguments as parameters, and wait for result files for both return value
and standard output be created and finally pass result back to calling
application, i.e. python.exe, in the Windows way... To summary, it let
distutils do os.popen and os.spawn as expected.
wine c:\\python25\\python setup.py build_ext \
--gammu-libs=../gammu/build-win/common \
--gammu-incs=../gammu/build-win/include/ \
-c mingw32 \
build bdist_wininst
If wine complains about COMSPEC environment variable use
export COMSPEC=cmd.
Now you have in dist directory installer for python-gammu for Windows.
# vim: et ts=4 sw=4 sts=4 tw=72 spell spelllang=en_us
|