~osomon/pyexiv2/pyexiv2-0.3

279.2.1 by Olivier Tilloy
Shell script to retrieve dependencies and cross compile pyexiv2
1
#!/bin/sh
2
3
# Copyright (C) 2010 Olivier Tilloy <olivier@tilloy.net>
4
#
5
# This program is free software: you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation, either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18
###############################################################################
19
# This script retrieves all the dependencies required and cross-compiles
20
# pyexiv2 for windows on a linux host.
21
#
22
# Typical dependencies (of this script) on an Ubuntu system:
279.2.7 by Olivier Tilloy
Allow executing the cross compilation script from anywhere,
23
#  wget unzip tar build-essential mingw32 p7zip-full bjam
279.2.1 by Olivier Tilloy
Shell script to retrieve dependencies and cross compile pyexiv2
24
#
25
# After execution is complete, copy the following file and folder to the
26
# site-packages directory of a Python 2.6 windows setup:
27
#  - $BASE/pyexiv2/build/libexiv2python.pyd
28
#  - $BASE/pyexiv2/src/pyexiv2
29
#
30
###############################################################################
31
279.2.7 by Olivier Tilloy
Allow executing the cross compilation script from anywhere,
32
# Determine the absolute path of the pyexiv2 branch
33
# (this is where this script is located)
34
cd $(dirname $0) && BRANCH="$PWD" && cd -
35
36
# Where to retrieve and compile dependencies
279.2.1 by Olivier Tilloy
Shell script to retrieve dependencies and cross compile pyexiv2
37
BASE=$HOME/dev/win32
38
mkdir -p $BASE
39
cd $BASE
40
41
PLATFORM=i586-mingw32msvc
42
COMPILER=$PLATFORM-g++
43
ARCHIVER=$PLATFORM-ar
44
BUILD=i586-linux
45
46
# zlib (for exiv2)
339.1.1 by Olivier Tilloy
Pass --trust-server-names=on to wget to use the last component of the redirection URLs as the local file names.
47
wget --trust-server-names=on http://gnuwin32.sourceforge.net/downlinks/zlib-lib-zip.php
279.2.1 by Olivier Tilloy
Shell script to retrieve dependencies and cross compile pyexiv2
48
unzip -d zlib zlib-*.zip
49
50
# iconv (for exiv2)
51
wget ftp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
52
tar xf libiconv-1.13.1.tar.gz
53
cd libiconv-1.13.1
54
./configure --enable-static --disable-visibility --target=$PLATFORM --host=$PLATFORM --build=$BUILD --prefix=$BASE/libiconv
55
make -j3 install
56
cd ..
57
58
# expat (for exiv2)
339.1.1 by Olivier Tilloy
Pass --trust-server-names=on to wget to use the last component of the redirection URLs as the local file names.
59
wget --trust-server-names=on http://sourceforge.net/projects/expat/files/expat/2.0.1/expat-2.0.1.tar.gz/download
279.2.1 by Olivier Tilloy
Shell script to retrieve dependencies and cross compile pyexiv2
60
tar xf expat-2.0.1.tar.gz
61
cd expat-2.0.1
62
./configure --disable-shared --disable-visibility --target=$PLATFORM --host=$PLATFORM --build=$BUILD --prefix=$BASE/expat
63
make -j3 install
64
cd ..
65
66
# exiv2
339.1.2 by Olivier Tilloy
Updated windows build dependencies:
67
wget http://exiv2.org/exiv2-0.21.tar.gz
68
tar xf exiv2-0.21.tar.gz
69
cd exiv2-0.21
279.2.1 by Olivier Tilloy
Shell script to retrieve dependencies and cross compile pyexiv2
70
./configure --disable-shared --disable-visibility --target=$PLATFORM --host=$PLATFORM --build=$BUILD --disable-nls --with-zlib=$BASE/zlib --with-libiconv-prefix=$BASE/libiconv --with-expat=$BASE/expat --prefix=$BASE/exiv2
71
make -j3 install
72
cd ..
73
74
# python
339.1.2 by Olivier Tilloy
Updated windows build dependencies:
75
wget http://python.org/ftp/python/2.7.1/python-2.7.1.msi
76
7z x python-2.7.1.msi -opython
279.2.1 by Olivier Tilloy
Shell script to retrieve dependencies and cross compile pyexiv2
77
7z x python/python -opython
78
79
# boost-python
339.1.2 by Olivier Tilloy
Updated windows build dependencies:
80
wget --trust-server-names=on http://sourceforge.net/projects/boost/files/boost/1.45.0/boost_1_45_0.tar.bz2/download
81
tar xf boost_1_45_0.tar.bz2
82
cd boost_1_45_0
279.2.1 by Olivier Tilloy
Shell script to retrieve dependencies and cross compile pyexiv2
83
echo "using gcc : : $COMPILER : <compileflags>-I$BASE/python <archiver>$ARCHIVER ;" >> tools/build/v2/user-config.jam
84
bjam install -j 3 --prefix=$BASE/boost --with-python toolset=gcc link=static
85
cd ..
86
87
# pyexiv2
279.2.7 by Olivier Tilloy
Allow executing the cross compilation script from anywhere,
88
cd $BRANCH
321.1.2 by Olivier Tilloy
Don’t choke on an existing build directory.
89
mkdir -p build
321.1.1 by Olivier Tilloy
Updated windows build dependencies:
90
$COMPILER -o build/libexiv2python.pyd -DBOOST_PYTHON_STATIC_LIB -shared src/exiv2wrapper.cpp src/exiv2wrapper_python.cpp $BASE/exiv2/lib/libexiv2.a $BASE/zlib/lib/libz.a $BASE/libiconv/lib/libiconv.a $BASE/expat/lib/libexpat.a $BASE/boost/lib/libboost_python.a -I$BASE/exiv2/include -I$BASE/python -I$BASE/boost/include -L$BASE/python -lpython27
279.2.1 by Olivier Tilloy
Shell script to retrieve dependencies and cross compile pyexiv2
91