RE: Cross compiling libexiv2 for windows on linux » exiv2-buildwinexe.sh
| 1 |
#! /bin/sh
|
|---|---|
| 2 |
# Cross-compile Exiv2 executable for Windows
|
| 3 |
# 17-Mar-07, ahu
|
| 4 |
|
| 5 |
if [ $# -eq 0 ] ; then |
| 6 |
echo "Usage: `basename $0` directory" |
| 7 |
cat <<EOF |
| 8 |
|
| 9 |
Cross-compile Exiv2 executable for Windows and build -win package.
|
| 10 |
EOF
|
| 11 |
exit 1
|
| 12 |
fi
|
| 13 |
|
| 14 |
dir=$1 |
| 15 |
(
|
| 16 |
if [ ! -e $dir ] ; then |
| 17 |
echo "Error: Directory $dir doesn't exist." |
| 18 |
exit 1
|
| 19 |
fi
|
| 20 |
|
| 21 |
# Configure and cross-compile
|
| 22 |
cd $dir |
| 23 |
make maintainer-clean |
| 24 |
make config |
| 25 |
./configure --disable-shared --disable-visibility --target=i586-mingw32msvc --host=i586-mingw32msvc --build=i586-linux --disable-nls --with-zlib=$HOME/mingw --with-libiconv-prefix=$HOME/mingw --with-expat=$HOME/mingw |
| 26 |
make -j3
|
| 27 |
|
| 28 |
# Prepare package
|
| 29 |
cd src
|
| 30 |
rel=`grep EXV_PACKAGE_VERSION ../msvc/include/exv_msvc.h | sed 's/.*"\(.*\)"/\1/'` |
| 31 |
tmpdir=exiv2-$rel-win |
| 32 |
rm -rf $tmpdir |
| 33 |
mkdir $tmpdir |
| 34 |
cp exiv2 $tmpdir/exiv2.exe |
| 35 |
cd $tmpdir |
| 36 |
strip exiv2.exe |
| 37 |
cp ../../doc/cmd.txt . |
| 38 |
cp ../../doc/cmdxmp.txt . |
| 39 |
cp $HOME/mingw/dll/libexpat.dll . |
| 40 |
todos cmd.txt cmdxmp.txt |
| 41 |
$HOME/src/exiv2/exiv2-htmlman.sh ../exiv2.1
|
| 42 |
zip exiv2-$rel-win.zip exiv2.exe cmd.txt cmdxmp.txt exiv2-man.html libexpat.dll |
| 43 |
|
| 44 |
# Cleanup
|
| 45 |
mv exiv2-$rel-win.zip ../../.. |
| 46 |
cd ..
|
| 47 |
rm -rf $tmpdir |
| 48 |
cd ../..
|
| 49 |
|
| 50 |
) 2>&1 | tee exiv2-buildwinexe.out 2>&1 |