blob: 5f9ce2703a394f231a9609cd37ab4b985415e228 (
plain) (
blame)
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
|
#!/bin/sh
# Copyright (C) 2010 Olivier Tilloy <olivier@tilloy.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###############################################################################
# This script retrieves all the dependencies required and cross-compiles
# pyexiv2 for windows on a linux host.
#
# Typical dependencies (of this script) on an Ubuntu system:
# wget unzip tar build-essential mingw32 p7zip-full bjam
#
# After execution is complete, copy the following file and folder to the
# site-packages directory of a Python 2.6 windows setup:
# - $BASE/pyexiv2/build/libexiv2python.pyd
# - $BASE/pyexiv2/src/pyexiv2
#
###############################################################################
# Determine the absolute path of the pyexiv2 branch
# (this is where this script is located)
cd $(dirname $0) && BRANCH="$PWD" && cd -
# Where to retrieve and compile dependencies
BASE=$HOME/dev/win32
mkdir -p $BASE
cd $BASE
PLATFORM=i586-mingw32msvc
COMPILER=$PLATFORM-g++
ARCHIVER=$PLATFORM-ar
BUILD=i586-linux
# zlib (for exiv2)
wget --trust-server-names=on http://gnuwin32.sourceforge.net/downlinks/zlib-lib-zip.php
unzip -d zlib zlib-*.zip
# iconv (for exiv2)
wget ftp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
tar xf libiconv-1.13.1.tar.gz
cd libiconv-1.13.1
./configure --enable-static --disable-visibility --target=$PLATFORM --host=$PLATFORM --build=$BUILD --prefix=$BASE/libiconv
make -j3 install
cd ..
# expat (for exiv2)
wget --trust-server-names=on http://sourceforge.net/projects/expat/files/expat/2.0.1/expat-2.0.1.tar.gz/download
tar xf expat-2.0.1.tar.gz
cd expat-2.0.1
./configure --disable-shared --disable-visibility --target=$PLATFORM --host=$PLATFORM --build=$BUILD --prefix=$BASE/expat
make -j3 install
cd ..
# exiv2
wget http://exiv2.org/exiv2-0.21.tar.gz
tar xf exiv2-0.21.tar.gz
cd exiv2-0.21
./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
make -j3 install
cd ..
# python
wget http://python.org/ftp/python/2.7.1/python-2.7.1.msi
7z x python-2.7.1.msi -opython
7z x python/python -opython
# boost-python
wget --trust-server-names=on http://sourceforge.net/projects/boost/files/boost/1.45.0/boost_1_45_0.tar.bz2/download
tar xf boost_1_45_0.tar.bz2
cd boost_1_45_0
echo "using gcc : : $COMPILER : <compileflags>-I$BASE/python <archiver>$ARCHIVER ;" >> tools/build/v2/user-config.jam
bjam install -j 3 --prefix=$BASE/boost --with-python toolset=gcc link=static
cd ..
# pyexiv2
cd $BRANCH
mkdir -p build
$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
|