aboutsummaryrefslogtreecommitdiffstats
path: root/cross-compile.sh
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2010-03-16 11:10:25 +0100
committerOlivier Tilloy <olivier@tilloy.net>2010-03-16 11:10:25 +0100
commit168fcd9dbce29165315b6514c49377493879b8ba (patch)
tree6cb3e751c3b61b1524ab217acefc0ed480ae1a23 /cross-compile.sh
parent0ed83f2136ac4ca36200afd2ff45b2ddf2eb84d8 (diff)
downloadpyexiv2-168fcd9dbce29165315b6514c49377493879b8ba.tar.gz
Shell script to retrieve dependencies and cross compile pyexiv2
for windows on a linux host.
Diffstat (limited to 'cross-compile.sh')
-rwxr-xr-xcross-compile.sh88
1 files changed, 88 insertions, 0 deletions
diff --git a/cross-compile.sh b/cross-compile.sh
new file mode 100755
index 0000000..5e29471
--- /dev/null
+++ b/cross-compile.sh
@@ -0,0 +1,88 @@
+#!/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 bzr
+#
+# 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
+#
+###############################################################################
+
+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 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 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.19.tar.gz
+tar xf exiv2-0.19.tar.gz
+cd exiv2-0.19
+./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://www.python.org/ftp/python/2.6.4/python-2.6.4.msi
+7z x python-2.6.4.msi -opython
+7z x python/python -opython
+
+# boost-python
+wget http://sourceforge.net/projects/boost/files/boost/1.42.0/boost_1_42_0.tar.bz2/download
+tar xf boost_1_42_0.tar.bz2
+cd boost_1_42_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
+bzr branch lp:pyexiv2
+cd pyexiv2
+mkdir 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 -lpython26
+cd ..
+